Bacula-users

[Bacula-users] Could not create JobMedia record

2010-04-15 05:24:54
Subject: [Bacula-users] Could not create JobMedia record
From: ladolf <bacula-forum AT backupcentral DOT com>
To: bacula-users AT lists.sourceforge DOT net
Date: Thu, 15 Apr 2010 05:21:58 -0400

Martin Simmons wrote:
> 
> > 
> > > 
> > > > 
> > > > > 
> > > > > > 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® 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.net
> https://lists.sourceforge.net/lists/listinfo/bacula-users



Martin you are the man. Than you very much. It worked without bootstrap with 
specified volume name.

bacula&#58;~ # bscan -m -n bacula -u bacula -P bacula -s -S -v -V MJU-MES3 
/dev/st0
bscan&#58; butil.c&#58;282 Using device&#58; "/dev/st0" for reading.
15-Apr 08&#58;00 bscan JobId 0&#58; Ready to read from volume "MJU-MES3" on 
device "LTO3Drive" &#40;/dev/st0&#41;.
bscan&#58; bscan.c&#58;297 First Volume Size = 0
bscan&#58; bscan.c&#58;309 Using Database&#58; bacula, User&#58; bacula
bscan&#58; bscan.c&#58;451 Pool record for MJU-MESECNI found in DB.
bscan&#58; bscan.c&#58;465 Pool type "Backup" is OK.
bscan&#58; bscan.c&#58;949 Created Media record for Volume&#58; MJU-MES3
bscan&#58; bscan.c&#58;493 Media type "LTO-3" is OK.
bscan&#58; bscan.c&#58;503 VOL_LABEL&#58; OK for Volume&#58; MJU-MES3
bscan&#58; bscan.c&#58;521 SOS_LABEL&#58; Found Job record for JobId&#58; 375
bscan&#58; bscan.c&#58;689 32,768 file records. At file&#58;blk=4&#58;10,978 
bytes=8,703,061,051
bscan&#58; bscan.c&#58;689 65,536 file records. At file&#58;blk=12&#58;10,007 
bytes=24,631,024,504
bscan&#58; bscan.c&#58;689 98,304 file records. At file&#58;blk=17&#58;12,296 
bytes=34,772,701,821
bscan&#58; bscan.c&#58;689 131,072 file records. At file&#58;blk=41&#58;17,177 
bytes=83,059,132,886
bscan&#58; bscan.c&#58;689 163,840 file records. At file&#58;blk=48&#58;14,540 
bytes=96,880,864,444
bscan&#58; bscan.c&#58;689 196,608 file records. At file&#58;blk=56&#58;19,592 
bytes=113,197,106,283
bscan&#58; bscan.c&#58;689 229,376 file records. At file&#58;blk=58&#58;27,181 
bytes=117,684,093,523
bscan&#58; bscan.c&#58;689 262,144 file records. At file&#58;blk=62&#58;1,354 
bytes=124,014,167,373
bscan&#58; bscan.c&#58;689 294,912 file records. At file&#58;blk=70&#58;14,673 
bytes=140,863,486,186
bscan&#58; bscan.c&#58;689 327,680 file records. At file&#58;blk=78&#58;10,895 
bytes=156,610,411,395
bscan&#58; bscan.c&#58;689 360,448 file records. At file&#58;blk=83&#58;13,104 
bytes=166,746,960,779
bscan&#58; bscan.c&#58;689 393,216 file records. At file&#58;blk=86&#58;8,809 
bytes=172,466,482,115
bscan&#58; bscan.c&#58;689 425,984 file records. At file&#58;blk=89&#58;11,381 
bytes=178,628,819,126
bscan&#58; bscan.c&#58;689 458,752 file records. At file&#58;blk=89&#58;18,176 
bytes=179,066,906,879
bscan&#58; bscan.c&#58;689 491,520 file records. At file&#58;blk=92&#58;22,443 
bytes=185,338,483,956
bscan&#58; bscan.c&#58;689 524,288 file records. At file&#58;blk=94&#58;28,568 
bytes=189,731,077,990
bscan&#58; bscan.c&#58;689 557,056 file records. At file&#58;blk=97&#58;1,878 
bytes=194,006,613,756
bscan&#58; bscan.c&#58;689 589,824 file records. At file&#58;blk=98&#58;24,191 
bytes=197,444,114,700
bscan&#58; bscan.c&#58;689 622,592 file records. At file&#58;blk=101&#58;1,503 
bytes=201,977,734,504
bscan&#58; bscan.c&#58;689 655,360 file records. At file&#58;blk=103&#58;5,551 
bytes=206,236,416,311
bscan&#58; bscan.c&#58;689 688,128 file records. At file&#58;blk=105&#58;20,407 
bytes=211,191,859,732
bscan&#58; bscan.c&#58;689 720,896 file records. At file&#58;blk=107&#58;11,985 
bytes=214,646,482,899
bscan&#58; bscan.c&#58;689 753,664 file records. At file&#58;blk=109&#58;4,482 
bytes=218,160,362,222
bscan&#58; bscan.c&#58;689 786,432 file records. At file&#58;blk=111&#58;11,846 
bytes=222,632,833,079
bscan&#58; bscan.c&#58;689 819,200 file records. At file&#58;blk=113&#58;16,598 
bytes=226,936,844,498
bscan&#58; bscan.c&#58;689 851,968 file records. At file&#58;blk=114&#58;30,066 
bytes=229,804,061,984
bscan&#58; bscan.c&#58;689 884,736 file records. At file&#58;blk=116&#58;23,355 
bytes=233,368,979,739
bscan&#58; bscan.c&#58;689 917,504 file records. At file&#58;blk=118&#58;21,228 
bytes=237,229,506,388
bscan&#58; bscan.c&#58;689 950,272 file records. At file&#58;blk=120&#58;10,759 
bytes=240,552,144,588
bscan&#58; bscan.c&#58;689 983,040 file records. At file&#58;blk=122&#58;7,032 
bytes=244,309,483,708
bscan&#58; bscan.c&#58;689 1,015,808 file records. At file&#58;blk=125&#58;175 
bytes=249,863,830,608
bscan&#58; bscan.c&#58;689 1,048,576 file records. At 
file&#58;blk=127&#58;3,697 bytes=254,088,554,605
bscan&#58; bscan.c&#58;689 1,081,344 file records. At 
file&#58;blk=129&#58;1,135 bytes=257,921,027,684
bscan&#58; bscan.c&#58;689 1,114,112 file records. At 
file&#58;blk=131&#58;13,974 bytes=262,746,474,845
bscan&#58; bscan.c&#58;689 1,146,880 file records. At 
file&#58;blk=133&#58;9,000 bytes=266,423,396,078
bscan&#58; bscan.c&#58;689 1,179,648 file records. At 
file&#58;blk=134&#58;26,385 bytes=269,543,135,181
bscan&#58; bscan.c&#58;689 1,212,416 file records. At 
file&#58;blk=137&#58;6,189 bytes=274,237,434,348
bscan&#58; bscan.c&#58;689 1,245,184 file records. At 
file&#58;blk=140&#58;2,814 bytes=280,016,262,795
bscan&#58; bscan.c&#58;689 1,277,952 file records. At 
file&#58;blk=142&#58;23,266 bytes=285,332,608,122
bscan&#58; bscan.c&#58;689 1,310,720 file records. At file&#58;blk=151&#58;193 
bytes=301,834,299,444
bscan&#58; bscan.c&#58;689 1,343,488 file records. At 
file&#58;blk=152&#58;6,006 bytes=304,207,955,949
bscan&#58; bscan.c&#58;689 1,376,256 file records. At 
file&#58;blk=155&#58;2,927 bytes=310,005,898,602
bscan&#58; bscan.c&#58;689 1,409,024 file records. At 
file&#58;blk=156&#58;24,495 bytes=313,395,284,202
bscan&#58; bscan.c&#58;689 1,441,792 file records. At 
file&#58;blk=157&#58;16,031 bytes=314,848,411,398
bscan&#58; bscan.c&#58;689 1,474,560 file records. At 
file&#58;blk=158&#58;13,330 bytes=316,673,068,788
bscan&#58; bscan.c&#58;689 1,507,328 file records. At 
file&#58;blk=159&#58;10,262 bytes=318,474,063,228
bscan&#58; bscan.c&#58;689 1,540,096 file records. At 
file&#58;blk=164&#58;27,701 bytes=329,592,591,048
bscan&#58; bscan.c&#58;689 1,572,864 file records. At 
file&#58;blk=165&#58;13,267 bytes=330,660,788,028
bscan&#58; bscan.c&#58;1037 Fileset "MJU_NSS" already exists.
bscan&#58; bscan.c&#58;1152 Could not update JobId=328 record. 
ERR=sql_update.c&#58;196 Update failed&#58; affected_rows=0 for UPDATE Job SET 
JobStatus='T',EndTime='2010-03-30 
05&#58;21&#58;18',ClientId=2,JobBytes=335474793333,ReadBytes=0,JobFiles=1594852,JobErrors=0,VolSessionId=43,VolSessionTime=1268211453,PoolId=5,FileSetId=9,JobTDate=1269919278,RealEndTime='2010-03-30
 05&#58;21&#58;18',PriorJobId=0 WHERE JobId=328

bscan&#58; bscan.c&#58;1250 Created JobMedia record JobId 328, MediaId 54
bscan&#58; bscan.c&#58;521 SOS_LABEL&#58; Found Job record for JobId&#58; 376
bscan&#58; bscan.c&#58;689 1,605,632 file records. At file&#58;blk=168&#58;690 
bytes=335,627,184,186
bscan&#58; bscan.c&#58;689 1,638,400 file records. At 
file&#58;blk=172&#58;17,926 bytes=344,733,785,895
bscan&#58; bscan.c&#58;689 1,671,168 file records. At 
file&#58;blk=177&#58;28,239 bytes=355,392,790,406
bscan&#58; bscan.c&#58;689 1,703,936 file records. At 
file&#58;blk=178&#58;10,198 bytes=356,228,461,058
bscan&#58; bscan.c&#58;1037 Fileset "MJU_NSS" already exists.
bscan&#58; bscan.c&#58;1152 Could not update JobId=329 record. 
ERR=sql_update.c&#58;196 Update failed&#58; affected_rows=0 for UPDATE Job SET 
JobStatus='T',EndTime='2010-03-30 
05&#58;40&#58;15',ClientId=3,JobBytes=20946594494,ReadBytes=0,JobFiles=110798,JobErrors=0,VolSessionId=44,VolSessionTime=1268211453,PoolId=5,FileSetId=9,JobTDate=1269920415,RealEndTime='2010-03-30
 05&#58;40&#58;15',PriorJobId=0 WHERE JobId=329

bscan&#58; bscan.c&#58;1250 Created JobMedia record JobId 329, MediaId 54
bscan&#58; bscan.c&#58;1020 Created Client record for Client&#58; mju3-fd
bscan&#58; bscan.c&#58;1103 Created new JobId=386 record for original JobId=330
bscan&#58; bscan.c&#58;1037 Fileset "BaculaServerFileSet" already exists.
bscan&#58; bscan.c&#58;1158 Updated Job termination record for JobId=386 
Level=Full TermStat=T
bscan&#58; bscan.c&#58;1250 Created JobMedia record JobId 386, MediaId 54
15-Apr 09&#58;30 bscan JobId 0&#58; End of Volume at file 181 on device 
"LTO3Drive" &#40;/dev/st0&#41;, Volume "MJU-MES3"
bscan&#58; bscan.c&#58;338-386 ========== JobId=0 ========
bscan&#58; bscan.c&#58;970 Updated Media record at end of Volume&#58; MJU-MES3
bscan&#58; bscan.c&#58;371 First Volume Size = 0
15-Apr 09&#58;30 bscan JobId 0&#58; End of all volumes.
bscan&#58; bscan.c&#58;970 Updated Media record at end of Volume&#58; MJU-MES3
bscan&#58; bscan.c&#58;638 End of all Volumes. VolFiles=181 VolBlocks=0 
VolBytes=358,765,058,045
Records added or updated in the catalog&#58;
&nbsp; &nbsp; &nbsp; 1 Media
&nbsp; &nbsp; &nbsp; 1 Pool
&nbsp; &nbsp; &nbsp; 3 Job
1711598 File

I tried with /dev/st0, because /dev/nst0 was not in bacula-sd.conf. I will also 
try to change that, but my problem is solved now.
bscan -m -n bacula -u bacula -P bacula -s -S -v -V MJU-MES3 /dev/nst0
bscan&#58; butil.c&#58;278 Could not find device "/dev/nst0" in config file 
bacula-sd.conf.
15-Apr 08&#58;00 bscan JobId 0&#58; Fatal error&#58; butil.c&#58;168 Cannot 
find device "/dev/nst0" in config file bacula-sd.conf.

+----------------------------------------------------------------------
|This was sent by lado.langof AT gmail DOT com via Backup Central.
|Forward SPAM to abuse AT backupcentral DOT com.
+----------------------------------------------------------------------



------------------------------------------------------------------------------
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
<Prev in Thread] Current Thread [Next in Thread>