Installazione e configurazione Amanda su Debian Sarge
Installazione pacchetti
apt-get install amanda-client amanda-common amanda-server
Riavviare inetd:
sudo invoke-rc.d openbsd-inetd restart
Configurazione accessi
cat | sudo tee > /dev/null /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 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
}
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 160
define tapetype HP-DAT160 {
comment "HP StorageWorks DAT 160)"
length 78236 mbytes
filemark 4461 kbytes
speed 6272 kps
}
Mettere la definizione prima delle altre.
Definire ora che per questo job si intente usare questo tapetype.
In /etc/amanada/DailySet1/amamnda.conf:
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) / 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 / always-full server /bin always-full #nomeserver disco dumptype
In questo caso quando si eseguirà il Job DailiSet1, verrà backuppato il disco / utilizzando 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:
sudo -u backup touch /etc/amanda/DailySet1/tapelist
Etichettatura del nastro di backup manuale
sudo -u backup /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:
sudo cat /etc/amanda/DailySet1/tapelist 0 X-01-Manual reuse
Verifica della lettura della label
sudo -u backup /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:
sudo -u backup /usr/sbin/amlabel DailySet1 A-01-Monday ; sudo ammt -f /dev/nst0 rewoffl rewinding, reading label, not an amanda tape rewinding, writing label A-01-Monday, checking label, done.
Test configurazione
sudo -u backup /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)
Backup di test
Come utente backup lanciare il backup in background ed osservare il log:
sudo -u backup /usr/sbin/amdump DailySet1
tail -f /etc/amanda/DailySet1/amdump
Verifica del Backup
sudo amverify DailySet1 No tape changer... Tape device is /dev/nst0... System restore program not found: /sbin/restore System restore program not found: /sbin/xfsrestore Verify summary to all-alert@rvmgroup.it Defects file is /tmp/amanda/amverify.11888/defects amverify DailySet1 Fri Jun 3 14:08:41 CEST 2005 Using device /dev/nst0 Waiting for device to go ready... Rewinding... Processing label... Volume X-01-Manual, Date 20050603 Rewinding... Checked allserver._bin.20050603.0 End-of-Tape detected. Rewinding...
Modifica per configurazione definitiva
Impostare / nel disklist:
cat > /etc/amanda/DailySet1/disklist <<'EOFile' # File format is: # hostname diskdev dumptype # where the dumptypes are defined by you in amanda.conf. localhost / always-full #nomeserver disco dumptype EOFile
Testare la configurazione:
sudo -u backup /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/allserver/_: does not exist NOTE: index dir /var/lib/amanda/DailySet1/index/allserver/_: does not exist Server check took 0.253 seconds Amanda Backup Client Hosts Check -------------------------------- Client check: 1 host checked in 0.297 seconds, 0 problems found (brought to you by Amanda 2.4.4p3)
Impostazione per l'esecuzione Schedulata
La schedulazione avviene modifcando il crontab per l'utente backup.
Modifcare il file /etc/amanda/crontab.amanda
cat | sudo tee /etc/amanda/crontab.amanda > /dev/null <<'EOFile' # 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 # Testa per vedere se è inserito il nastro. In caso di errore # viene mandata una mail all'indirizo specificato in configurazione 5 22 * * 1-5 /usr/sbin/amdump DailySet1 # Lancia il backup DailySet1 0 07 * * 2-6 /usr/sbin/ammt -f /dev/st0 rewoffl # Espelle il nastro EOFile
Attivare il crontab:
sudo crontab -u backup /etc/amanda/crontab.amanda
Verificare l'attivazione:
sudo -u backup crontab -l # 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 # Testa per vedere se è inserito il nastro. In caso di errore # viene mandata una mail all'indirizo specificato in configurazione 5 22 * * 1-5 /usr/sbin/amdump DailySet1 # Lancia il backup DailySet1 0 07 * * 2-6 /usr/sbin/ammt -f /dev/st0 rewoffl # Espelle il nastro
Effettuare quanto prima una prova di restore.