Disk Based Backups With Amanda On Debian Etch
Version 1.0
Author: Oliver Meyer <o [dot] meyer [at] projektfarm [dot] de>
This document describes how to set up Amanda (The Advanced Maryland Automatic Network Disk Archiver) on Debian Etch. For this tutorial I chose Ubuntu v7.04 as a backup-client. The resulting system provides a flexible backup-system with many features. It will be able to back up multiple hosts via network to various devices. I chose the disk based backup for this howto.
This howto is meant as a practical guide; it does not cover the theoretical backgrounds. They are treated in a lot of other documents in the web.
This document comes without warranty of any kind! I want to say that this is not the only way of setting up such a system. There are many ways of achieving this goal but this is the way I take. I do not issue any guarantee that this will work for you!
1 Preparation
Set up a basic Debian system and a basic Ubuntu system - update both.
The Debian system will be the backup-host: server1.example.com.
The Ubuntu system will be the backup-client: server2.example.com.
2 Needed Packages On The Backup-Host
apt-get install amanda-server xinetd gawk gnuplot readline-common
3 Backup-Host Configuration
Note: I'm using the standard configuration DailySet1 in this howto.
3.1 Amanda.conf
We customize the amanda.conf for DailySet1 to our needs:
vi /etc/amanda/DailySet1/amanda.conf
Edit the following, existing lines, so that they look like this:
tapecycle 6 tapes tapetype DISK tpchanger "chg-disk" changerfile "/etc/amanda/DailySet1/changer" tapedev "file:/dumps/amandatapes/DailySet1"
Now add the tapetype definition for the virtual tapedevice. In this example I chose a size of 3GB for each virtual tape - resulting in a required space of 18GB for all six virtual tapes. Adjust it to your needs.
define tapetype DISK { comment "Backup to HD" length 3072 mbytes }
Next we have to add a dumptype where we define the settings for the backups. But of course you can use the existing dumptypes. Make sure that you use/create one with the entry program "GNUTAR". All possible settings are well commented in the amanda.conf.
define dumptype example { global comment "example dumptype" compress client fast program "GNUTAR" strategy standard priority high }
3.2 Virtual Tapedevice
First we have to prepare a directory-tree for amanda where the backups will be stored temporarily (the holding disk):
mkdir -p /dumps/amanda
Now we have to create a directory for the virtual tapedevice:
mkdir -p /dumps/amandatapes/DailySet1
In the next step we have to create the directories for the virtual tapes. In this example we create six virtual tapes:
for i in 1 2 3 4 5 6; do mkdir /dumps/amandatapes/DailySet1/slot${i}; done
Create the info file:
touch /dumps/amandatapes/DailySet1/info
Time to initialize the tapedevice by inserting the first virtual tape into the tapedevice:
ln -s /dumps/amandatapes/DailySet1/slot1 /dumps/amandatapes/DailySet1/data
Now we have to pass the ownership to the amanda-user:
chown -R backup:backup /dumps/
Next we switch to the user backup:
su backup
Note: All amanda-commands, except amrestore, have to be executed as user backup.
Create the tapelist file:
touch /etc/amanda/DailySet1/tapelist
We have to label the virtual tapes to make them usable for amanda:
for i in 1 2 3 4 5 6; do /usr/sbin/amlabel DailySet1 DailySet1-${i} slot ${i}; done
3.3 The Disklist
The disklist brings all together. Here we define what has to be backed up from what server with which settings. A complete entry for a server consists of the fqdn, the path (e.g. /var) or device (e.g. sda1) that shall be backed up and the dumptype.
vi /etc/amanda/DailySet1/disklist
server2.example.com /home example
Note: Don't forget to add the backup-client to /etc/hosts if you are using this setup in a LAN without an own DNS.
3.4 Amandahosts
Finally we have to edit the amandahosts file:
vi /etc/amandahosts
server1.example.com backup server1.example.com root server2.example.com root