A few weeks ago, I moved some Bacula Volumes from one Storage Daemon to another. In fact, I was decommissioning the old bacula-sd and creating a new one. I copied all the Volumes over. Backups have been running smoothly ever since.
However.
Today I tried a restore. It failed. Without any useful diagnostic information.
Here is what I have:
04-Aug 15:23 bacula-dir JobId 138030: Start Restore Job RestoreFiles.2013-08-04_15.23.08_20 04-Aug 15:23 bacula-dir JobId 138030: Error: Bacula bacula-dir 5.2.12 (12Sep12): Build OS: amd64-portbld-freebsd9.1 freebsd 9.1-RELEASE JobId: 138030 Job: RestoreFiles.2013-08-04_15.23.08_20 Restore Client: crey-fd Start time: 04-Aug-2013 15:23:11 End time: 04-Aug-2013 15:23:11 Files Expected: 1 Files Restored: 0 Bytes Restored: 0 Rate: 0.0 KB/s FD Errors: 0 FD termination status: SD termination status: Termination: *** Restore Error *** 04-Aug 15:23 bacula-dir JobId 138030: Error: Bacula bacula-dir 5.2.12 (12Sep12): Build OS: amd64-portbld-freebsd9.1 freebsd 9.1-RELEASE JobId: 138030 Job: RestoreFiles.2013-08-04_15.23.08_20 Restore Client: crey-fd Start time: 04-Aug-2013 15:23:11 End time: 04-Aug-2013 15:23:11 Files Expected: 1 Files Restored: 0 Bytes Restored: 0 Rate: 0.0 KB/s FD Errors: 1 FD termination status: SD termination status: Termination: *** Restore Error ***
After thinking for a while, I started to wonder if this was a database issue. This was quickly confirmed. Here is the query I ran:
bacula=# SELECT S.storageid, bacula-# S.name, bacula-# count(S.storageid) bacula-# FROM media M, bacula-# storage S bacula-# WHERE M.storageid = S.storageid bacula-# GROUP BY S.storageid, S.name bacula-# ORDER BY S.name; storageid | name | count -----------+---------------------+------- 25 | CreyFile | 57 3 | DLT | 1 8 | DigitalTapeLibrary | 221 9 | MegaFile | 2045 24 | OverlandTapeLibrary | 59 (5 rows) bacula=#
I can see the problem. It’s MegaFile. That is the old storage device. CreyFile is the new one. I need to run a database update, after first taking a backup.
[dan@slocum:~] $ pg_dump bacula > bacula.sql [dan@slocum:~] $ psql bacula psql (9.2.4) Type "help" for help. bacula=# begin; BEGIN bacula=# update media set storageid = 25 where storageid = 9; UPDATE 2045 bacula=# commit; COMMIT bacula=#
Now the restore works!