Restore

General

We need to JobId:

root@bareos:~# echo "list jobs" | bconsole | grep myjob
| 10,061 | myjob | filer04-fd | 2020-10-27 02:25:19 | B | F | 4,816 | 3,589,675,025,251 | W |

Then, in bconsole:

*restore

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): 3
Enter JobId(s), comma separated, to restore: 10061
You have selected the following JobId: 10061

Building directory tree for JobId(s) 10061 ...  +++++++++++++++++++++++++++++++++++++++++++
4,261 files inserted into the tree.

Then:

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: /
$ cd mnt/ 
cwd is: /mnt/
$ cd filer07/ 
cwd is: /mnt/filer07/
$ cd raid_p/
cwd is: /mnt/filer07/raid_p/
$ ls
myjob/
$ mark myjob
4,816 files marked.
$ exit
Bootstrap records written to /var/lib/bareos/bareos-dir.restore.2.bsr

The job will require the following
   Volume(s)                 Storage(s)                SD Device(s)
===========================================================================
   
   *000400L4                  filer04-Scalar_i40_Autochanger Scalar_i40_Autochanger   
   *000361L4                  filer04-Scalar_i40_Autochanger Scalar_i40_Autochanger   
   *000362L4                  filer04-Scalar_i40_Autochanger Scalar_i40_Autochanger   
   *000363L4                  filer04-Scalar_i40_Autochanger Scalar_i40_Autochanger   
   *000364L4                  filer04-Scalar_i40_Autochanger Scalar_i40_Autochanger   

Volumes marked with "*" are online.


4,816 files selected to be restored.

Now we choose where the file will be restored by choosing one of the “Clients”:

Defined Clients:
     1: back01-fd
     2: backup01-fd
     3: bareos-fd
     4: buddha-fd
     5: filer01-fd
     6: filer02-fd
     7: filer03-fd
     8: filer04-fd
     9: filer06-fd
    10: fileserver02-fd
    11: mg01-fd
Select the Client (1-13): 8
Using Catalog "MyCatalog"

Then we modify the automatic restore job to modify the paths:

Run Restore job
JobName:         RestoreFiles
Bootstrap:       /var/lib/bareos/bareos-dir.restore.2.bsr
Where:           /srv/areca_raid/restored
Replace:         Always
FileSet:         Nothing
Backup Client:   filer04-fd
Restore Client:  filer04-fd
Format:          Native
Storage:         filer04-Scalar_i40_Autochanger
When:            2020-12-07 20:17:47
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: Backup Format
     7: When
     8: Priority
     9: Bootstrap
    10: Where
    11: File Relocation
    12: Replace
    13: JobId
    14: Plugin Options
Select parameter to modify (1-14): 11
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): 1
Please enter the path prefix to strip: /mnt/filer07/raid_p
strip_prefix=/mnt/filer07/raid_p 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): 2
Please enter the path prefix to add (/ for none): /srv/areca_raid/restored
strip_prefix=/mnt/filer07/raid_p add_prefix=/srv/areca_raid/restored 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

Then we accept to run the job:

Run Restore job
JobName:         RestoreFiles
Bootstrap:       /var/lib/bareos/bareos-dir.restore.2.bsr
RegexWhere:      !/mnt/filer07/raid_p!!i,!^!/srv/areca_raid/restored!
Replace:         Always
FileSet:         Nothing
Backup Client:   filer04-fd
Restore Client:  filer04-fd
Format:          Native
Storage:         filer04-Scalar_i40_Autochanger
When:            2020-12-07 20:17:47
Catalog:         MyCatalog
Priority:        10
Plugin Options:  *None*
OK to run? (yes/mod/no): yes
Job queued. JobId=10280

Others

One liner

restore jobid=64 client=san-fd regexwhere=!/SAN300/projects!!i,!^!/tank/restore!