The backup system I wrote at work has one major shortcoming. It can't write multiple volumes. Instead of extending it so it supports that, I've decided to install Bacula on the fileserver and let that handle the tape backups.
This blog post is a report of how I installed and configured
Bacula on the server.
(I'm going to add to this post as I go, because I'll probably not be able to do this all in one day.)
It'll also be a small recap of the Bacula documentation as I go over it. Mostly for future reference in case I need to repeat this installation.
Installing
Well what can I say, it's Gentoo, so it was basicly just 'emerge bacula'.
I did however add this line to /etc/portage/package.use:
app-backup/bacula bacula-console sqlite3 readline
To have the (for my installation) correct options installed.
Configuring
Before actually configuring, knowing what to configure could help.
Reading up on the
Quickstart documentation helped a lot here.
Bacula uses its own terminology:
- FileSet: What files to backup
- Client: Who to backup. This is the servers where the files are.
- Schedule: When to backup
- Pool: where does the backup go?
- Volume: the actual tape. A collection of tapes is a pool.
In Gentoo, the Bacula configuration files go in: /etc/bacula/
First thing that needed to be done was to edit the
bconsole.conf file.
There isn't really a lot there, the default seemed good.
Director {
Name = fileserver-dir
DIRport = 9101
address = fileserver
Password = "thepassword" # not really :)
}Only thing I needed to change was the password. (The default is set to something crazy for security).
Next, edit the
bacula-sd.conf file.
I have a Dell TL2000 so I needed to make an 'Autochanger' and a 'Device'.
Autochanger {
Name = Autochanger
Device = LTO-3
Changer Command = "/usr/libexec/bacula/mtx-changer %c %o %S %a %d"
Changer Device = /dev/sg5
}
Device {
Name = LTO-3
Media Type = LTO-3
Archive Device = /dev/st0
Changer Command = "/usr/libexec/bacula/mtx-changer %c %o %S %a %d"
Changer Device = /dev/sg5
}
With this configuration I ran the 'btape' tool and issued the 'test' command.
All tests successful.. yay!
Now, in the Director configuration file:
bacula-dir.conf I had to make jobs/clients/etc...
There's a pretty nice default example in there, so it was just basicly editing of the examples to get it to work.
Some things you need to pay attention to:
- making sure all the passwords are correct helps lots ;-)
- Choose the correct storage, configure it in the bacula-sd.conf
- restart the appropriate daemon when you've changed it's configuration file.
Labeling the tapesThe tapes I use in the TL-2000 library all have barcode stickers on them. It would be very convenient if I could use those names in bacula aswell. Fortunately, there are console commands for this:
label barcode
update slots
cleaning prefix
If afterwards tapes (volumes) need to be put in a different pool, use
update volume to change the pool of the volume.
Creating the filesetsFilesets on my server are quite simple:
FileSet {
Name = "datadir"
Include {
Options {
signature = MD5
}
File = /data
}
}
For every folder you wish to backup.
SchedulesThese define when a backup needs to run.
One of my schedules looks like this:
Schedule {
Name = "daily_4"
Run = Level=Full mon-fri at 4:00
}
Should be self-explanatory.
JobsThese are the most important ones. They define what is backed up, how and when.
The one for the weekly backups looks like this:
Job {
Name = "weekday"
JobDefs = "DefaultJob"
Level = Full
FileSet = "dailyFiles"
Schedule = "daily_4"
Pool = "Default"
}
Where JobDefs is this:
JobDefs {
Name = "DefaultJob"
Type = Backup
Client = fileserver-fd
Storage = Tape
Messages = Standard
Priority = 10
Write Bootstrap = "%c_%n.bsr"
}
It's a very small configuration, but it will be enough for the kind of backups I want to take. Ofcourse this example isn't the only job/fileset/schedule I configured.
It's running in test right now, I'll update here with the results.