Some notes about how I set up Amanda server and clients to back up jails on a FreeBSD host.
While looking for open-source backup solutions for jails on a FreeBSD box, I came across Amanda and Bacula. At first glance Amanda seemed easier to configure, so I tried to install it from ports. There were some hiccups, especially with regards to permissions and missing directories, so I documented the steps I needed to get it running below.
Amanda uses a server/client architecture, although not in the traditional sense where an application is running all the time. The “Amanda server” is the box that runs and keeps the backups, a process that can be scheduled using cron. Amanda “clients” are the machines that have data that needs to be backed up. It is entirely possible to run the server and client on the same device (VM, jail, etc.). In the configuration described here I am running Amanda server in one jail and an Amanda client in another jail.
On the Amanda server
If this is the first time using pkg on the server, install it:
sudo pkg
Press “Y” to confirm.
Here I am building amanda-server from ports because I plan on using S3 functionality in amanda-server, which is not enabled in the binary packages. If you don’t need S3 (or don’t know what it is), feel free to save some time by skipping to “To install binaries” below.
Edit the file /usr/local/etc/amanda/DailySet1/amanda.conf:
vi /usr/local/etc/amanda/DailySet1/amanda.conf
Find this section (line):
define dumptype global {
In the section, change:
auth "bsdtcp"
to:
auth "ssh"
Test configuration:
amcheck DailySet1
Fix any problems before continuing.
Initiate the first full backup:
amdump DailySet1
Check that a backup summary is received by e-mail.
Automate this backup using cron:
crontab -e
Add this line to the file to run backups daily Monday through Friday at 1 AM:
0 1 * * 1-5 /usr/local/sbin/amdump DailySet1
That’s it, you should now receive a daily mail shortly after 1AM, informing you of a successful backup of /var/www from the client to the server. The first report (hopefully received during the test run above) should be about a full backup and the next couple of reports will only do an incremental backup, with a new full backup every week (as specified in the vtape configuration command).
Some other opensource backup solutions that should work on FreeBSD: