Restaurar desde Bacula

Para hacer la prueba he borrado un fichero en mickey

debian@mickey:~$ ls
ficheros index.html mbox script.py telegraf_1.4.4-1_amd64.deb
debian@mickey:~$ sudo su
root@mickey:/home/debian# rm telegraf_1.4.4-1_amd64.deb

Los pasos a seguir son:

  • Conectarnos a la consola y ejecutar el comando restore
  • He elegido la opción 5 (Select the most recent backup for a client) por rapidez para el ejemplo.
root@jarvis:/home/backups# bconsole 
Connecting to Director 10.0.0.11:9101
1000 OK: 102 jarvis-dir Version: 7.4.4 (20 September 2016)
Enter a period to cancel a command.
*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): 5
Defined Clients:
 1: donald-fd
 2: jarvis-fd
 3: mickey-fd
 4: minnie-fd
Select the Client (1-4): 3
The defined FileSet resources are:
 1: FileHomes
 2: Full File Set
Select FileSet resource (1-2): 2
+-------+-------+----------+-------------+---------------------+-------------+
| JobId | Level | JobFiles | JobBytes | StartTime | VolumeName |
+-------+-------+----------+-------------+---------------------+-------------+
| 70 | F | 3,759 | 252,182,167 | 2018-01-10 09:32:41 | backupFiles |
+-------+-------+----------+-------------+---------------------+-------------+
You have selected the following JobId: 70

Building directory tree for JobId(s) 70 ... ++++++++++++++++++++++++++++++++++++++++++++++
3,539 files inserted into the tree
  • Cuando accede a la copia, se busca el fichero y se marca (mark)
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
etc/
home/
var/
$ cd /home/mickey
Invalid path given.
cwd is: /
$ cd /home/debian
cwd is: /home/debian/
$ ls
.bash_history
.bash_logout
.bashrc
.mysql_history
.nano
.profile
.ssh/
ficheros/
index.html
mbox
script.py
telegraf_1.4.4-1_amd64.deb
$ mark telegraf_1.4.4-1_amd64.deb 
1 file marked.
  • Con todos los ficheros que queremos marcados, ejecutamos done.
  • Selecionamos el trabajo relacionado con el host (RestoreMickey)
$ done
Bootstrap records written to /var/lib/bacula/jarvis-dir.restore.8.bsr
Bootstrap records written to /var/lib/bacula/jarvis-dir.restore.8.bsr

The Job will require the following (*=>InChanger):
 Volume(s) Storage(s) SD Device(s)
===========================================================================
 
 backupFiles File FileStrg

Volumes marked with "*" are in the Autochanger.




1 file selected to be restored.

The defined Restore Job resources are:
 1: RestoreMickey
 2: RestoreMinnie
 3: RestoreDonald
Select Restore Job (1-3): 1
Run Restore job
JobName: RestoreMickey
Bootstrap: /var/lib/bacula/jarvis-dir.restore.8.bsr
Where: *None*
Replace: Always
FileSet: Full File Set
Backup Client: mickey-fd
Restore Client: mickey-fd
Storage: File
When: 2018-01-10 09:36:32
Catalog: MyCatalog
Priority: 10
Plugin Options: 
OK to run? (yes/mod/no): yes
Job queued. JobId=73
  • Para ver que ha acabado la restauración, buscamos en los trabajos terminados el que corresponda con el Id que nos dio antes (73)
    *status
    Status available for:
     1: Director
     2: Storage
     3: Client
     4: Scheduled
     5: All
    Select daemon type for status (1-5): 1
    jarvis-dir Version: 7.4.4 (20 September 2016) x86_64-pc-linux-gnu debian 9.0
    Daemon started 10-Jan-18 09:01, conf reloaded 10-Jan-2018 09:01:45
     Jobs: run=15, running=0 mode=0
     Heap: heap=180,224 smbytes=125,074 max_bytes=1,740,135 bufs=316 max_bufs=420
    
    Scheduled Jobs:
    Level Type Pri Scheduled Job Name Volume
    ===================================================================================
    Incremental Backup 10 11-Jan-18 05:30 mickey backupFiles
    Incremental Backup 10 11-Jan-18 05:30 minnie backupFiles
    Incremental Backup 10 11-Jan-18 05:30 donald backupFiles
    ====
    
    Running Jobs:
    Console connected at 10-Jan-18 09:33
    No Jobs running.
    ====
    
    Terminated Jobs:
     JobId Level Files Bytes Status Finished Name 
    ====================================================================
     64 Restore 0 0 Error 10-Jan-18 09:15 RestoreDonald
     65 Restore 0 0 Cancel 10-Jan-18 09:23 RestoreDonald
     66 Restore 0 0 Cancel 10-Jan-18 09:24 RestoreDonald
     69 Full 0 0 Error 10-Jan-18 09:32 minnie
     68 Full 0 0 Error 10-Jan-18 09:32 mickey
     67 Restore 0 0 Error 10-Jan-18 09:32 RestoreDonald
     70 Full 3,759 252.1 M OK 10-Jan-18 09:33 mickey
     71 Full 4,188 180.9 M OK 10-Jan-18 09:34 donald
     73 Restore 1 8.770 M OK 10-Jan-18 09:36 RestoreMickey
    ====

     

  • En el equipo en el que hemos borrado el fichero, comprobamos que vuelve a estar.
root@mickey:/home/debian# ls
ficheros index.html mbox script.py telegraf_1.4.4-1_amd64.deb

 

Deja un comentario

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *