Amanda is the world's most popular Open Source Backup and Archiving software. Amanda allows System Administrators to set up a single backup server to back up multiple hosts to a tape- or disk-based storage system. Amanda uses native archival tools and can back up a large number of workstations and servers running various versions of Linux, Unix or Microsoft Windows operating systems. - http://wiki.zmanda.com
This setup log is for the installation of Amanda 2.6.0p2 on Red Hat / CentOS 5 with a Spectra Logic T50 LTO2 tape library, containing 5 magazines/terapacks and 50 tape slots, used to backup over a terabyte of Maildir for 3000 users. The backup is local from direct-attach RAID storage.
A similar setup also works with a Dell PowerVault TL2000 LTO4 tape library, containing 2 magazines and 23 tape slots, used to backup 4TB of research data for over 100 users.
The first thing to do is see what SCSI devices the tape library was detected as. SCSI device names can be found by looking through /var/log/messages or dmesg output:
# dmesg | grep -i "changer" -B 2 -A 6
scsi 5:0:3:0: Attached scsi generic sg7 type 1
Vendor: SPECTRA Model: PYTHON Rev: 2000
Type: Medium Changer ANSI SCSI revision: 03
scsi 5:0:3:1: Attached scsi generic sg8 type 8
st: Version 20050830, fixed bufsize 32768, s/g segs 256
st 5:0:2:0: Attached scsi tape st0
st0: try direct i/o: yes (alignment 512 B)
st 5:0:3:0: Attached scsi tape st1
st1: try direct i/o: yes (alignment 512 B)In this example, there is a changer on sg8, along with tape drives st0 and st1. Check to see if the media changer responds correctly to some mt and mtx commands. Note that nst0 is the non-rewind version of tape drive device st0:
# yum install mt-st mtx
# alias mtx='TAPE=/dev/sg8 mtx'
# alias mt0='TAPE=/dev/nst0 mt'
# alias mt1='TAPE=/dev/nst1 mt'
# mtx status
Storage Changer /dev/sg8:2 Drives, 50 Slots ( 0 Import/Export )
Data Transfer Element 0:Empty
Data Transfer Element 1:Full (Unknown Storage Element Loaded)
Storage Element 1:Full :VolumeTag=000001LX
Storage Element 2:Full :VolumeTag=000002LX
Storage Element 3:Empty
Storage Element 4:Full :VolumeTag=000004LX
...
# mt1 status
SCSI 2 tape drive:
File number=0, block number=0, partition=0.
Tape block size 0 bytes. Density code 0x42 (LTO-2).
Soft error count since last status=0
General status bits on (41010000):
BOT ONLINE IM_REP_EN
# mtx unload 3 1
Unloading Data Transfer Element into Storage Element 3...Install the latest stable Amanda from sourceforge.
# cd /usr/src
# wget http://internap.dl.sourceforge.net/sourceforge/amanda/amanda-2.6.0p2.tar.gz
# yum install rpm-devel rpm-build autoconf automake bison flex gcc gtk2-devel glib2-devel
# rpmbuild -tb amanda-2.6.0p2.tar.gz
# rpm -ihv /usr/src/redhat/RPMS/x86_64/amanda-backup_server-2.6.0p2-1.rhel5.x86_64.rpmThe RPM package will do a number of configuration steps automatically upon install:
Preparing... ########################################### [100%]
Sep 29 2008 14:14:15: Preparing to install: Amanda Community Edition - version 2.6.0p2
Sep 29 2008 14:14:15: Checking for 'amandabackup' user...
Sep 29 2008 14:14:15:
Sep 29 2008 14:14:15: The 'amandabackup; user account has been successfully created.
Sep 29 2008 14:14:15: Furthermore, the account has been automatically locked for you
Sep 29 2008 14:14:15: for security purposes. Once a password for the 'amandabackup'
Sep 29 2008 14:14:15: account has been set, the user can be unlocked by issuing
Sep 29 2008 14:14:15: the following command as root.:
Sep 29 2008 14:14:15:
Sep 29 2008 14:14:15: # passwd -u amandabackup
Sep 29 2008 14:14:15:
Sep 29 2008 14:14:15: If this is not a new installation of Amanda and you have
Sep 29 2008 14:14:15: pre-existing Amanda configurations in /etc/amanda
Sep 29 2008 14:14:15: you should ensure that 'dumpuser' is set to 'amandabackup'
Sep 29 2008 14:14:15: in those configurations. Additionally, you should ensure
Sep 29 2008 14:14:15: that /var/lib/amanda/.amandahosts on your client systems
Sep 29 2008 14:14:15: is properly configured to allow connections for the user
Sep 29 2008 14:14:15: 'amandabackup'.
Sep 29 2008 14:14:15:
Sep 29 2008 14:14:15:
Sep 29 2008 14:14:15: === Amanda backup server installation started. ===
1:amanda-backup_server ########################################### [100%]
Sep 29 2008 14:14:15: Updating system library cache...done.
Sep 29 2008 14:14:15: Reloading xinetd configuration...Stopping xinetd: [FAILED]
Starting xinetd: [ OK ]
success.
Sep 29 2008 14:14:15: Installing '/var/amanda/amandates'.
Sep 29 2008 14:14:15: The file '/var/amanda/amandates' has been created.
Sep 29 2008 14:14:15: Ensuring correct permissions for '/var/amanda/amandates'.
Sep 29 2008 14:14:15: '/var/amanda/amandates' Installation successful.
Sep 29 2008 14:14:15: Checking '/var/lib/amanda/.amandahosts' file.
Sep 29 2008 14:14:16: Checking '/etc/amanda/amanda-client.conf' file.
Sep 29 2008 14:14:16: Create '/var/lib/amanda/.am_passphrase' file.
Sep 29 2008 14:14:16: Installing '/var/lib/amanda/.gnupg'.
Sep 29 2008 14:14:16: '/var/lib/amanda/.gnupg' will be created.
Sep 29 2008 14:14:16: The directory '/var/lib/amanda/.gnupg' created successfully.
Sep 29 2008 14:14:16: Ensuring correct permissions for '/var/lib/amanda/.gnupg'.
Sep 29 2008 14:14:16: '/var/lib/amanda/.gnupg' Installation successful.
Sep 29 2008 14:14:16: Creating directory '/var/lib/amanda/.ssh'.
Sep 29 2008 14:14:16: Creating ssh RSA key in '/var/lib/amanda/.ssh/id_rsa_amdump'
Sep 29 2008 14:14:16: Setting ownership and permissions for '/var/lib/amanda/.ssh' and '/var/lib/amanda/.ssh/id_rsa_amdump*'
Sep 29 2008 14:14:16: Creating ssh RSA key in '/var/lib/amanda/.ssh/id_rsa_amrecover'
Sep 29 2008 14:14:16: Setting ownership and permissions for '/var/lib/amanda/.ssh'
Sep 29 2008 14:14:16: Checking for '/var/lib/amanda/.profile' and ensuring correct environment.
Sep 29 2008 14:14:16: Setting ownership and permissions for '/var/lib/amanda/.profile'
For latest Amanda documentation, checkout Amanda Wiki: http://wiki.zmanda.com
Sep 29 2008 14:14:17: === Amanda backup server installation complete. ===
Amanda installation log can be found in '/var/log/amanda/install.log' and errors (if any) in '/var/log/amanda/install.err'.
Now to configure amanda, which includes creating a few config files and labeling tapes. Each amanda config will live in a separate directory under /etc/amanda/ which means you can have multiple configurations. A good way to do off-site tape is to have an odd-month config and an additional even-month config, each with a different set of tapes. The config files are: amanda.conf, changer.conf, and disklist
# mkdir -p /etc/amanda/BackupSet1
# cp /var/lib/amanda/example/amanda.conf /etc/amanda/BackupSet1/
# vim /etc/amanda/BackupSet1/amanda.conf
# vim /etc/amanda/BackupSet1/changer.conf
# vim /etc/amanda/BackupSet1/disklist
# vim ~amandabackup/.amandahosts
# chown -R amandabackup.disk /etc/amandaHere is the example amanda.conf with comments stripped out:
org "MyGroup"
mailto "my.email@imap.server.net"
dumpuser "amandabackup"
inparallel 8
dumporder "sssS"
taperalgo first
displayunit "k"
netusage 8000 Kbps
dumpcycle 4 weeks
runspercycle 4
tapecycle 24 tapes
bumpsize 1000 Mb
bumppercent 20
bumpdays 1
bumpmult 4
etimeout 300
dtimeout 1800
ctimeout 30
device_output_buffer_size 1280k
usetimestamps yes
flush-threshold-dumped 0
flush-threshold-scheduled 0
taperflush 0
autoflush no
runtapes 6
tpchanger "chg-zd-mtx"
tapedev "tape:/dev/nst0"
changerfile "/etc/amanda/BackupSet1/changer.conf"
changerdev "/dev/sg8"
maxdumpsize -1
tapetype LTO2
labelstr "^BackupSet1-[0-9][0-9]*$"
amrecover_do_fsf yes
amrecover_check_label yes
amrecover_changer "changer"
holdingdisk hd1 {
comment "main holding disk"
directory "/dumps/amanda"
use -100 Mb
chunksize 1Gb
}
infofile "/etc/amanda/BackupSet1/curinfo"
logdir "/etc/amanda/BackupSet1"
indexdir "/etc/amanda/BackupSet1/index"
define tapetype LTO2 {
comment "Spectra LTO2 200Gb Compression Off"
length 167936 mbytes
filemark 0 kbytes
speed 17554 kps
}
define tapetype LTO4 {
comment "Dell LTO4 800Gb Compression Off"
length 802816 mbytes
filemark 0 kbytes
speed 52616 kps
}
define dumptype global {
comment "Global definitions"
auth "bsdtcp"
}
define dumptype root-tar {
global
program "GNUTAR"
comment "root partitions dumped with tar"
compress none
index
priority low
}
define dumptype user-tar {
root-tar
comment "user partitions dumped with tar"
priority medium
}
define dumptype comp-root-tar {
root-tar
comment "Root partitions with compression"
compress client fast
}
define dumptype comp-user-tar {
user-tar
compress client fast
}
define interface local {
comment "a local disk"
use 8000 kbps
}
Note that only slots 26-50 are referenced in this example. The first 25 slots are referenced in another amanda config.
changer.conf:
firstslot=26
lastslot=50
driveslot=0
havereader=1
#autoclean=1
#cleanslot=25
#autocleancount=99
#cleancycle=120
#max_drive_wait=120
#unloadpause=20
#poll_drive_ready=10
#initial_poll_delay=10
Here is an example disklist entry for a home directory. Create one for each user, one per line.
disklist:
group.backup.server.net /home/testuser comp-user-tar
Generate the exact tapetype definition for amanda.conf (this takes over 5 hours):
# mtx -f /dev/sg8 load 50 1
# mt -f /dev/nst1 compression 0
# mt -f /dev/nst1 setblk 0
# amtapetype -o -t LTO2 -e 200g -f /dev/nst1
Writing 512 Mbyte compresseable data: 28 sec
Writing 512 Mbyte uncompresseable data: 28 sec
Estimated time to write 2 * 204800 Mbyte: 22400 sec = 6 h 13 min
wrote 5308416 32 Kb blocks in 81 files in 9569 seconds (No space left on device)
wrote 5439488 32 Kb blocks in 166 files in 10029 seconds (No space left on device)
define tapetype LTO2 {
comment "just produced by tapetype prog (hardware compression off)"
length 167936 mbytes
filemark 0 kbytes
speed 17554 kps
}Create amanda dump space on disk for staging the stream of data to tape, at least as big as one tape. Staging the dumps is a significant performance gain allowing a continuous stream to tape.
# lvcreate --size 300G --name amanda-dump RaidVolGroup00
# mkfs -t ext3 -m 1 -O dir_index,filetype,has_journal,sparse_super /dev/RaidVolGroup00/dumps
# mkdir /dumps
# echo "/dev/RaidVolGroup00/dumps /dumps ext3 defaults 0 0" >>/etc/fstab
# mount /dumps
# mkdir /dumps/amanda
# chown amandabackup.disk /dumps/amandalabel tapes in slots 26-50:
# su - amandabackup
$ touch /etc/amanda/BackupSet1/tapelist
$ for I in {26..50}; do
> mtx -f /dev/sg8 load $I;
> mt -f /dev/nst0 compression 0;
> mt -f /dev/nst0 setblk 0;
> amlabel BackupSet1 BackupSet1-$I slot $I;
> mtx -f /dev/sg8 unload $I;
> doneDo a config test and resolve any errors. Repeat until "0 problems found.":
$ amcheck BackupSet01
If you get "selfcheck request failed: timeout waiting for ACK",
add auth "bsdtcp" to the definition of dumptype global in the amanda.conf.
Do a test backup/dump with only a few disklist entries. An email will be sent when complete:
$ amdump BackupSet1After each test, wipe and re-use the same tape:
$ amrmtape BackupSet1 BackupSet1-49
$ amlabel -f BackupSet1 BackupSet1-49With any good backup system, testing recovery and restore is a must:
# mkdir /mnt/restore
# cd /mnt/restore
# ammt -t tape:/dev/nst0 rewind
# amrecover BackupSet1
amrecover> setdisk /home4/testuser
amrecover> ls
amrecover> add .bashrc
amrecover> extract
amrecover> quitOnce you have a fully functional configuration, automate the backups with cron:
# crontab -e -u amandabackup#minute hour day month dayofweek command
# odd month backups
0 12 1,8,15,22 1,3,5,7,9,11 * /usr/sbin/amcheck -m BackupSet1
0 18 1,8,15,22 1,3,5,7,9,11 * /usr/sbin/amdump BackupSet1
# even month backups
0 12 1,8,15,22 2,4,6,8,10,12 * /usr/sbin/amcheck -m BackupSet2
0 18 1,8,15,22 2,4,6,8,10,12 * /usr/sbin/amdump BackupSet2
More information at:

0 comments:
Post a Comment