Bacula-users

Re: [Bacula-users] Could not create JobMedia record

2010-04-14 09:21:37
Subject: Re: [Bacula-users] Could not create JobMedia record
From: Martin Simmons <martin AT lispworks DOT com>
To: bacula-users AT lists.sourceforge DOT net
Date: Wed, 14 Apr 2010 14:19:30 +0100
>>>>> On Wed, 14 Apr 2010 02:30:15 -0400, ladolf  said:
> 
> 
> Martin Simmons wrote:
> > 
> > > 
> > > > 
> > > > > 
> > > > > > 
> > > > > > > On Tue, 13 Apr 2010 04:08:03 -0400, ladolf  said:
> > > > > > > 
> > > > > > 
> > > > > 
> > > > 
> > > 
> > > I am trying to import tape data to bacula catalog using bscan:
> > > bscan -b mju3-fd_MJU-TED2.bsr -m -n bacula -u bacula  -P bacula -h 
> > > localhost -s -S -v /dev/st0
> > > 
> > > I got this error:
> > > bscan: bscan.c:1245 Could not create JobMedia record. 
> > > ERR=sql_create.c:156 Update Media record UPDATE Media SET EndFile=167, 
> > > EndBlock=27602 WHERE MediaId=0 failed: ERR=
> > > 
> > > This is whole log:
> > > bacula:~ # bscan -b /root/bacula/mju1-fd_MJU-MES3.bsr -m -n bacula -u 
> > > bacula -P bacula -s -S -v /dev/st0
> > > bscan: butil.c:282 Using device: "/dev/st0" for reading.
> > > 13-Apr 08:17 bscan JobId 0: Ready to read from volume "MJU-MES3" on 
> > > device "LTO3Drive" (/dev/st0).
> > > bscan: bscan.c:297 First Volume Size = 0
> > > bscan: bscan.c:309 Using Database: bacula, User: bacula
> > > 13-Apr 08:17 bscan JobId 0: Forward spacing Volume "MJU-MES3" to 
> > > file:block 0:1.
> > > bscan: bscan.c:521 SOS_LABEL: Found Job record for JobId: 375
> > > ...
> > > bscan: bscan.c:689 1,572,864 file records. At file:blk=165:13,267 
> > > bytes=330,660,788,028
> > > bscan: bscan.c:1037 Fileset "MJU_NSS" already exists.
> > > bscan: bscan.c:1152 Could not update JobId=328 record. 
> > > ERR=sql_update.c:196 Update failed: affected_rows=0 for UPDATE Job SET 
> > > JobStatus='T',EndTime='2010-03-30 
> > > 05:21:18',ClientId=2,JobBytes=335474793333,ReadBytes=0,JobFiles=1594852,JobErrors=0,VolSessionId=43,VolSessionTime=1268211453,PoolId=0,FileSetId=9,JobTDate=1269919278,RealEndTime='2010-03-30
> > >  05:21:18',PriorJobId=0 WHERE JobId=328
> > > 
> > > bscan: bscan.c:1245 Could not create JobMedia record. 
> > > ERR=sql_create.c:156 Update Media record UPDATE Media SET EndFile=167, 
> > > EndBlock=27602 WHERE MediaId=0 failed: ERR=
> > > 
> > 
> > What is in the bsr file?  Also, I notice that you have two different bsr 
> > files
> > in the command lines above.  Do you have any bsr files that work?
> > 
> > BTW, I hope you aren't using /dev/st0 in your bacula-sd.conf -- it should be
> > /dev/nst0, otherwise the start of the tape might be overwritten if you run
> > more than one job.
> > 
> 
> Thanks for the notice __Martin. You are right. The first bsr (TED2) is wrong 
> one. But the second one (mju1-fd_MJU-MES3.bsr) should be valid one. I 
> actually have 3 bsr files (3 jobs) for that monthly tape
> mju1-fd_MJU-MES3.bsr
> mju2-fd_MJU-MES3.bsr
> mju3-fd_MJU-MES3.bsr
> but only first one is important. Should I include all 3 bsr files in one 
> command line?
> 
> The reason I am trying to get data from this tape is because I installed a
> new bacula server. Old bacula server was the same version (3.0.2). A new
> server used LTO-3 drive, a new one has LTO-4. I left section for LTO-3 drive
> in bacula-sd.conf. I dumped catalog from old server and inported it to new
> server. Restore from old tape worked.
> The problem occured because the first time monthly tape should be used on
> new server, but backup on new server did not start (forgot to add mount to
> start of the job). Because old server was still running, I have montly
> backup, which is in catalog on old server, but not in catalog on new
> server. I would like to import it to new server.
> I know I could use bextract in case of emergency, but I would still like to
> import informations about data on monthly tape into new catalog.

The bsr created by a backup might be too restrictive for bscan.

Can you bscan the whole tape by passing the -V VolumeName argument instead of
using the bsr?


> Bacula reports that jobs are imported, but volume is not.
> 
> I am using /dev/st0, not /dev/nst0. Why would be this wrong? I have no
> problem running more than one job.

The /dev/st0 device usually rewinds the tape every time it is opened, whereas
the /dev/nst0 device leaves it at the current position.  This matters in some
Bacula confgurations because it can close and reopen the device and expect it
to remain in the same place.  If the tape rewinds, then it will overwrite the
volume label and existing jobs.  Bacula will always rewind the tape itself if
it needs to.

__Martin

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users