Restoring Backup From Bacula
There's a webacula for this job. But we need to understand what happen behind the scene. Restoring backup requires writing a bootstrap file (bsr), ie: config file to specify what and from which snapshot restoration should be made. Below an example on how to restore a backup from Bacula using bconsole:
toni@tachikoma:/tmp$ sudo bconsole
Connecting to Director localhost:9101
1000 OK: tachikoma-dir Version: 5.0.3 (04 August 2010)
Enter a period to cancel a command.
*restore
Automatically selected Catalog: MyCatalog
Using Catalog "MyCatalog"
First you select one or more JobIds that contain files
to be restored. You will be presented several methods
of specifying the JobIds. Then you will be allowed to
select which files from those JobIds are to be restored.
To select the JobIds, you have the following choices:
1: List last 20 Jobs run
2: List Jobs where a given File is saved
3: Enter list of comma separated JobIds to select
4: Enter SQL list command
5: Select the most recent backup for a client
6: Select backup for a client before a specified time
7: Enter a list of files to restore
8: Enter a list of files to restore before a specified time
9: Find the JobIds of the most recent backup for a client
10: Find the JobIds for a backup for a client before a specified time
11: Enter a list of directories to restore for found JobIds
12: Select full restore to a specified Job date
13: Cancel
Select item: (1-13): 9
Automatically selected Client: tachikoma-fd
Automatically selected FileSet: Full Set
+-------+-------+----------+------------+---------------------+------------+
| JobId | Level | JobFiles | JobBytes | StartTime | VolumeName |
+-------+-------+----------+------------+---------------------+------------+
| 4 | F | 27,301 | 87,803,606 | 2011-12-01 20:15:11 | Pamela |
| 6 | I | 2 | 0 | 2011-12-01 20:39:05 | Pamela |
+-------+-------+----------+------------+---------------------+------------+
To select the JobIds, you have the following choices:
1: List last 20 Jobs run
2: List Jobs where a given File is saved
3: Enter list of comma separated JobIds to select
4: Enter SQL list command
5: Select the most recent backup for a client
6: Select backup for a client before a specified time
7: Enter a list of files to restore
8: Enter a list of files to restore before a specified time
9: Find the JobIds of the most recent backup for a client
10: Find the JobIds for a backup for a client before a specified time
11: Enter a list of directories to restore for found JobIds
12: Select full restore to a specified Job date
13: Cancel
Select item: (1-13): 12
Enter JobId to get the state to restore: 6
Selecting jobs to build the Full state at 2011-12-01 20:39:05
You have selected the following JobIds: 4,5,6
Building directory tree for JobId(s) 4,5,6 ... +++++++++++++++++++++++++++++++++++++
20,643 files inserted into the tree.
You are now entering file selection mode where you add (mark) and
remove (unmark) files to be restored. No files are initially added, unless
you used the "all" keyword on the command line.
Enter "done" to leave this mode.
cwd is: /
$ ls
home/The context for ls is the backup archive. Bacula does a full path backup. That's why we see "/home" there because my backup was made from files under my home dir.
$ mark home all
27,302 files marked.
$ estimate
27302 total files; 27302 marked to be restored; 170,119,725 bytes.
$ done
Bootstrap records written to /var/lib/bacula/tachikoma-dir.restore.2.bsr
The job will require the following
Volume(s) Storage(s) SD Device(s)
===========================================================================
Pamela File FileStorage
Volumes marked with "*" are online.
27,302 files selected to be restored.
Run Restore job
JobName: RestoreFiles
Bootstrap: /var/lib/bacula/tachikoma-dir.restore.2.bsr
Where: /tmp/bacula-restores
Replace: always
FileSet: Full Set
Backup Client: tachikoma-fd
Restore Client: tachikoma-fd
Storage: File
When: 2011-12-01 22:18:22
Catalog: MyCatalog
Priority: 10
Plugin Options: *None*
OK to run? (yes/mod/no): yes
Job queued. JobId=11
You have messages.
*That's it. Your files are restored to restore dir. In my case I wrote "/tmp/bacula-restores" in restore job config (bacula-dir.conf)