How to restore a single file in Bacula

I wanted to restore a single file from Bacula. I’m writing this tutorial partically to remind myself how to do this but perhaps it will help someone in the future.

You will need to do this from bconsole on your Bacula server.

1 – You need to find the filename of the file. For example: myfile.xml

2 – You then need to find the last time that this file was backed up. You can do this using the restore command:

restore
select option 2 - list jobs of command seperated JobIDs to select
select the client - 1 
Enter file name (no path): myfile.xml

This produces a list of JobId’s and the complete path to possible files.

+———+———–+———-+———–+
| JobId | Name | StartTime | JobType | JobStatus | JobFiles | JobBytes |
+———+———–+———-+———–+
| 8862 | /mnt/pd/Documentation/X015/myfile.xlm | 2014-05-14 20:39:00 | B | T | 10 | 3837733 |
| 8844 | /mnt/pd/Documentation/X015/myfile.xlm | 2014-05-13 20:42:16 | B | T | 7 | 88229 |
+———+———–+———-+———–+

3 – If the file appears then you can to restore from one of the selective JobId like so:

restore
select 3 -Enter list of comma seperated JobIds to select
select the files you require by browsing around - cd / ls / add filename then done

You might need to modify the ‘where’ part of the generated job like so:

mod
select 9
enter the full path to a restore path

Then the files or directories you have selected should be restored.

One thought to “How to restore a single file in Bacula”

  1. This is fine, but it doesn’t work. If you do the above, it says ok, and “the job is queued”. It never runs.

Leave a Reply