Hi Pierre,

after reading through your messages on this topic, I wonder why you did not just use bextract to extract the latest catalog backup.

However, I also wonder why the -m switch did not properly create the needed media records in the catalog database. I suspect that this may be due to the fact that the bootstrap file was used and did direct bscan to skip the volume header; however, at this time, this is speculation.

In the Bacula environments I know of, we usually use a setup that uses a dedicated pool, media type and device for catalog backups, and writes each backup into its own volume, and thus such a scenario is not something I encountered recently.

For your sanity's sake, it might be useful to implement such an approach as well and to ensure your DR procedures work.

On the other hand, the process you describe *does* look good to me, so the failure to create media records might be worth a bug report -- either the documentation or the bscan program needs touching, I think.

Cheers,

Arno


Am 02.06.2026 um 18:27 schrieb Pierre Bernhardt:
Ok, last update:

I dropped and recreated the database:

   520  db_name=bacula /usr/share/bacula-director/drop_postgresql_database
  521  db_name=bacula /usr/share/bacula-director/ create_postgresql_database
   522  db_name=bacula /usr/share/bacula-director/make_postgresql_tables
  523  db_name=bacula db_user=bacula /usr/share/bacula-director/ grant_postgresql_privileges

then I tried again first to insert the job by using den bsr file:

bacula@backup:~$ /usr/sbin/bscan -b BackupCatalog.bsr -m -s -v -V DISK035  DiskStorage1
bscan: butil.c:292-0 Using device: "DiskStorage1" for reading.
02-Jun 18:10 bscan JobId 0: Ready to read from volume "DISK035" on File device "DiskStorage1" (/media/baculadisk1).
bscan: bscan.c:323-0 Using Database: bacula, User: bacula
02-Jun 18:10 bscan JobId 0: Forward spacing Volume "DISK035" to addr=1618422790992
bscan: bscan.c:1067-0 Created Client record for Client: backup-fd
bscan: bscan.c:1149-0 Created new JobId=1 record for original JobId=84813
bscan: bscan.c:1093-0 Created FileSet record "Catalog"
bscan: bscan.c:1214-0 Updated Job termination record for JobId=1 Level=Full TermStat=T bscan: bscan.c:1299-0 Could not create JobMedia record. ERR=sql_create.c:135 Update Media record UPDATE Media SET EndFile=383, EndBlock=1266266991 WHERE MediaId=0 failed: ERR=

02-Jun 18:14 bscan JobId 0: End of Volume "DISK035" at addr=1646238741360 on device "DiskStorage1" (/media/baculadisk1). bscan: bscan.c:1013-0 Could not update media record. ERR=bdb.h:140 Update failed: affected_rows=0 for UPDATE Media SET VolJobs=1,VolFiles=0,VolBlocks=0,VolBytes=27812130636,VolABytes=0,VolHoleBytes=0,VolHoles=0,VolMounts=0,VolErrors=0,VolWrites=0,MaxVolBytes=0,VolStatus='',Slot=0,InChanger=0,VolReadTime=0,VolWriteTime=0,VolType=0,VolParts=0,VolCloudParts=0,LastPartBytes=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,CacheRetention=0,EndBlock=0 WHERE VolumeName=''

bscan: bscan.c:1013-0 Could not update media record. ERR=bdb.h:140 Update failed: affected_rows=0 for UPDATE Media SET VolJobs=1,VolFiles=0,VolBlocks=0,VolBytes=27812130636,VolABytes=0,VolHoleBytes=0,VolHoles=0,VolMounts=1,VolErrors=0,VolWrites=0,MaxVolBytes=0,VolStatus='',Slot=0,InChanger=0,VolReadTime=0,VolWriteTime=0,VolType=0,VolParts=0,VolCloudParts=0,LastPartBytes=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,CacheRetention=0,EndBlock=0 WHERE VolumeName=''

bscan: bscan.c:669-0 End of all Volumes. VolFiles=0 VolBlocks=0 VolBytes=27,812,130,636
Records added or updated in the catalog:
       0 Media
       0 Pool
       1 Job
       2 File

Failed!!!

Then I recreated the database again and used the bcopy job with bsr file to create a different volume:

bacula@backup:~$ /usr/sbin/bcopy -b BackupCatalog.bsr -i DISK035 -o COPYDISK /media/baculadisk1 /media/baculadisk3

which runs well.
bscan on COPYDISK runs now without an issue.

*restore
runs also without issues but I must modify the Storage from TempDisk to DiskStorage3 which is the name
of /media/baculadisk3.

So problem solved here to recover to the newest dump on backups.

Maybe other problems will follow.

After recreating the database with this backup I will try to update the database with all backups which was
run after the last backup of database included themself.

Long to short:
Maybe faster restore with bsr file was only possible by creating a copy to a different volume with
bcopy.

Cheers,




_______________________________________________
Bacula-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bacula-users

--
Arno Lehmann

IT-Service Lehmann
Sandstr. 6, 49080 Osnabrück



_______________________________________________
Bacula-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bacula-users

Reply via email to