Amanda(http://www.amanda.org/) Backup System Installation on Debian Lenny¶
This document provides detailed information on how to install an Amanda backup server on a Debian (Lenny) based host system and how to configure it for several backup clients (Xen virtual machines) located on the same host.
Also, it explains how to configure backup client systems on virtual machines in order to get backed up regularly by the Amanda backup server.
If you are only interested in setting up and configuring a backup client on your virtual machine, please proceed directly to section Backup Client Installation.
Backup Server¶
Installation¶
First, install the relevant packages for Amanda on the Debian system.
apt-get update apt-get install amanda-server amanda-client xinetd gnuplot
Amanda will be executed by xinetd. Though, edit the amanda xinetd service configuration files in order to use tcp stream sockets and bsdtcp authentication.
/etc/xinetd.d/amanda
# default: on # description: The amanda service service amanda { # only_from = <Amanda server> socket_type = stream protocol = tcp wait = no user = backup group = backup groups = yes server = /usr/lib/amanda/amandad server_args = -auth=bsdtcp amdump amindexd amidxtaped disable = no }
/etc/xinetd.d/amandaidx
#default: on # description: The amanda index service service amandaidx { # only_from = <Amanda client list> socket_type = stream protocol = tcp wait = no user = backup group = backup groups = yes server = /usr/lib/amanda/amindexd server_args = -auth=bsdtcp amdump amindexd amidxtaped disable = no }
/etc/xinetd.d/amidxtape
#default: on # description: The amanda tape service service amidxtape { # only_from = <Amanda client list> socket_type = stream protocol = tcp wait = no user = backup group = backup groups = yes server = /usr/lib/amanda/amidxtaped server_args = -auth=bsdtcp amdump amindexd amidxtaped disable = no }
Restart xinetd.
/etc/init.d/xinetd restart
Preparing backups¶
The aim is to backup the virtual machine clients on a daily basis. Also, a full backup should be done four weeks, while incremental backups should be done once a day. So, we will define a backup configuration called vmDaily.
At first, we have to prepare the configuration by creating some files and directories. As amanda will run as user backup, we also have to set ACL's for user backup accordingly.
mkdir /etc/amanda/vmDaily mkdir /etc/amanda/vmDaily/logs mkdir /etc/amanda/vmDaily/index mkdir /etc/amanda/vmDaily/curinfo touch /etc/amanda/vmDaily/tapelist touch /etc/amanda/vmDaily/disklist touch /etc/amanda/vmDaily/amanda.conf chown -R backup:backup /etc/amanda
** /etc/amanda/vmDaily/amanda.conf ** is the configuration file for our backup configuration vmDaily.
org "BGBM (wp5demo)" # your organization name for reports mailto "backup@localhost" # space separated list of operators at your site dumpuser "backup" # the user to run dumps under logdir "/etc/amanda/vmDaily/logs" # log directory infofile "/etc/amanda/vmDaily/curinfo" # database filename indexdir "/etc/amanda/vmDaily/index" # index directory tapelist "/etc/amanda/vmDaily/tapelist" # list of used tapes dumpcycle 28 days tapecycle 100 tapes tapetype DISK tpchanger "chg-disk" changerfile "/etc/amanda/vmDaily/changer" # needed by amlabel tapedev "file:/backup/amanda/vmDaily/slots" usetimestamps yes runtapes 30 define tapetype DISK { comment "Backup to HD" length 5 gbytes } # comment holding disk section if needed #holdingdisk hd1 { # directory "/dumps/" #} # to be used by any other dumptype define dumptype global { comment "Global definitions" index yes record yes auth "bsdtcp" } define dumptype daily { global comment "daily dumptype" compress client fast program "GNUTAR" strategy standard priority high exclude list "/etc/amanda/vmDaily/global-debian-exclude.list" }
Briefly, we defined a four weeks full backup schedule with daily incremental backups. Backups will be stored on disk at /backup/amanda/vmDaily/slots using 14 virtual tapes of 30 GB length each.
Most configuration values are default settings. The following settings has been adopted to our needs.
dumpcycle::
A full backup will be done at the beginning of each dumpcycle (every 4 weeks)
tapecycle::
This is the number of virtual tapes (directories) available for backups.
tapedev::
This is the path to the directory (or device) where virtual backup tapes will be stored on disk.
usetimestamps::
This is necessary in order to avoid amanda error messages when running more than one backup per day (e.g. manually initiated backups)
runtapes::
The maximum number of tapes to be used in a single backup run.
Within the tapetype DISK definition, we adopted the length of each virtual tape.
length::
lenght of a virtual tape on disk
Please find more detailed information about the configuration file here .
Now, we have to prepare the directories for the virtual tapes on disk.
mkdir -p /backup/amanda/vmDaily/slots for ((i=1; $i<=14; i++)); do mkdir /backup/amanda/vmDaily/slots/slot$i;done chown -R backup:backup /backup/amanda chmod 750 /backup/amanda
Next, we have to label the tapes and reset the backup tape system. This must be done as user backup. So, we must change to that user id first.
su - backup for ((i=1; $i<=9;i++)); do amlabel vmDaily vmDaily-0$i slot $i; done for ((i=10; $i<=14;i++)); do amlabel vmDaily vmDaily-$i slot $i; done ln -s slot1 /backup/amanda/vmDaily/slots/data amtape vmDaily reset
Define Backups¶
As the backup system is ready to use, the remaining task is to define what will have to be backed up. Therefore, the file _ /etc/amanda/vmDaily/disklist _ must be edited.
The following lines defines that backups will be taken from the root directory of host idpdemo.e-taxonomy.eu and from the directory /var/www of host spdemo.e-taxonomy.eu. The first parameter is the host name and must be given as FQDN, the second defines the directory on the host to be backed up and the third defines the dumptype to be used as defined in the backup configuration file /etc/amanda/vmDaily/amanda.conf.
idpdemo.e-taxonomy.eu / daily spdemo.e-taxonomy.eu /var/www/ daily
This backup list must be adopted to your individual needs.
Please find more detailed information about disklist here .
Authorisation¶
Finally, [Amanda](http://www.amanda.org/ includes an authorisation system in order to allow backup hosts certain actions on the backup server or client either. Authorisations has to be defined in the file _/etc/amandahosts) _.
The first line enables the user backup of the backup server host to run and recover backups. The following lines enable the user root of the hosts idpdemo.e-taxonomy.eu and spdemo.e-taxonomy.eu to recover their backups only.
localhost backup idpdemo.e-taxonomy.eu root amindexd amidxtaped spdemo.e-taxonomy.eu root amindexd amidxtaped
This authorisations must be adopted to your individual needs.
Please find more detailed information about the authorisation subsystem here .
Test Backup¶
Note::
You will have to conduct at least one Backup Client Installation before continue checking your backup installation!
In order to check your configuration, log in as user backup and execute the amcheck command. You should get an output similar to the following
vmDaily-01', date
If at the end 0 problems found is stated, then everything should be fine. Otherwise, refer to the log files at /var/log/amanda/server/vmDaily.
Next, you can run your first backup. Remain logged in as user backup an run the amdump command.
amdump vmDaily You have mail in /var/mail/backup
If you already had configured a local email service on you backup client host, an email would have been sent got to the system administrator instead of the last statement. Please, consult either /var/mail/backup or your the system administrator's email account to retrieve the result of the amdump command. Log files can be found at /var/log/amanda/server/vmDaily.
Backup Scheduling¶
For daily execution of amdump, it can be scheduled via cron daemon.
su backup -c "crontab -e"
The following line will schedule a backup each night at 03.00.
0 3 * * 1-7 /usr/sbin/amdump vmDaily
Backup Client Installation¶
This section describes on how to install and configure our virtual machines in order to get backed up by the backup servers running at bgbm45 or wp5demo.
Important Note:::
Before starting the installation procedure, please contact the backup server system administrator and inform him about the servers and directories you want to be backed up!
Installation¶
First, install the relevant packages for Amanda Client on the Debian system.
apt-get update apt-get install amanda-client xinetd
Amanda will be executed by xinetd. Though, edit the amanda xinetd service configuration files in order to use tcp stream sockets and bsdtcp authentication.
/etc/xinetd.d/amanda
# default: on # description: The amanda service service amanda { # only_from = <Amanda server> socket_type = stream protocol = tcp wait = no user = backup group = backup groups = yes server = /usr/lib/amanda/amandad server_args = -auth=bsdtcp amdump amindexd amidxtaped disable = no }
Restart xinetd.
/etc/init.d/xinetd restart
Preparing backups¶
The aim is to get backed up by the backup server configuration called vmDaily either running on bgbm45 or wp5demo. So, we have to create some directories and files first.
mkdir -p /etc/amanda/vmDaily touch /etc/amanda/amanda-client.conf touch /etc/amanda/vmDaily/global-debian-exclude.list chmod 644 /etc/amanda/vmDaily/global-debian-exclude.list chown -R backup:backup /etc/amanda
Next, the client configuration takes place in the configuration file _ /etc/amanda/amanda-client.conf _
conf "vmDaily" # your config name index_server "wp5demo.e-taxonomy.eu" # your amindexd server tape_server "wp5demo.e-taxonomy.eu" # your amidxtaped server auth "bsdtcp"
Please find more detailed information about the client configuration here .
./proc ./media ./mnt ./dev
Please find more detailed information about exclude lists here
Authorisation¶
Finally, [Amanda client](http://www.amanda.org/ also includes an authorisation system in order to allow our backup servers certain actions on the backup client. Authorisations has to be defined in the file _/etc/amandahosts) _.
The first line enables the user backup of the backup client host to run and recover backups. The following line enable the user backup of the hosts wp5demo.e-taxonomy.eu and bgbm45.bgbm.fu-berlin.de to make backups on this client hosts.
localhost backup wp5demo.e-taxonomy.eu backup amdump bgbm45.bgbm.fu-berlin.de backup amdump
Please find more detailed information about the authorisation subsystem here .
Restoring Backups¶
When backup testing was successfully on the backup server, then backups can be restored on the backup client.
This will be done using the command _ amrecover _.
Note:::
Files will be restored to the current directory. So, create or change to a dummy directory before testing the _ amrecover _ command!
Please find more detailed information about the usage of the amrecover command here .
amrecover AMRECOVER Version 2.5.2p1. Contacting server on wp5demo.e-taxonomy.eu ... 220 wp5demo AMANDA index server (2.5.2p1) ready. Setting restore date to today (2010-09-10) 200 Working date set to 2010-09-10. 200 Config set to vmDaily. 200 Dump host set to idpdemo.e-taxonomy.eu. Use the setdisk command to choose dump disk to recover
Using the listdisk command in the amrecover console, provides an overview of available disks for the backup client.
amrecover> listdisk 200- List of disk for host idpdemo.e-taxonomy.eu 201- / 200 List of disk for host idpdemo.e-taxonomy.eu
Then, use setdisk to set the disk from which files shall be restored. The ls command list the available file structure of the latest backup.
amrecover> setdisk / 200 Disk set to /. amrecover> ls 2010-09-10-16-43-48 var/ 2010-09-10-16-43-48 usr/ 2010-09-10-16-43-48 tmp/ 2010-09-10-16-43-48 sys/ 2010-09-10-16-43-48 srv/ 2010-09-10-16-43-48 selinux/ 2010-09-10-16-43-48 sbin/ 2010-09-10-16-43-48 root/ 2010-09-10-16-43-48 opt/ 2010-09-10-16-43-48 lost+found/ 2010-09-10-16-43-48 lib64 2010-09-10-16-43-48 lib/ 2010-09-10-16-43-48 home/ 2010-09-10-16-43-48 etc/ 2010-09-10-16-43-48 boot/ 2010-09-10-16-43-48 bin/ 2010-09-10-16-43-48 .
Finally, use the add command to select the files to be restored and start extracting the selected files using the extract command. Simply accept any options by pressing Enter.
amrecover> add * Added dir /var/ at date 2010-09-10-16-43-48 Added dir /usr/ at date 2010-09-10-16-43-48 Added dir /tmp/ at date 2010-09-10-16-43-48 Added dir /sys/ at date 2010-09-10-16-43-48 Added dir /srv/ at date 2010-09-10-16-43-48 Added dir /selinux/ at date 2010-09-10-16-43-48 Added dir /sbin/ at date 2010-09-10-16-43-48 Added dir /root/ at date 2010-09-10-16-43-48 Added dir /opt/ at date 2010-09-10-16-43-48 Added dir /lost+found/ at date 2010-09-10-16-43-48 Added file /lib64 Added dir /lib/ at date 2010-09-10-16-43-48 Added dir /home/ at date 2010-09-10-16-43-48 Added dir /etc/ at date 2010-09-10-16-43-48 Added dir /boot/ at date 2010-09-10-16-43-48 Added dir /bin/ at date 2010-09-10-16-43-48 amrecover> extract Extracting files using tape drive chg-disk on host wp5demo.e-taxonomy.eu. The following tapes are needed: vmDaily-01 Restoring files into directory /tmp/amanda Continue [?/Y/n]? Extracting files using tape drive chg-disk on host wp5demo.e-taxonomy.eu. Load tape vmDaily-01 now Continue [?/Y/n/s/t]? ./bin/ ./boot/
Updated by Andreas Müller almost 2 years ago · 19 revisions