Setting up Amanda
From openSUSE
This is a brief run through of setting Amanda to run a backup of the local machine.
This is based on the Cool Solutions article "Using Amanda to Backup Your Linux Server": [1]
I'm using OpenSUSE 10.2 on an IBM xSeries 225 with a 20/40 GB SCSI DAT as /dev/nst0.
As root Install Amanda through Yast
Once installed you need to enable the amanda xinet.d service, edit /etc/xinetd.d/amanda and change the line disable = yes to disable = no and restart the xinetd service from yast
Note: On OpenSUSE 10.3 I had to change the xinet.d service settings to get it working, see the notes at the bottom of the page.
The first thing to do is to let amanda probe your tape drive to find it's capacity. Put a tape in to the drive (all data will be erased on the tape) and run (-e is the estimated size of your tape 20GB in my case):
amtapetype -o -f /dev/nst0 -e 20G
This will take along time and produce something like the following:
define tapetype unknown-tapetype {
comment "just produced by tapetype prog (hardware compression on)"
length 16385 mbytes
filemark 32 kbytes
speed 2152 kps
}
copy this to a text file for now for safe keeping.
When we write our config we'll also need to setup how many tapes were using with Amanda, there is a script available at: [2] you can use to work out the numbers for you. Download / run this and make a note of the numbers it produces for use when we write out the config.
As I was using 5 tapes for a Mon - Fri backup the script produced:
dumpcycle 1 week runspercycle 5 runtapes 1 tapecycle 6 tapes
Yes it says 6 tapes, thats correct as you have to allow 1 more than your using, see the amanda docs.
Now we setup our config directory for our backup, I'm using fullback:
mkdir /etc/amanda/fullback chown amanda.disk /etc/amanda/fullback
in the fullback directory create the following config files: amanda.conf, disklist and fullback.exclude.
Here is a copy of my amanda.conf containing the information obtained from amtapetype and the tape number script:
org "FSC World" # Title of report
mailto "root" # recipients of report, space separated
dumpuser "amanda" # the user to run dumps under
inparallel 4 # maximum dumpers that will run in parallel
netusage 600 # maximum net bandwidth for Amanda, in KB per sec
dumpcycle 1 week
runspercycle 5
runtapes 1
tapecycle 6 tapes
bumpsize 20 MB
bumpdays 1
bumpmult 4
tapedev "/dev/nst0"
tapetype SEGATEDAT-40
labelstr "^FULLBACK-[0-9][0-9]*$"
holdingdisk hd1 {
comment "Temporary holding space"
directory "/var/tmp/amanda"
use 2000 MB
}
infofile "/var/lib/amanda/fullback/curinfo"
logdir "/var/log/amanda/fullback"
indexdir "/var/lib/amanda/fullback/index"
define tapetype SEGATEDAT-40 {
comment "SEGATE 40GB DAT (hardware compression on)"
length 16385 mbytes
filemark 32 kbytes
speed 2152 kps
}
define dumptype root-tar {
program "GNUTAR"
comment "root partition dump with tar"
index yes
dumpcycle 0
exclude list "/etc/amanda/fullback/fullback.exclude"
priority high
}
Note: seting the dumpcycle 0 peramater in the define dumptype root-tar { section at the bottom of the config should give us a full backup everyday, if you want incrementals then remove it.
Here is a copy of my fullback.exclude:
/proc /tmp
And lastly my disklist. This is where we tell amanda what to back up, I'm backing up from /:
localhost / root-tar
Now we setup some files, directories and permissions:
mkdir /var/tmp/amanda mkdir /var/lib/amanda/fullback mkdir /var/lib/amanda/fullback/index mkdir /var/log/amanda mkdir /var/log/amanda/fullback touch /etc/amanda/fullback/tapelist touch /var/lib/amanda/amandates chown amanda.disk /var/tmp/amanda chown amanda.disk /etc/amanda/fullback/* chown amanda.disk /var/lib/amanda/amandates chown -R amanda.disk /var/lib/amanda/fullback chown amanda.disk /var/log/amanda/fullback chmod 770 /var/tmp/amanda chmod 770 /etc/amanda/fullback chmod 700 /etc/amanda/fullback/* chmod -R 770 /var/lib/amanda/fullback chmod 770 /var/log/amanda/fullback
Next you should run amcheck on your config.
su amanda amcheck fullback
resolve any errors! - There are a couple of hints at the bottom of this page.
You have to label tapes to with Amanda, you need to put each tape in in turn and run amlabel for each of them. This will also run an amcheck on your config and alert you to any errors.
su amanda amlabel fullback FULLBACK-01
next tape
amlabel fullback FULLBACK-02
Once you've labelled your tapes you can now run a backup by running:
su amanda amdump fullback
Once it's finished you should get an email in the root mailbox account with the results.
If it backed up OK then you can create a script and run it from cron:
in your crontab:
01 00 * * 1-5 /root/backup.sh
and in /root/backup.sh:
# Change to amanda user and run amanda dump program su amanda -c "/usr/sbin/amdump fullback # Eject the tape sg_start /dev/nst0 –eject
Errors / Trouble shooting
You may get these errors when running amcheck or running a backup:
1
ERROR localhost NAK: user amanda from localhost is not allowed to execute the service noop: /var/lib/amanda/.amandahosts: incorrect permissions; file must be accessible only by its owner
Make sure /var/lib/amanda/.amandahosts exists and contains "localhost amanda" and set the permissions correctly.
chown amanda:disk /var/lib/amanda/.amandahosts
chmod 600 /var/lib/amanda/.amandahosts
2
WARNING: localhost: selfcheck request failed: Connection refused
change the xinet.d service settings as below:
Service settings for xinet.d on OpenSUSE 10.3
service amanda
{
disable = no
socket_type = stream
protocol = tcp
wait = no
user = amanda
group = disk
groups = yes
server = /usr/lib/amanda/amandad
server_args = -auth=bsdtcp amdump amindexd amidxtaped
}
and in your amanda.conf under your define dump type section add the option:
auth "bsdtcp"
.

