sys.backup - Vraćanje podataka

Za vraćanje pojedinačnih datoteka iz backupa koristi se program bconsole. Za vraćanje klijenta "od nule" vidjeti posebne upute.

Prvo je potrebno pokrenuti klijent bconsole (Bacula Console). Ukoliko se klijent uspješno spoji na backup servis pojavit će se sljedeće:

# bconsole
Connecting to Director sysbackup.carnet.hr:9101
1000 OK: sysbackup-dir Version: 5.0.3 (30 August 2010)
Enter a period to cancel a command.
*

Za vraćanje podataka koristi se naredba restore. Za vraćanje dijela datoteka treba odabrati treba odabrati opciju 5 ili 6, ovisno vraćaju li se podaci iz posljednjeg ili nekog starijeg backupa.

*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):

Ako je potrebno zatim se odabire klijent i skup datoteka (FileSet):

Select item:  (1-13): *5
Automatically selected Client: posluzitelj.domena.hr-fd
Automatically selected FileSet: Debian Full Set 3
+-------+-------+----------+-------------+---------------------+---------------------------------+
| jobid | level | jobfiles | jobbytes | starttime | volumename |
+-------+-------+----------+-------------+---------------------+---------------------------------+
| 134 | F | 49,064 | 450,171,028 | 2011-03-18 09:16:39 | posluzitelj.domena.hr_0256 |
| 141 | I | 7,123 | 254,568 | 2011-03-18 23:05:00 | posluzitelj.domena.hr_0256 |
+-------+-------+----------+-------------+---------------------+---------------------------------+
You have selected the following JobIds: 134,141

Building directory tree for JobId(s) 134,141 ... ++++++++++++++++++++++++++++++++++++++
37,447 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: /

Nakon toga potrebno je odabrati datoteke koje će se vratiti iz backupa. Za pregledavanje backupa koriste se naredbe cd i dir, te mark i unmark za odabir datoteka koje će se vratiti. Odabir datoteka završava se unosom naredbe done. U dolje navedenom primjeru smo selektirali jednu datoteku (dump mysql baze) koja se nalazi u /var/backups/bacula-cn, te kompletan sadžaj /etc/ssh direktorija.

$ *cd /var/backups/bacula-cn
cwd is: /var/backups/bacula-cn/
$ *mark mysql.dump.gz
1 file marked.
$ *cd /etc
cwd is: /etc/
$ *mark ssh
9 files marked.
$ *done

Nakon toga još treba potvrditi vraćanje podataka:

Bootstrap records written to /var/lib/bacula/sysbackup-dir.restore.1.bsr

The job will require the following
Volume(s) Storage(s) SD Device(s)
===========================================================================

posluzitelj.domena.hr_0256 posluzitelj.domena.hr-stor file_posluzitelj.domena.hr

Volumes marked with "*" are online.


11 files selected to be restored.

Run Restore job
JobName: RestoreFiles
Bootstrap: /var/lib/bacula/sysbackup-dir.restore.1.bsr
Where: /nonexistant/path/to/file/archive/dir/bacula-restores
Replace: always
FileSet: Debian Full Set 3
Backup Client: posluzitelj.domena.hr-fd
Restore Client: posluzitelj.domena.hr-fd
Storage: posluzitelj.domena.hr-stor
When: 2011-03-19 11:47:12
Catalog: MyCatalog
Priority: 10
Plugin Options: *None*
OK to run? (yes/mod/no): *

Treba provjeriti da li su svi podaci ispravni i tek tada potvrditi sa yes. Ukoliko nešto treba mijenjati, koristiti mod. Obično je potrebno podesiti direktorij u koji će se podaci vratiti. Odabir / će vratiti stvari na originalno mjesto, no preporučamo koristiti neki novi privremeni direktorij (npr. /home/korisnik/restore) da vraćeni podaci nebi prepisali postojeće. Bitno je napomenuti da se vraćanjem podataka ne brišu podaci u odredišnom direktoriju, te se vraća cijela struktura direktorija (npr. vraćanjem datoteke /home/korisnik/datoteka.txt sa odredištem /home/korisnik/restore dobit će se datoteka /home/korisnik/restore/home/korisnik/datoteka.txt).

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): 9
Please enter path prefix for restore (/ for none): */home/korisnik/restore
Run Restore job
JobName: RestoreFiles
Bootstrap: /var/lib/bacula/sysbackup-dir.restore.1.bsr
Where: /home/korisnik/restore
Replace: always
FileSet: Debian Full Set 3
Backup Client: posluzitelj.domena.hr-fd
Restore Client: posluzitelj.domena.hr-fd
Storage: posluzitelj.domena.hr-stor
When: 2011-03-19 11:47:12
Catalog: MyCatalog
Priority: 10
Plugin Options: *None*
OK to run? (yes/mod/no): *yes
Job queued. JobId=148
*

Nakon pokrenutog vraćanja podataka, napredak se može pratiti naredbama status dir i status client=posluzitelj.domena.hr-fd.

*status dir
sysbackup-dir Version: 5.0.3 (30 August 2010) x86_64-pc-linux-gnu debian 6.0
Daemon started 18-Mar-11 14:04, 9 Jobs run since started.
Heap: heap=19,419,136 smbytes=333,359 max_bytes=7,965,403 bufs=950 max_bufs=1,138

Scheduled Jobs:
Level Type Pri Scheduled Name Volume
===================================================================================
Incremental Backup 10 19-Mar-11 23:05 posluzitelj.domena.hr posluzitelj.domena.hr_0256
====

Running Jobs:
Console connected at 18-Mar-11 14:04
Console connected at 19-Mar-11 11:39
No Jobs running.
====

Terminated Jobs:
JobId Level Files Bytes Status Finished Name
====================================================================
139 1 106.8 K OK 18-Mar-11 12:18 RestoreFiles
141 Incr 7,123 254.5 K OK 18-Mar-11 23:05 posluzitelj.domena.hr
148 11 241.3 K OK 19-Mar-11 11:58 RestoreFiles

====
*status client=posluzitelj.domena.hr-fd
Connecting to Client posluzitelj.domena.hr-fd at 161.53.178.18:9102

posluzitelj.domena.hr-fd Version: 5.0.2 (28 April 2010) x86_64-pc-linux-gnu debian 5.0.5
Daemon started 18-Mar-11 08:32, 4 Jobs run since started.
Heap: heap=2,273,280 smbytes=12,700 max_bytes=9,398,640 bufs=68 max_bufs=459
Sizeof: boffset_t=8 size_t=8 debug=0 trace=0

Running Jobs:
Director connected at: 19-Mar-11 12:06
No Jobs running.
====

Terminated Jobs:
JobId Level Files Bytes Status Finished Name
======================================================================
134 Full 49,064 450.1 M OK 18-Mar-11 09:27 posluzitelj.domena.hr
139 1 106.8 K OK 18-Mar-11 12:18 RestoreFiles
141 Incr 7,123 254.5 K OK 18-Mar-11 23:05 posluzitelj.domena.hr
148 11 241.3 K OK 19-Mar-11 11:58 RestoreFiles
====