Debianhelp.co.uk


Bacula Configuration in debian                                                                      Part2        Continue for Part4

All the required Configuration Files are located at /etc/bacula directory

Main configuration files are

bacula-dir.conf bacula-fd.conf bacula-sd.conf bconsole.conf


Client/File Daemon configuration (/etc/bacula-fd.conf)

#
# List Directors who are permitted to contact this File daemon
#
Director {
Name = backup1-dir
Password = "baculatest"
}
#
# "Global" File daemon configuration specifications
#
FileDaemon { # this is me
Name = client1-fd
FDport = 9102 # where we listen for the director
WorkingDirectory = /var/lib/bacula
Pid Directory = /var/run/bacula
Maximum Concurrent Jobs = 20
}

# Send all messages except skipped files back to Director
Messages {
Name = Standard
director = backup1-dir = all, !skipped
}

This client will only respond to a Director with the name backup1-dir and the password baculatest

If you want to know more about this configuration file check here

Storage Devices (/etc/bacula-sd.conf)

Bacula's concept of a storage device is it doesn't care if it is backing up to tape or disk. It's just a storage device

Storage { # definition of myself
Name = backup1-sd
SDPort = 9103 # Director's port
WorkingDirectory = "/var/lib/bacula"
Pid Directory = "/var/run/bacula"
Maximum Concurrent Jobs = 20
}

#
# List Directors who are permitted to contact Storage daemon
#
Director {
Name = backup1-dir
Password = "bacula-storage"
}
#
# Devices supported by this Storage daemon
# To connect, the Director's bacula-dir.conf must have the
# same Name and MediaType.
#

# A 'QUANTUM DLT VS160' tape drive
#
Device {
Name = DLT-VS160 #
Media Type = DLT
Archive Device = /dev/nst0
AutomaticMount = yes; # !! mount drive after job
Always Open = yes; # not unmount, via new bconsole script (if console unmount)
RemovableMedia = yes;
RandomAccess = no;
}

# Send all messages to the Director,
# mount messages also are sent to the email address
#
Messages {
Name = Standard
director = backup1-dir = all
}

As with the Client configuration file, the password must be supplied by the Director with the given name.

I am giving example of using DLT tape drive in storage device

If you want to know more configuration options for this file check here

Director Configuration (/etc/bacula-dir.conf)

The Director's configuration is by necessity the largest of the daemons, defining each Client, Job, FileSet, and Storage Device.

Director { # define myself
Name = backup1-dir
DIRport = 9101 # where we listen for UA connections
QueryFile = "/etc/bacula/scripts/query.sql"
WorkingDirectory = "/var/lib/bacula"
PidDirectory = "/var/run/bacula"
Maximum Concurrent Jobs = 1
SubSysDirectory = "/var/lock/subsys"
Password = "test-bacula" # Console password
Messages = Standard
}
Job {
Name = "NightlySave"
Type = Backup
Client = client1-fd
FileSet = "Full Set"
Schedule = "WeeklyCycle"
Storage = DLT
Messages = Standard
Pool = Default
Write Bootstrap = "/var/lib/bacula/NightlySave1.bsr"
Max Start Delay = 15h
Priority = 11
}
# Standard Restore template, to be changed by Console program
Job {
Name = "RestoreFiles"
Type = Restore
Client=backup1-fd
FileSet="Full Set"
Storage = DLT
Pool = Default
Messages = Standard
Where = /tmp/bacula-restores
}
# Standard Restore template, to be changed by Console program
Job {
Name = "RestoreFiles"
Type = Restore
Client=backup1-fd
FileSet="Full Set"
Storage = DLT
Pool = Default
Messages = Standard
Where = /tmp/bacula-restores
}
Exclude {
File = /proc
File = /tmp
File = /.journal
File = /.fsck
}
}
#----- SCHEDULE for client1 -----#

Schedule {
Name = "WeeklyCycle"
Run = Level=Full Pool=SundayPool Monday at 0:10am
Run = Level=Full Pool=MondayPool Tuesday at 0:10am
Run = Level=Full Pool=TuesdayPool Wednesday at 0:10am
Run = Level=Full Pool=WednesdayPool Wednesday at 0:10pm
Run = Level=Full Pool=ThursdayPool Friday at 0:10am
Run = Level=Full Pool=FridayPool Saturday at 0:10am
Run = Level=Full Pool=SaturdayPool Sunday at 0:10am
}
# Client (File Services) to backup
Client {
Name = client1-fd
Address = 10.36.69.7
FDPort = 9102
Catalog = MyCatalog
Password = "bacula" # password for FileDaemon
File Retention = 30 days # 30 days
Job Retention = 6 months # six months
AutoPrune = yes # Prune expired Jobs/Files
}
Storage {
Name = DLT
Address = 10.36.69.5 # N.B. Use a fully qualified name here
SDPort = 9103
Password = "bacula-storage" # password for Storage daemon
Device = DLT-VS160 # must be same as Device in Storage daemon
Media Type = DLT # must be same as MediaType in Storage daemon
}

# Generic catalog service
Catalog {
Name = MyCatalog
dbname = bacula; DB Address = localhost; user = bacula; password = ""
}

# Reasonable message delivery -- send most everything to email address
# and to the console
Messages {
Name = Standard
#
# NOTE! If you send to two email or more email addresses, you will need
# to replace the %r in the from field (-f part) with a single valid
# email address in both the mailcommand and the operatorcommand.
#
mailcommand = "/usr/lib/bacula/bsmtp -h localhost -f \"\(Bacula\) %r\" -s \"Bacula: %t %e of %c %l\" %r"
operatorcommand = "/usr/lib/bacula/bsmtp -h localhost -f \"\(Bacula\) %r\" -s \"Bacula: Intervention needed for %j\" %r"
mail = root@localhost = all, !skipped
operator = root@localhost = mount
console = all, !skipped, !saved
#
# WARNING! the following will create a file that you must cycle from
# time to time as it will grow indefinitely. However, it will
# also keep all your messages if they scroll off the console.
#
append = "/var/lib/bacula/log" = all, !skipped
}
# Message delivery for daemon messages (no job).
Messages {
Name = Daemon
mailcommand = "/usr/lib/bacula/bsmtp -h localhost -f \"\(Bacula\) %r\" -s \"Bacula daemon message\" %r"
mail = root@localhost = all, !skipped
console = all, !skipped, !saved
append = "/var/lib/bacula/log" = all, !skipped
}

#pool Definition

#----- SUNDAY -----#
Pool {
Name = SundayPool
Pool Type = Backup
#Recycle = yes
AutoPrune = yes
Recycle = yes
Accept Any Volume = yes
Maximum Volume Jobs = 11
VolumeRetention = 13d
Volume Use Duration = 13d
}

this is example of sunday pool you need to add all the days or months to take the backup of your data

If you want to know more options and details of each option check here

bconsole Configuration (/etc/bconsole.conf)

#
# Bacula User Agent (or Console) Configuration File
#

Director {
Name = backup1-dir
DIRport = 9101
address = backup1
Password = "bacula-test"
}

Testing Your Tape Drive

If you are not using a tape drive, you can skip this section.

Some tape drives are not standard. They work with their proprietary software and can be temperamental when used with other software. Each drive model can have its own little quirks that need to be catered for. Fortunately, Bacula comes with a handy little utility for testing your drive.

We used btape to test tape drive

#btape -c /etc/bacula/bacula-sd.conf /dev/nst0

*test

this will test your tape drive if there are any errors it will display here

If you want to know the more options available for btape command check here

Finding your tape drive

In most of debian machine if you are using SCSCI card with external tape drives like dell power edge 112T,114T you tape device is /dev/nst0 and in very rare case /dev/st0.Important point is you need to install two important packages for tape mtx and mt-st

You can find you tape device using mt command

#mt status

Checking Bacula Daemons Status

# ps auwx | grep bacula

root 6447 0.0 0.1 5376 1556 ? Ss Apr01 0:00 /usr/sbin/bacula-fd -c /etc/bacula/bacula-fd.conf
root 6448 0.0 0.1 5376 1556 ? S Apr01 0:00 /usr/sbin/bacula-fd -c /etc/bacula/bacula-fd.conf
root 6449 0.0 0.1 5376 1556 ? S Apr01 0:00 /usr/sbin/bacula-fd -c /etc/bacula/bacula-fd.conf
root 6924 0.0 0.2 5656 1900 ? Ss Apr01 0:00 /usr/sbin/bacula-sd -c /etc/bacula/bacula-sd.conf -u root -g bacula
root 6925 0.0 0.2 5656 1900 ? S Apr01 0:00 /usr/sbin/bacula-sd -c /etc/bacula/bacula-sd.conf -u root -g bacula
root 6927 0.0 0.2 5656 1900 ? S Apr01 0:00 /usr/sbin/bacula-sd -c /etc/bacula/bacula-sd.conf -u root -g bacula
root 7351 0.0 0.3 11020 2784 ? Ss Apr01 0:00 /usr/sbin/bacula-dir -c /etc/bacula/bacula-dir.conf -u root -g bacula
root 7352 0.0 0.3 11020 2784 ? S Apr01 0:00 /usr/sbin/bacula-dir -c /etc/bacula/bacula-dir.conf -u root -g bacula
root 7353 0.0 0.3 11020 2784 ? S Apr01 0:00 /usr/sbin/bacula-dir -c /etc/bacula/bacula-dir.conf -u root -g bacula
root 7354 0.0 0.3 11020 2784 ? S Apr01 0:00 /usr/sbin/bacula-dir -c /etc/bacula/bacula-dir.conf -u root -g bacula                                                                                        
Part2        Continue for Part4