Bacula restore using a regex

Short version: I used this regex when restoring to a jail on the slocum server: !/\.zfs/snapshot/snapshot-for-backup/!/!

Background

Today I did this when setting up an ssh-key on a new host:

ssh-add -L > ~/.ssh/authorized_keys

Oh.

That should have been >>.

Restoring

During the Bacula restore, I need to change this path:

/usr/jails/mydev/.zfs/snapshot/snapshot-for-backup/usr/home/dan/.ssh/

to

/usr/jails/mydev/usr/home/dan/.ssh/

That is, I need to remove this from the path:

.zfs/snapshot/snapshot-for-backup

For background on this backup strategy using jails, ZFS snapshots, & Bacula, see this post about the script. As you will see, the described script has been modified and I’m doing things slightly differently. Why? See

Here is how you do that:

Run Restore job
JobName:         RestoreFiles
Bootstrap:       /usr/local/bacula/working/bacula-dir.restore.27.bsr
Where:           
Replace:         always
FileSet:         Full Set
Backup Client:   slocum-fd
Restore Client:  slocum-fd
Storage:         CreyFile
When:            2014-10-16 20:04:45
Catalog:         MyCatalog
Priority:        10
Plugin Options:  *None*
OK to run? (yes/mod/no): mod
Parameters to modify:
     1: Level
     2: Storage
     3: Job
     4: FileSet
     5: Restore Client
     6: When
     7: Priority
     8: Bootstrap
     9: Where
    10: File Relocation
    11: Replace
    12: JobId
    13: Plugin Options
Select parameter to modify (1-13): 10
strip_prefix=*None* add_prefix=*None* add_suffix=*None*
This will replace your current Where value
     1: Strip prefix
     2: Add prefix
     3: Add file suffix
     4: Enter a regexp
     5: Test filename manipulation
     6: Use this ?
Select parameter to modify (1-6): 4
Please enter a valid regexp (!from!to!): !/\.zfs/snapshot/snapshot-for-backup/!/!
strip_prefix=*None* add_prefix=*None* add_suffix=*None*
This will replace your current Where value
     1: Strip prefix
     2: Add prefix
     3: Add file suffix
     4: Enter a regexp
     5: Test filename manipulation
     6: Use this ?
Select parameter to modify (1-6): 5
regexwhere=!/\.zfs/snapshot/snapshot-for-backup/!/!
Enter a period (.) to stop this test
Please enter filename to test: /usr/local/jails/mydev/.zfs/snapshot/snapshot-for-backup/usr/home/dan/.ssh/
/usr/local/jails/mydev/.zfs/snapshot/snapshot-for-backup/usr/home/dan/.ssh/ -> /usr/local/jails/mydev/usr/home/dan/.ssh/
Please enter filename to test: .
strip_prefix=*None* add_prefix=*None* add_suffix=*None*
This will replace your current Where value
     1: Strip prefix
     2: Add prefix
     3: Add file suffix
     4: Enter a regexp
     5: Test filename manipulation
     6: Use this ?
Select parameter to modify (1-6): 6

Remember….

That worked. Got my auth’d keys back. Of course, this is also in Ansible…

Website Pin Facebook Twitter Myspace Friendfeed Technorati del.icio.us Digg Google StumbleUpon Premium Responsive

Leave a Comment

Scroll to Top