Pages

Thursday, November 5, 2020

bacula: cannot restore without a bootstrap file

After a long time I decided to install and work with bacula again. After installation, configuration and running some jobs, I tried to restore a backup from the night. The result was the following:

...
05-Nov 07:56 bacula-dir JobId 11: Fatal error: Cannot restore without a bootstrap file.
You probably ran a restore job directly. All restore jobs must be run using the restore command.
...

This issue is basically very easy to fix, just add the "Write Bootstrap" option to each job configuration. What I did in detail:

1. Add a dedicated directory for saving your bootstraps:

# mkdir /local/bacula_bootstrap
# chown bacula:bacula /local/bacula_bootstrap


2. Configure your jobs and add the "Write Bootstrap" option to each job, e.g.:

# vi /etc/bacula/common/jobs.conf
...
Job {
  ...
  Write Bootstrap = "/local/bacula_bootstrap/%c.%n.bsr"
  ...
}
...


3. Rerun your backups (full) to write the bootstraps per job.

4. Optional: reconfigure your restore job and add the bootstrap file for the job you want to restore (in this example I want to restore the /etc directory from my second NAS):

# vi /etc/bacula/common/jobs.conf
...
Job {
  Name = "RestoreFiles"
  Type = Restore
  Bootstrap = /local/bacula_bootstrap/nas02-fd.nas02_etc.bsr
  ...
}
...
 

(A detailed information about adding the bootstrap option to the restore job can be found at the end of this article)

5. Rerun your restore job:

*run
A job name must be specified.
...
     5: RestoreFiles
...
Run Restore job
JobName:         RestoreFiles
Bootstrap:       /local/bacula_bootstrap/nas02-fd.nas02_etc.bsr
Where:           /local/bacula_restore
...
OK to run? (yes/mod/no): yes
Job queued. JobId=15
*
You have messages.
*mess
...
  Job:                    RestoreFiles.2020-11-05_08.07.02_27
  Restore Client:         nas02-fd
  Where:                  /local/bacula_restore
  ...
  Termination:            Restore OK
...


After that, all my etc files from my second NAS were restored and accessible under /local/bacula_restore. With the given Bootstrap option in the restore job configuration, the latest job id for the backup job will be choosen automatically. And at this point I want you to give a warning, assuming following situation:

  1. Backup job for /etc configured, job id 1 till 10 ran successfully, but without a bootstrap
  2. Bootstrap option added to the backup job
  3. Backup job for /etc 11 till 15 ran successfully, now with a bootstrap
  4. Restore jobs will only work for job id 11 till 15, because they have a bootstrap. Restore jobs for job id 1 till 10 will fail, because they don't have a bootstrap!

Unfortunately, I don't know how to restore a job without a bootstrap!

This error is a very good example why you shouldn't trust your backup blindly, always test a restore, even though you don't need one.

No comments:

Post a Comment