Bacula-users

Re: [Bacula-users] bscan won't update media [solved]

2013-04-28 15:34:04
Subject: Re: [Bacula-users] bscan won't update media [solved]
From: Ross Boylan <ross AT biostat.ucsf DOT edu>
To: bacula-users AT lists.sourceforge DOT net
Date: Sun, 28 Apr 2013 12:30:46 -0700
I don't understand why, but scanning the volume without using the bsr
seems to work:

$ bscan -v -s -m -V Catalog2013-04-14_6167 File2Storage
Records added or updated in the catalog:
      1 Media
      1 Pool
      5 Job
      5 File

I got the idea from http://osdir.com/ml/bacula/2011-08/msg00107.html
in which Martin wrote "For multi-volume backups, I think you have to
bscan all of the volumes in a single command by using -V with | (bar)
separated volume names." My situation was the reverse: multiple jobs
on a single volume.

The non-updating of the media when using the bsr seems like a bug.  Is
it a feature?

Ross


On Sun, Apr 28, 2013 at 10:55:03AM -0700, Ross Boylan wrote:
> I have not been able to restore my catalog dump from a previous backup
> on a different system.  I'll start with the problem I can't solve, and
> then note a couple I did solve for the archvive (and comments).
> 
> I'd be very grateful for any help; I'm kind of dead in the water til I
> get my files back.  The original system died, including its primary
> disk.
> 
> I think the key problem is that bscan is not setting media, although
> invoked with -m:
> <terminal>
> $ bscan -s -m -b 
> /usr/local/var/backup/bacula-live/BackupCatalog.2013-04-17_23.bsr -c 
> /etc/bacula/bacula-sd.conf File2Storage
> bscan: butil.c:287 Using device: "File2Storage" for reading.
> 27-Apr 15:09 bscan JobId 0: Ready to read from volume 
> "Catalog2013-04-14_6167" on device "File2Storage" 
> (/usr/local/var/backup/bacula-live).
> 27-Apr 15:09 bscan JobId 0: Forward spacing Volume "Catalog2013-04-14_6167" 
> to file:block 0:252654358.
> bscan: bscan.c:1139 Created new JobId=13 record for original JobId=11551
> bscan: bscan.c:1284 Could not create JobMedia record. ERR=sql_create.c:155 
> Update Media record UPDATE Media SET EndFile=0, EndBlock=314892037 WHERE 
> MediaId=0 failed: ERR=
> 
> 27-Apr 15:09 bscan JobId 0: End of Volume at file 0 on device "File2Storage" 
> (/usr/local/var/backup/bacula-live), Volume "Catalog2013-04-14_6167"
> bscan: bscan.c:338-0 ========== JobId=0 ========
> bscan: bscan.c:1002 Could not update media record. ERR=sql_update.c:411 
> Update failed: affected_rows=0 for UPDATE Media SET 
> VolJobs=1,VolFiles=0,VolBlocks=0,VolBytes=62202952,VolMounts=0,VolErrors=0,VolWrites=0,MaxVolBytes=0,VolStatus='',Slot=0,InChanger=0,VolReadTime=0,VolWriteTime=0,VolParts=0,LabelType=0,StorageId=0,PoolId=0,VolRetention=0,VolUseDuration=0,MaxVolJobs=0,MaxVolFiles=0,Enabled=0,LocationId=0,ScratchPoolId=0,RecyclePoolId=0,RecycleCount=0,Recycle=0,ActionOnPurge=0
>  WHERE VolumeName=''
> 
> 27-Apr 15:09 bscan JobId 0: End of all volumes.
> bscan: bscan.c:1002 Could not update media record. ERR=sql_update.c:411 
> Update failed: affected_rows=0 for UPDATE Media SET 
> VolJobs=1,VolFiles=0,VolBlocks=0,VolBytes=62202952,VolMounts=1,VolErrors=0,VolWrites=0,MaxVolBytes=0,VolStatus='',Slot=0,InChanger=0,VolReadTime=0,VolWriteTime=0,VolParts=0,LabelType=0,StorageId=0,PoolId=0,VolRetention=0,VolUseDuration=0,MaxVolJobs=0,MaxVolFiles=0,Enabled=0,LocationId=0,ScratchPoolId=0,RecyclePoolId=0,RecycleCount=0,Recycle=0,ActionOnPurge=0
>  WHERE VolumeName=''
> 
> bscan: bscan.c:659 End of all Volumes. VolFiles=0 VolBlocks=0 
> VolBytes=62,202,952
> Records added or updated in the catalog:
>       0 Media
>       0 Pool
>       1 Job
>       1 File
> </terminal>
> The job does appear in the catalog after this, and so it can't just be
> that I lack write access.
> 
> The bsr file has MediaType but no Media entry:
> <bsr>
> # 18-Apr-2013 00:08:23 - BackupCatalog.2013-04-17_23.42.00.07 - Full
> Volume="Catalog2013-04-14_6167"
> MediaType="File2"
> VolSessionId=6
> VolSessionTime=1366266984
> VolFile=0-0
> VolBlock=252654358-314892037
> FileIndex=1-1
> </bsr>
> 
> bacula-sd.conf includes
> <conf>
> # compatibility with old setup
> Device {
>   Name = File2Storage
>   Media Type = File2
>   Archive Device = /usr/local/var/backup/bacula-live
>   LabelMedia = yes;                   # lets Bacula label unlabeled media
>   Random Access = Yes;
>   AutomaticMount = yes;               # when device opened, read it
>   RemovableMedia = no;
>   AlwaysOpen = no;
> }
> </conf>
> 
> When I run the restore job, I get an error about the media record
> <log>
> Run Restore job
> JobName:    RestoreFiles
> Bootstrap:  /usr/local/var/backup/bacula-live/BackupCatalog.2013-04-17_23.bsr
> Where:      /usr/local/var/backup/bacula-live/
> Replace:         always
> Client:          tempserver-fd
> Storage:         File2Storage
> JobId:           13
> When:            2013-04-27 15:19:37
> Catalog:         MyCatalog
> Priority:        10
> Plugin Options:  *None*
> OK to run? (yes/mod/no): y
> Job queued. JobId=15
> *mess
> 27-Apr 15:20 tempserver-dir JobId 15: Start Restore Job 
> RestoreFiles.2013-04-27_15.20.33_11
> 27-Apr 15:20 tempserver-dir JobId 15: Using Device "File2Storage"
> 27-Apr 15:20 tempserver-sd JobId 15: Warning: acquire.c:208 Read acquire: 
> Error getting Volume info: 1997 Volume "Catalog2013-04-14_6167" not in 
> catalog.
> 27-Apr 15:20 tempserver-sd JobId 15: Ready to read from volume 
> "Catalog2013-04-14_6167" on device "File2Storage" 
> (/usr/local/var/backup/bacula-live).
> 27-Apr 15:20 tempserver-sd JobId 15: Forward spacing Volume 
> "Catalog2013-04-14_6167" to file:block 0:252654358.
> 27-Apr 15:20 tempserver-sd JobId 15: End of Volume at file 0 on device 
> "File2Storage" (/usr/local/var/backup/bacula-live), Volume 
> "Catalog2013-04-14_6167"
> 27-Apr 15:20 tempserver-sd JobId 15: End of all volumes.
> 27-Apr 15:20 tempserver-dir JobId 15: Error: Unable to get Media record for 
> Volume Catalog2013-04-14_6167: ERR=sql_get.c:1096 Media record for Volume 
> "Catalog2013-04-14_6167" not found.
> 
> 27-Apr 15:20 tempserver-sd JobId 15: Fatal error: Error getting Volume info: 
> 1991 Catalog Request for vol=Catalog2013-04-14_6167 failed: sql_get.c:1096 
> Media record for Volume "Catalog2013-04-14_6167" not found.
> 27-Apr 15:20 tempserver-dir JobId 15: Error: Bacula tempserver-dir 5.2.6 
> (21Feb12):
> </log>
> 
> Context:
> 1. The backup server and client are the same machine.
> 2. bacula 5.2.6 on 64bit Debian Wheezy (amd64).
> 3. backup created by bacula 2.4 on 32 bit Debian Lenny (i386).
> 4. backup was encrypted.  I have copied the keys.
> 5. The new system and the old system have different names.
> 6. Backup is to disk.
> 
> Finally, here are some discoveries along the way:
> 1. The final argument to bscan, described as a device in the
> documentation,  needs to be the name of the storage section in the
> config file.
> 2. If one provides a directory rather than a file for the bsr option
> when running the restore, the director consumes an entire CPU while
> the other server processes are idle.  As far as I could tell this went
> on forever, and it was not interruptible by cancel from the console.
> This seems like a bug.
> 3. Restoring from the bsr does not work unless appropriate catalog
> entries are present.  The manual, e.g., 37.8 "Restoring a Server"
> seemed to imply this was not necessary, though it does mention using
> bscan shortly after using the bootstrap file.  
> 
> Ross Boylan

------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service 
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr
_______________________________________________
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>