Disk Backup With Amanda On Debian Lenny

1. Introduction

Amanda is an open source client/server solution to back up filesystems. Backups are triggered by the backup server, backup definitions are located on the servers but exclusion lists are located on the client. Amanda is not yet to the level of backup solutions like IBM TSM/TDP or Legato Networker but it is the best open source solution I found so far.

2. Landscape

bckserver.mydomain.com (Debian lenny): The backup server that hosts amanda server.

bckclient.mydomain.com  (Debian lenny): The backup client is a web server with a MySQL version 5.0 database (no replication). The mysql backup is done with zrm version 2.2. I did not create a howto for zrm since the product is fairly easy to use and the zmanda Quick setup guide and user manual are really easy to follow. My biggest regret with zrm:  it does not backup to amanda tapes.

 An ISCSI SAN as a library. backup to virtual tapes (disks)

 

3. AMANDA

3.1 Backup Server

3.1.1 Installation

As user root install the amanda-server package and ... the amanda-client package or you will not be able to do restores from the bckclient.

# apt-get update

# apt-get install amanda-server amanda-client xinetd gawk gnuplot readline-common openssh-server

 Accept the additional packages required when prompted.

 

3.1.2  (If Applicable) Comment Amanda Entries In Inetd Configuration File

The packages configure both inetd and xinetd. In this howto we only use xinetd.

Edit /etc/inetd.conf and comment amanda related lines:

#:OTHER: Other services
#amandaidx stream tcp nowait backup /usr/sbin/tcpd /usr/lib/amanda/amindexd amindexd -auth=bsdtcp amdump amindexd amidxtaped
#amidxtape stream tcp nowait backup /usr/sbin/tcpd /usr/lib/amanda/amidxtaped amidxtaped -auth=bsdtcp amdump amindexd amidxtaped
#amanda dgram udp wait backup /usr/sbin/tcpd /usr/lib/amanda/amandad -auth=bsd amdump amindexd amidxtaped

 

3.1.3 Modify Amanda Daemons To Use auth bsdtcp

For details check the wiki.

Edit amanda, amidxtape and amandaidx files in /etc/xinetd.d/ to match the following:

# cat /etc/xinetd.d/amanda| grep -v "^#"
service amanda
{
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
}
# cat /etc/xinetd.d/amidxtape | grep -v "^#"
service amidxtape
{
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
}
# cat /etc/xinetd.d/amandaidx | grep -v "^#"
service amandaidx
{
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
}

 Enable the changes:

# /etc/init.d/xinetd restart

 

3.1.4 Backup Configuration

We will define daily backups and the configuration will be called DailySet1.

The backup user configured by default at the installation is:

user name: backup

user group: backup

home dir: /var/backups

#  su backup -c "mkdir /etc/amanda/DailySet1"

We create a minimum configuration file amanda.conf for DailySet1:

vi /etc/amanda/DailySet1/amanda.conf
org "DailySet1"         # your organization name for reports
mailto "[email protected]" # space separated list of operators at your site
dumpuser "backup" # the user to run dumps under

logdir "/etc/amanda/DailySet1/logs" # log directory
infofile "/etc/amanda/DailySet1/curinfo" # database filename
indexdir "/etc/amanda/DailySet1/index" # index directory
tapelist "/etc/amanda/DailySet1/tapelist" # list of used tapes

tapecycle 9 tapes
tapetype DISK
tpchanger "chg-disk"
changerfile "/etc/amanda/DailySet1/changer" # needed by amlabel
tapedev "file:/space/vtapes/DailySet1/slots"

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/DailySet1/global-debian-exclude.list"
}

Quick explanation:

- we plan to use 9 tapes of 5 GigaBytes. We recycle tapes after 9 backups.

- we plan to back up everything on the bckclient with some exceptions (ref exclude list section 3.2.6).

Check the amanda.conf man page for details on syntax.

Create the database repository for DailySet1 as specified in amanda.conf.

# su backup -c "mkdir /etc/amanda/DailySet1/logs"

# su backup -c "mkdir /etc/amanda/DailySet1/index"

# touch /etc/amanda/DailySet1/tapelist
# su backup -c "mkdir /etc/amanda/DailySet1/curinfo"

 

3.1.5 (Optional) Configure Holding Disks

The holding disk is used as a cache to store backup data from all Amanda clients (ref). 

If you do not intend to use holding disks, review the amanda.conf file.

# comment holding disk section if needed
#holdingdisk hd1 {
#  directory "/dumps/"
#}

and  skip  this section.

If you plan to use holding disks:

# su backup -c "mkdir /dumps"
# chmod 750 /dumps

I use here a local disk. The details are not covered by this document.

# cat /etc/fstab | grep LABEL
LABEL=holdingdisk       /dumps           ext3    defaults        0      
LABEL=backup       /space  xfs     _netdev        0       0 

 

3.1.6  Configure Virtual Tapes

# mkdir -p /space/

I use my ISCSI SAN disks here. Check this ISCSI howto for details.

# mkdir -p /space/vtapes/DailySet1/slots
# chown backup:backup -R  /space/
# chmod 750 /space/vtapes
# su - backup

$ cd /space/vtapes/DailySet1/slots

 Create the tapes:

$ for ((i=1; $i<=9; i++)); do mkdir  slot$i;done

Initialize tape changer:

$ ln -s slot1 data

 Test the virtual tapes:

$ ammt -f file:/space/vtapes/DailySet1/slots status

file:/space/vtapes/DailySet1/slots status: ONLINE

 Label the tapes:

$ for ((i=1; $i<=9;i++)); do amlabel DailySet1 DailySet1-0$i slot $i; done

Note: If you plan to use more than nine tapes (say 25 for example), do run a second amlabel command:

$ for ((i=10; $i<=25;i++)); do amlabel DailySet1 DailySet1-$i slot $i; done

 Reset the virtual tape changer back to the first slot.

$ amtape DailySet1 reset

amtape: changer is reset, slot 1 is loaded.

$ ls -l data

lrwxrwxrwx 1 backup backup  35 jun  7 02:27 data -> /space/vtapes/DailySet1/slots/slot1

 

3.1.7 Backup Definition: Disklist

In this section you specify for each backup client, what disks you intend to back up.

On the backup client:

As user root issue mount on the backup client to list mounted disks:

 # mount

/dev/mapper/debian-root on / type xfs
/dev/sda1 on /boot type ext2 (rw)
/dev/sdb1 on /var/www/www.mysite.com type ext3
 

On the backup server:

$ vi /etc/amanda/DailySet1/disklist
bckclient.mydomain.com /var/www/www.mysite.com/ daily
bckclient.mydomain.com / daily
bckclient.mydomain.com /boot/ daily

syntax: client.fqdn path dumptype (ref amanda.conf)

Note: Since we use fully qualified domain names, your name resolution (/etc/hosts or DNS and reverse DNS) must be correctly set up and tested. If you are unsure use IP addresses.

 

3.1.8 Authorization: amandahost

 This file is used to authorize client or server connections:

$ vi /etc/amandahosts
bckserver.mydomain.com root amindexd amidxtaped
bckserver.mydomain.com backup amdump
bckclient.mydomain.com root amindexd amidxtaped

The line: "bckclient.mydomain.com root amindexd amidxtaped" allows user root from bckclient to perform restores.

The line "bckserver.mydomain.com backup amdump" allows user backup from bckserver to run backups on bckserver.

Details on file syntax and authentification  here.

Note: Since we use fully qualified domain names, your name resolution (/etc/hosts or DNS and reverse DNS) must be correctly set up and tested. If you are unsure use IP addresses.

# ln -s /var/backups/.amandahosts /etc/amandahosts
# chmod 400 etc/amandahosts

# ls -l /etc/amandahosts

  -r-------- 1 backup backup 157 mai 27 02:12 /etc/amandahosts
  # ls -l /var/backups/.amandahosts

lrwxrwxrwx 1 root root 16 mai 17 00:41 /var/backups/.amandahosts -> /etc/amandahosts

Share this page:

0 Comment(s)