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 0 tapes # the number of tapes after that a tape could be overwritten
# con 0 si può sovrascrivere qualsiasi nastro
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
- DUMPTYPE***
define dumptype always-full {
comment "Full dump of this filesystem always" program "GNUTAR" options no-compress, index priority high dumpcycle 0 maxcycle 0
}
FARLO ANCHE PER IL FILE DISKLIST
fire:/etc/amanda/DailySet1# vi disklist
- sample Amanda2 disklist file, derived from CS.UMD.EDU's disklist
- If your configuration is called, say, "DailySet1", then this file
- normally goes in /etc/amanda/DailySet1/disklist.
- File format is:
- hostname diskdev dumptype
- where the dumptypes are defined by you in amanda.conf.
- At our site, root partitions have a different dumptype because they
- are of lower priority; they don't contain user data, and don't change
- much from the department prototype. In a crunch, they can be left for
- last or skipped.
fire /dev/md0 always-full
- crosrv01 /dev/md0 always-full
- hostname hda2 comp-user
- A SPARCstation 1+
- salty sd0a comp-root
"disklist" 70L, 2059C written
POI FARE LABEL NASTRI:
fire:/etc/amanda/DailySet1# su backup -c "amlabel DailySet1 A-01-Monday" sh: line 1: amlabel: command not found fire:/etc/amanda/DailySet1# which amlable fire:/etc/amanda/DailySet1# which amlabel /usr/sbin/amlabel fire:/etc/amanda/DailySet1# su backup -c "/usr/sbin/amlabel DailySet1 A-01-Monday" amlabel: could not load tapelist "/etc/amanda/DailySet1/tapelist" fire:/etc/amanda/DailySet1# ackup -c "touch /etc/amanda/DailySet1/tapelist" -bash: ackup: command not found fire:/etc/amanda/DailySet1# su baackup -c "touch /etc/amanda/DailySet1/tapelist" Unknown id: baackup fire:/etc/amanda/DailySet1# su backup -c "touch /etc/amanda/DailySet1/tapelist" fire:/etc/amanda/DailySet1# ls total 24 drwxrwx--- 2 backup backup 4096 Mar 18 15:58 . drwxrwx--- 3 backup backup 4096 Mar 18 15:40 .. -rw-rw---- 1 backup backup 8259 Mar 18 15:48 amanda.conf -rw-rw---- 1 backup backup 2059 Mar 18 15:51 disklist -rw-r--r-- 1 backup backup 0 Mar 18 15:58 tapelist fire:/etc/amanda/DailySet1# su backup -c "/usr/sbin/amlabel DailySet1 A-01-Monday" rewinding, reading label, reading label: Input/output error rewinding, writing label A-01-Monday, checking label, done. fire:/etc/amanda/DailySet1# cat tapelist 0 A-01-Monday reuse fire:/etc/amanda/DailySet1# fire:/etc/amanda/DailySet1# su backup -c "/usr/sbin/amcheck" amcheck: Usage: amcheck [-M <username>] [-mawsclt] <conf> [host [disk]* ]* fire:/etc/amanda/DailySet1# su backup -c "/usr/sbin/amcheck DailySet1" Amanda Tape Server Host Check
NOTE: skipping tape-writable test Tape A-01-Monday 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/fire: does not exist Server check took 0.010 seconds
Amanda Backup Client Hosts Check
Client check: 1 host checked in 0.036 seconds, 0 problems found
(brought to you by Amanda 2.4.4p3) fire:/etc/amanda/DailySet1# su backup -c "/usr/sbin/amcheck DailySet1" Amanda Tape Server Host Check
NOTE: skipping tape-writable test Tape A-01-Monday 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/fire: does not exist Server check took 0.020 seconds
Amanda Backup Client Hosts Check
Client check: 1 host checked in 0.015 seconds, 0 problems found
(brought to you by Amanda 2.4.4p3) fire:/etc/amanda/DailySet1# su backup -c "/usr/sbin/amtape DailySet1 show" amtape: no tpchanger specified in "/etc/amanda/DailySet1/amanda.conf" fire:/etc/amanda/DailySet1# su backup -c "/usr/sbin/amcheck DailySet1" Amanda Tape Server Host Check
ERROR: /dev/nst0: tape_rdlabel: tape open: /dev/nst0: Input/output error
(expecting a new tape)
NOTE: skipping tape-writable test 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/fire: does not exist Server check took 120.110 seconds
Amanda Backup Client Hosts Check
Client check: 1 host checked in 0.017 seconds, 0 problems found
(brought to you by Amanda 2.4.4p3) fire:/etc/amanda/DailySet1# fire:/etc/amanda/DailySet1# su backup -c "/usr/sbin/amcheck DailySet1" Amanda Tape Server Host Check
ERROR: /dev/nst0: reading label: Input/output error
(expecting a new tape)
NOTE: skipping tape-writable test 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/fire: does not exist Server check took 0.007 seconds
Amanda Backup Client Hosts Check
Client check: 1 host checked in 0.023 seconds, 0 problems found
(brought to you by Amanda 2.4.4p3) fire:/etc/amanda/DailySet1# clear fire:/etc/amanda/DailySet1# su backup -c "/usr/sbin/amcheck DailySet1" Amanda Tape Server Host Check
ERROR: /dev/nst0: reading label: Input/output error
(expecting a new tape)
NOTE: skipping tape-writable test 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/fire: does not exist Server check took 0.018 seconds
Amanda Backup Client Hosts Check
Client check: 1 host checked in 0.015 seconds, 0 problems found
(brought to you by Amanda 2.4.4p3) fire:/etc/amanda/DailySet1# su backup -c "/usr/sbin/amlabel DailySet1 A-02-Tuesday" rewinding, reading label, reading label: Input/output error rewinding, writing label A-02-Tuesday, checking label, done. fire:/etc/amanda/DailySet1# su backup -c "/usr/sbin/amcheck DailySet1" fire:/etc/amanda/DailySet1# ammmt -f /dev/nst0 rewoffl -bash: ammmt: command not found fire:/etc/amanda/DailySet1# ammt -f /dev/nst0 rewoffl fire:/etc/amanda/DailySet1# su backup -c "/usr/sbin/amlabel DailySet1 A-03-Wednesday" ; ammt -f /dev/nst0 rewoffl rewinding, reading label, reading label: Input/output error rewinding, writing label A-03-Wednesday, checking label, done. fire:/etc/amanda/DailySet1# /etc/init.d/postfix restart Stopping mail transport agent: Postfix. Starting mail transport agent: Postfix. fire:/etc/amanda/DailySet1# su backup -c "/usr/sbin/amlabel DailySet1 A-03-Wednesday" ; ammt -f /dev/nst0 rewoffl
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