Bacula Backup

From Bitbull Wiki
Revision as of 08:31, 24 March 2010 by Chris (talk | contribs) (→‎some Mysql Queries)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

1 intro

Start Bacula Console as root: bconsole
all comands show below are functions and options of the bacula console

2 show backup jobs of specific machine

*status client=lompetier-fd

3 restore a single file

*restore client=lompetier-fd current file=/etc/yum.conf where=/ 
*restore client=lompetier-fd before="2009-03-25 12:00:00" file=/etc/yum.conf where=/ 

4 restore multiple files (interactive)

*restore client=lompetier-fd where=/ before="2009-03-25 12:00:00" select
$ help
$ find *yum*
$ cd etc
$ ls yum*
$ mark yum.repos.d
$ cd ..
$ cd usr
$ cd local
$ mark machine
$ lsmark
$ estimate
$ done

5 restore file(s) from a specific date

in this case, replace the current option with before="YYYY-MM-DD HH:MM:SS"
e.g.:

*restore client=lompetier-fd where=/ before="2009-03-25 12:00:00" file=/etc/hosts 
*restore client=lompetier-fd where=/ before="2009-03-25 12:00:00" select 

6 change restore location

if you want to search for differences or need logs from the past, it's nice to not overwrite the existing files.
select the option where to specify the new root. if it don't exist, bacula will create it.
e.g.:

*restore client=lompetier-fd where=/restore current file=/etc/resolv.conf
*restore client=lompetier-fd where=/restore before="2009-03-25 12:00:00" select

7 a simple restore test

*restore client=prddta001-fd where=/restore before="2009-03-20 12:00:00" file=/var/log/messages

8 CAUTION

the options before and file/current have to be given in this order.
that means: first give date, then select files to restore
RIGHT: *restore client=prddta001-fd where=/restore before="2009-03-20 12:00:00" file=/var/log/messages
WRONG: *restore client=prddta001-fd where=/restore file=/var/log/messages before="2009-03-20 12:00:00"
note: this also happens in interactive mode of bacula restore

9 example restore

#> bconsole
*restore client=prdhost-fd where=/home/restore before="2010-02-02 23:59:00" select
*cd usr/local/bin
*ls
*mark checkme.sh
*done

10 some links

german reference of the bacula console
http://bacula.org/manuals/de/console/console/Bacula_Console.html

english reference of restore function
http://bacula.org/en/dev-manual/Restore_Command.html

11 some Mysql Queries

status report

mysql> select JobId, Name, Type, Level, JobStatus, StartTime, RealEndTime, JobFiles, JobBytes, JobErrors, JobMissingFiles from Job where SchedTime >= SUBDATE(NOW(),INTERVAL 1 DAY) AND Type = 'B' order by StartTime;
mysql> select JobId AS ID, Name, Level, JobStatus AS Status, DATE_FORMAT(StartTime,'%a %H:%i') AS Start, DATE_FORMAT(RealEndTime,'%H:%i') AS End, JobFiles AS Files, ROUND((JobBytes / 1024 / 1024 ),1) AS MByte FROM Job WHERE SchedTime >= SUBDATE(NOW(),INTERVAL 1 DAY) AND Type = 'B' order by Name;