Installazione e configurazione Amanda su Debian Sarge
Installazione pacchetti
apt-get install amanda-client amanda-common amanda-server
Configurazione accessi
cat >/etc/amandahosts <<EOFile # nomehost utente_che_può_accedere localhost root localhost.localdomain root localhost backup localhost.localdomain backup $(hostname) root $(hostname -f) root $(hostname) backup $(hostname -f) backup EOFile
Configurazione principale
In /etc/amanda c'è una cartella DailySet1, che contiene gli esempi per il Job così denominato.
Modificare quanto segue in /etc/amanda/DailySet1/amanda.conf:
org "Nome Server per Report" # your organization name for reports
mailto "alert@rvmgroup.it" # space separated list of operators at your site
dumpcycle 0 # the number of days in the normal dump cycle
tapecycle 1 tapes # the number of tapes after that a tape could be overwritten
# con 1 si può sovrascrivere qualsiasi nastro successivo
tapedev "/dev/nst0" # Linux @ tuck, important: norewinding
Definizione del tipo di nastro
Bisogna definire un tipo nastro, da utilizzare poi nella configurazione.
Identificare il tape drive in uso:
# cat /proc/scsi/scsi Attached devices: Host: scsi0 Channel: 00 Id: 03 Lun: 00 Vendor: HP Model: C5683A Rev: C104 Type: Sequential-Access ANSI SCSI revision: 02
Verificare che non sia già esistente nel file di configurazione. Se non esiste, cercarlo nelle FAQ di amanda http://amanda.sourceforge.net/cgi-bin/fom?cmd=searchForm&file=1 oppure su google.
Esempi:
HP Dat 40i C5683A
20 Gb non compressi DDS4
define tapetype HP-Dat-40-C5683A {
comment "HP Surestore Dat40i C5683A"
length 19560 mbytes
filemark 1147 kbytes
speed 2957 kps
}
HP Dat 8i C1533A
4 Gb non compressi DDS2
define tapetype C1533A_120 {
comment "HP C1533A DDS2 with 120m tapes"
length 3858 mbytes
filemark 107 kbytes
speed 507 kbytes
}
Mettere la definizione prima delle altre.
Definire ora che per questo job si intente usare questo tapetype.
In /etc/amanada/DailySet1:
tapetype HP-Dat-40-C5683A # what kind of tape it is (see tapetypes below)
Definizione del Formato della Label per i nastri
Occorre definire un formato standard per verificare che il tape inserito sia effettivamente uno giusto.
Per standard utiliiamo il formato
A-01-Monday
Quindi modificare in /etc/amanada/DailySet1:
labelstr "^[A-Z]-[0-5][0-5]-$*" # label constraint regex: all tapes must match
Definizione del tipo di Job di Backup
Occorre definire le caratteristiche del dumptype. Utiliziamo un backup completo giornaliero che utilizzi il formato portabile tar compresso.
Modificare in /etc/amanada/DailySet1:
define dumptype always-full {
comment "Full dump using tar with best software compression"
program "GNUTAR"
options compress-best, index
priority high
dumpcycle 0
maxcycle 0
}
Il dumptype sarà poi assegnato ad ogni disco in seguito.
Definizione dei dischi da backuppare
Occorre definire che dischi backuppare e in che modo.
Editare /etc/amanda/DailySet1/disklist. Se la partizione e il disco è uno solo, usare:
cat > /etc/amanda/DailySet1/disklist <<EOFile # File format is: # hostname diskdev dumptype # where the dumptypes are defined by you in amanda.conf. #$(hostname) $(mount | grep 'on / ' | cut -f 1 --delim=' ') always-full $(hostname) /bin always-full #nomeserver disco dumptype EOFile
Dall'esempio risulterà:
# File format is: # hostname diskdev dumptype # where the dumptypes are defined by you in amanda.conf. #server /dev/md0 always-full server /bin always-full #nomeserver disco dumptype
In questo caso quando si eseguirà il Job DailiSet1, verrà backuppato il disco /dev/md0 utiliando la configurazione test definita precedentemente. In produzione si utilizzerà la configurazione always-full.
Etichettatura dei Nastri
Si procede all'etichettatura dei nastri, in modo da identificarli univocamente. L'etichettatura va eseguita come utente "backup"
Crezione della tapelist vuota:
su backup -c "touch /etc/amanda/DailySet1/tapelist"
Etichettatura del nastro di backup manuale
su backup -c "/usr/sbin/amlabel DailySet1 X-01-Manual" rewinding, reading label, not an amanda tape rewinding, writing label X-01-Manual, checking label, done.
Verifica dell'inserimento in tapelist:
cat tapelist 0 X-01-Manual reuse
Verifica della lettura della label
su backup -c "/usr/sbin/amcheck DailySet1" Amanda Tape Server Host Check ----------------------------- NOTE: skipping tape-writable test Tape X-01-Manual label ok NOTE: info dir /var/lib/amanda/DailySet1/curinfo: does not exist NOTE: it will be created on the next run NOTE: index dir /var/lib/amanda/DailySet1/index/allserver: does not exist Server check took 0.499 seconds Amanda Backup Client Hosts Check -------------------------------- Client check: 1 host checked in 0.645 seconds, 0 problems found (brought to you by Amanda 2.4.4p3)
Quando è tutto ok, si procede al label di tutti i nastri, automatizzando anche l'espulsione:
su backup -c "/usr/sbin/amlabel DailySet1 A-01-Monday" ; ammt -f /dev/nst0 rewoffl rewinding, reading label, not an amanda tape rewinding, writing label A-01-Monday, checking label, done.
Test configurazione
su backup -c "/usr/sbin/amcheck DailySet1" Amanda Tape Server Host Check ----------------------------- NOTE: skipping tape-writable test Tape X-01-Manual label ok NOTE: info dir /var/lib/amanda/DailySet1/curinfo: does not exist NOTE: it will be created on the next run NOTE: index dir /var/lib/amanda/DailySet1/index/allserver: does not exist Server check took 0.024 seconds Amanda Backup Client Hosts Check -------------------------------- Client check: 1 host checked in 0.032 seconds, 0 problems found (brought to you by Amanda 2.4.4p3)
MODIFICARE CRONTAB.AMANDA E POI ESEGUIRLO PER CREARLO IN /VAR/SPOOL/CRON/CRONTABS/BACKUP
fire:/# cd etc/amanda fire:/etc/amanda# ls total 16 drwxrwx--- 3 backup backup 4096 Apr 8 10:15 . drwxr-xr-x 69 root root 4096 Apr 8 15:30 .. drwxrwx--- 2 backup backup 4096 Apr 8 14:32 DailySet1 -rw-rw---- 1 backup backup 370 Apr 2 2002 crontab.amanda fire:/etc/amanda# cat crontab.amanda
- This is an example for a crontab entry for automated backup with amanda
- With these cron lines, Amanda will check that the correct tape is in
- the drive every weekday afternoon at 4pm (if it isn't, all the
- operators will get mail). At 12:45am that night the dumps will be run.
0 16 * * 1-5 /usr/sbin/amcheck -m DailySet1 45 0 * * 2-6 /usr/sbin/amdump DailySet1
fire:/etc/amanda# vi crontab.amanda
- This is an example for a crontab entry for automated backup with amanda
- With these cron lines, Amanda will check that the correct tape is in
- the drive every weekday afternoon at 4pm (if it isn't, all the
- operators will get mail). At 12:45am that night the dumps will be run.
0 17 * * 1-5 /usr/sbin/amcheck -m DailySet1 5 22 * * 1-5 /usr/sbin/amdump DailySet1 0 07 * * 2-6 /usr/sbin/ammt -f /dev/st0 rewoffl
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ "crontab.amanda" 8L, 421C written
fire:/etc/amanda# crontab -u backup /etc/amanda/crontab.amanda fire:/etc/amanda# cat /var/spool/cron/crontabs/ cat: /var/spool/cron/crontabs/: Is a directory fire:/etc/amanda# cat /var/spool/cron/crontabs/backup
- DO NOT EDIT THIS FILE - edit the master and reinstall.
- (/etc/amanda/crontab.amanda installed on Fri Apr 8 19:02:27 2005)
- (Cron version -- $Id: crontab.c,v 2.13 1994/01/17 03:20:37 vixie Exp $)
- This is an example for a crontab entry for automated backup with amanda
- With these cron lines, Amanda will check that the correct tape is in
- the drive every weekday afternoon at 4pm (if it isn't, all the
- operators will get mail). At 12:45am that night the dumps will be run.
0 17 * * 1-5 /usr/sbin/amcheck -m DailySet1 5 22 * * 1-5 /usr/sbin/amdump DailySet1 0 07 * * 2-6 /bin/mt -f /dev/nst0 rewoffl