Backup with Bacula

Read
http://www.bacula.org/en/dev-manual/Brief_Tutorial.html#SECTION001280000000000000000
http://www.bacula.org/en/dev-manual/Bacula_Freque_Asked_Questi.html#AuthorizationErrors
http://www.bacula.org/en/dev-manual/Restore_Command.html#RestoreChapter
http://www.freebsddiary.org/bacula.php


Server install

Get bacula source from its web site. Compile with the following options:
./configure --with-openssl --with-mysql --enable-gnome
make -j2 && make install


Creating mysql database

cd /etc/bacula
sh grant_mysql_privileges
sh create_mysql_database
sh make_mysql_tables



Configurations

Director

Config files will be placed under /etc/bacula. First, edit bacula-dir.conf
# Under JobDefs and FIleSet is the place to edit what to backup by default
JobDefs {
  Name = "DefaultJob"
  Type = Backup
  Level = Incremental
  Client = ism-fd
  FileSet = "home opt"
  Schedule = "WeeklyCycle"
  Storage = File
  Messages = Standard
  Pool = Default
  Priority = 10
}

FileSet {
   Name = "home opt"
   Include {
		Options {
				signature = MD5
		}
		File = /home
		File = /opt
   }
   Exclude {
		File = /opt/downloads/bt
   }
}

# Under Job is where one would specify which machine to backup
Job {
  Name = "ism"
  JobDefs = "DefaultJob"
  Write Bootstrap = "/var/bacula/working/ism.bsr"
}

Job {
  Name = "homme"
  JobDefs = "DefaultJob"
  Client = homme-fd # fd to connect to
  FileSet = "home opt" # FileSet to backup
  Write Bootstrap = "/var/bacula/working/homme.bsr"
}

# Under Schedule is where one would specify when to backup
Schedule {
  Name = "WeeklyCycle"
  Run = Full 1st sun at 02:00
  Run = Differential 2nd-5th sun at 02:00
  Run = Incremental mon-sat at 02:00
}
Schedule {
  Name = "WeeklyCycleAfterBackup"
  Run = Full sun-sat at 03:00
}

# Under Client is where to specify client connectivity, retention period, etc.
Client {
  Name = ism-fd
  Address = ism
  FDPort = 9102
  Catalog = MyCatalog
  Password = "xxx"          # password for FileDaemon
  File Retention = 30 days            # 30 days
  Job Retention = 6 months            # six months
  AutoPrune = yes                     # Prune expired Jobs/Files
}

Client {
  Name = homme-fd
  Address = homme
  FDPort = 9102
  Catalog = MyCatalog
  Password = "some_secret"                 # password for FileDaemon
  File Retention = 30 days            # 30 days
  Job Retention = 6 months            # six months
  AutoPrune = yes                     # Prune expired Jobs/Files
}


StorageDaemon

Edit bacula-sd.conf to configure filedaemon
# Under Device is where to specify the storage device to use for backup
Device {
  Name = FileStorage
  Media Type = File
  Archive Device = /mnt/san/backup
  ...
}


Starting bacula

/etc/bacula/bacula start


Using bacula console

bconsole


Show jobs schedule and history

*status director


Run backup jobs

*run


Restore files

*restore all
# Use option 1 to list recent jobs, or 5 to list jobs for a certain client. 
# Once that's done, you will be in the file selection prompt


File selection
# Use mark / unmarkdir to select file / deselect directories to restore. Use done to end file selection.


Start restore
Review settings listed after finishing file selection. If you need to restore to a different client / destination, use the mod option.
Using Catalog "MyCatalog"
Run Restore job
JobName:         RestoreFiles
Bootstrap:       /var/bacula/working/ism-dir.restore.1.bsr
Where:           /bacula-restores
Replace:         always
FileSet:         Full Set
Backup Client:   homme-fd
Restore Client:  homme-fd
Storage:         File
When:            2008-06-02 22:42:14
Catalog:         MyCatalog
Priority:        10
OK to run? (yes/mod/no): 


Use messages command to list restore status
....
02-Jun 22:44 ism-dir JobId 10: Bacula ism-dir 2.2.8 (26Jan08): 02-Jun-2008 22:44:09
  Build OS:               x86_64-unknown-linux-gnu redhat 
  JobId:                  10
  Job:                    RestoreFiles.2008-06-02_22.44.09
  Restore Client:         homme-fd
  Start time:             02-Jun-2008 22:44:09
  End time:               02-Jun-2008 22:44:09
  Files Expected:         2
  Files Restored:         2
  Bytes Restored:         3,781
  Rate:                   0.0 KB/s
  FD Errors:              0
  FD termination status:  OK
  SD termination status:  OK
  Termination:            Restore OK
...


Listing files in a backup job

list files jobid=8


Clearing backup jobs and start from zero

cd /etc/bacula
sh drop_bacula_tables
sh make_bacula_tables




Client install

Get bacula source from its website. Compile with the following options:
./configure --enable-client-only
make
make install


Then configure /etc/bacula/bacula-fd.conf to set up authentication with bacula server. Use the same password as the one set up in Client {} in bacula-dir.conf on server.
Director {
   Name = ism-dir
   Password = "some_secret"
}


Add job on server and issue a "reload"
bconsole
*reload


Start up bacula on client machine
/etc/bacula/bacula start

There are no comments on this page. [Add comment]

Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by WikkaWiki