Page last modified 18:30, 24 Apr 2006 by Ppragin?

Sample Amanda configuration using RAIT to mirror and a virtual tape drive

Table of contents
No headers

RAIT with only two drives, creates a perfect copy of the data: a mirror of your backup. Each of these mirrors is be handled by its own output driver: one of the mirrors can write to a real tape device, and the other mirror can write a virtual tape (vtape) using the "file" driver. The vtapes can be used for fast recovery, and the tapes can be stored offsite.

Together with the "chg-multi" changer, which is suitable for a whole range of applications, this setup requires these parameters in amanda.conf (the parameters dumpcycle, runspercycle and tapecycle should be adapted to your environment):

-bash-3.00$ cat amanda.conf
org "zmanda"             # your organization name for reports
mailto "root@localhost"          # space separated list of operators at your site
dumpcycle 1 week               # the number of days in the normal dump cycle
runspercycle 5                 # the number of amdump runs in dumpcycle days
                              # (4 weeks * 5 amdump runs per week -- just weekdays)
tapecycle 25 tapes             # the number of tapes in rotation
                              # 4 weeks (dumpcycle) times 5 tapes per week (just
                              # the weekdays) plus a few to handle errors that
                              # need amflush and so we do not overwrite the full
                              # backups performed at the beginning of the previous
                              # cycle
#runtapes 1                     # number of tapes to be used in a single run of amdump
tpchanger "chg-multi"           # the tape-changer glue script
#tapedev "file://var/lib/amanda/vtapes/rait" # the no-rewind tape device to be used
changerfile "/etc/amanda/rait/chg-multi-mirror.conf"
#changerdev "/dev/null"
tapetype DLT               # what kind of tape it is
#labelstr "^rait-[0-9][0-9]*$"    # label constraint regex: all tapes must match
dtimeout 1800                          # number of idle seconds before a dump is aborted.
ctimeout 30                            # maximum number of seconds that amcheck waits
                                      # for each client host
etimeout 300                           # number of seconds per filesystem for estimates.
includefile "./advanced.conf"
includefile "/etc/amanda/template.d/dumptypes"
includefile "/etc/amanda/template.d/tapetypes"


We create the file chg-multi-mirror.conf in the same directory, with these contents:

multieject 0
needeject 0
gravity 0
ejectdelay 0
statefile /etc/amanda/rait/changerstatus
firstslot 1
lastslot 5
slot 1 rait:{file:/var/lib/amanda/vtapes/rait/vtape1,tape:/dev/nst0}
slot 2 rait:{file:/var/lib/amanda/vtapes/rait/vtape2,tape:/dev/nst0}
slot 3 rait:{file:/var/lib/amanda/vtapes/rait/vtape3,tape:/dev/nst0}
slot 4 rait:{file:/var/lib/amanda/vtapes/rait/vtape4,tape:/dev/nst0}
slot 5 rait:{file:/var/lib/amanda/vtapes/rait/vtape5,tape:/dev/nst0}

We create a file disklist in the same directory, with the list of clients, and files systems you wish to backup :

-bash-3.00$ pwd
/etc/amanda/rait
-bash-3.00$ cat disklist
ppragin /boot comp-user-tar
ppragin /etc  comp-user-tar
vmclient /boot comp-user-tar
-bash-3.00$


This assumes we have only 1 tapedrive (/dev/nst0), which we need to manually change the tape each day.

RAIT with a real tape changer is not supported.

   * NOTE: this needs more clarification: what about chg-manual, and chg-rait? 

We create the 5 virtual tapes:

$ for i in 1 2 3 4 5; do mkdir -p /var/lib/amanda/vtapes/rait/vtape$i/data; done

We insert a tape in the physical tapedrive, and label the first tape. This will label both the virtual tape vtape1 and the tape in the physical drive identically:

-bash-3.00$ amlabel rait  RaitTape1  slot 1
labeling tape in slot 1 (rait:{file:/var/lib/amanda/vtapes/rait/vtape1,tape:/dev/nst0}):
rewinding, reading label, not an amanda tape (Read 0 bytes)
rewinding, writing label RaitTape1, checking label, done.
-bash-3.00$


Please run amcheck to verify that the configuration is valid:

-bash-3.00$ amcheck rait
Amanda Tape Server Host Check
-----------------------------
WARNING: tapedev is null:, dumps will be thrown away
NOTE: skipping tape checks
NOTE: host info dir /etc/amanda/rait/curinfo/ppragin does not exist
NOTE: it will be created on the next run.
NOTE: index dir /etc/amanda/rait/index/ppragin does not exist 
NOTE: it will be created on the next run.
NOTE: host info dir /etc/amanda/rait/curinfo/vmclient does not exist
NOTE: it will be created on the next run.
NOTE: index dir /etc/amanda/rait/index/vmclient does not exist
NOTE: it will be created on the next run.
Server check took 0.007 seconds
Amanda Backup Client Hosts Check
--------------------------------
Client check: 2 hosts checked in 0.199 seconds, 0 problems found
(brought to you by Amanda 2.5.0)
-bash-3.00$

You can now start a test backup using command amdump rait and then view the log file and the e-mail from amanda to see if there was any errors:

-ba-bash-3.00$ pwd
/etc/amanda/rait
-bash-3.00$ ls -lrt log.*
-rw-------  1 amandabackup disk  989 Apr 24 11:41 log.20060424114103.0
-rw-------  1 amandabackup disk  969 Apr 24 11:45 log.20060424114522.0
-rw-------  1 amandabackup disk  969 Apr 24 11:48 log.20060424114832.0
-rw-------  1 amandabackup disk 1187 Apr 24 12:05 log.20060424120432.0
-bash-3.00$ cat log.20060424120432.0
DISK planner ppragin /boot
DISK planner ppragin /etc
DISK planner vmclient /boot
START planner date 20060424120432
START driver date 20060424120432
INFO planner Adding new disk ppragin:/boot.
INFO planner Adding new disk ppragin:/etc.
INFO planner Adding new disk vmclient:/boot.
STATS driver startup time 0.060
FINISH planner date 20060424120432 time 0.700
START taper datestamp 20060424120432 label RaitTape1 tape 0
SUCCESS dumper ppragin /etc 20060424120432 0 [sec 35.845 kb 11165 kps 311.5 orig-kb 49800]
SUCCESS taper ppragin /etc 20060424120432 0 [sec 36.553 kb 11200 kps 306.4 {wr: writers 350 rdwait 0.351 wrwait 33.418 filemark 2.729}]
SUCCESS dumper vmclient /boot 20060424120432 0 [sec 19.244 kb 7251 kps 376.8 orig-kb 8500]
SUCCESS taper vmclient /boot 20060424120432 0 [sec 22.284 kb 7296 kps 327.4 {wr: writers 228 rdwait 0.000 wrwait 17.971 filemark 4.289}]
SUCCESS dumper ppragin /boot 20060424120432 0 [sec 2.350 kb 2922 kps 1243.2 orig-kb 3630]
SUCCESS taper ppragin /boot 20060424120432 0 [sec 5.062 kb 2976 kps 587.9 {wr: writers 93 rdwait 0.000 wrwait 3.224 filemark 1.833}]
INFO taper tape RaitTape1 kb 21472 fm 3 [OK]
FINISH driver date 20060424120432 time 81.084
-bash-3.00$


1.To restore from real tape drive using amrecover. Find the correct tape and insert in in to the tape drive. Login to the client as root and cd in to directory where you want to restore the files to, "bugs" is the backup server in this example:

bash-3.00# amrecover rait -t bugs -s bugs
AMRECOVER Version 2.5.0int13. Contacting server on bugs ...
220 bugs AMANDA index server (2.5.0) ready.
200 Access OK
Setting restore date to today (2006-04-24)
200 Working date set to 2006-04-24.
200 Config set to rait.
200 Dump host set to ppragin.
Trying disk / ...
Trying disk rootfs ...
Use the setdisk command to choose dump disk to recover
amrecover>
amrecover> settape bugs:/dev/nst0
Using tape "/dev/nst0" from server bugs.
amrecover> listdisk
200- List of disk for host ppragin
201- /boot
201- /etc
200 List of disk for host ppragin
amrecover> setdisk /boot
200 Disk set to /boot.
amrecover> ls
2006-04-24-12-04-32 vmlinuz-2.6.14-1.1656_lc1_FC4.root
2006-04-24-12-04-32 lost+found/
2006-04-24-12-04-32 initrd-2.6.14-1.1656_lc1_FC4.root.img
2006-04-24-12-04-32 grub/
2006-04-24-12-04-32 config-2.6.14-1.1656_lc1_FC4.root
2006-04-24-12-04-32 System.map-2.6.14-1.1656_lc1_FC4.root
2006-04-24-12-04-32 .
amrecover> add .
Added dir / at date 2006-04-24-12-04-32
amrecover> extract
Extracting files using tape drive /dev/nst0 on host bugs.
The following tapes are needed: RaitTape1
Restoring files into directory /restore
Continue [?/Y/n]? y
Extracting files using tape drive /dev/nst0 on host bugs.
Load tape RaitTape1 now
Continue [?/Y/n/s/t]? y
./
./grub/
./lost+found/
./System.map-2.6.14-1.1656_lc1_FC4.root
./config-2.6.14-1.1656_lc1_FC4.root
./initrd-2.6.14-1.1656_lc1_FC4.root.img
./vmlinuz-2.6.14-1.1656_lc1_FC4.root
./grub/device.map
./grub/e2fs_stage1_5
./grub/fat_stage1_5
./grub/ffs_stage1_5
./grub/grub.conf
./grub/iso9660_stage1_5
./grub/jfs_stage1_5
./grub/menu.lst
./grub/minix_stage1_5
./grub/reiserfs_stage1_5
./grub/splash.xpm.gz
./grub/stage1
./grub/stage2
./grub/ufs2_stage1_5
./grub/vstafs_stage1_5
./grub/xfs_stage1_5
amrecover> quit
200 Good bye.
bash-3.00# ls
config-2.6.14-1.1656_lc1_FC4.root      lost+found
grub                                   System.map-2.6.14-1.1656_lc1_FC4.root
initrd-2.6.14-1.1656_lc1_FC4.root.img  vmlinuz-2.6.14-1.1656_lc1_FC4.root
bash-3.00#

2. To restore from virtual tape drive using amrecover. Login to the client as root and cd in to directory where you want to restore the files to, "bugs" is the backup server in this example:

bash-3.00# amrecover rait -t bugs -s bugs
AMRECOVER Version 2.5.0int13. Contacting server on bugs ...
220 bugs AMANDA index server (2.5.0) ready.
200 Access OK
Setting restore date to today (2006-04-24)
200 Working date set to 2006-04-24.
200 Config set to rait.
200 Dump host set to ppragin.
Trying disk / ...
Trying disk rootfs ...
Use the setdisk command to choose dump disk to recover
amrecover>
amrecover> settape bugs:file:/var/lib/amanda/vtapes/rait/vtape1
Using tape "file:/var/lib/amanda/vtapes/rait/vtape1" from server bugs.
amrecover> listdisk
200- List of disk for host ppragin
201- /boot
201- /etc
200 List of disk for host ppragin
amrecover> setdisk /boot 
200 Disk set to /boot.
amrecover> ls
2006-04-24-12-04-32 vmlinuz-2.6.14-1.1656_lc1_FC4.root
2006-04-24-12-04-32 lost+found/
2006-04-24-12-04-32 initrd-2.6.14-1.1656_lc1_FC4.root.img
2006-04-24-12-04-32 grub/
2006-04-24-12-04-32 config-2.6.14-1.1656_lc1_FC4.root
2006-04-24-12-04-32 System.map-2.6.14-1.1656_lc1_FC4.root
2006-04-24-12-04-32 .
amrecover> add .
Added dir / at date 2006-04-24-12-04-32
amrecover> extract
Extracting files using tape drive file:/var/lib/amanda/vtapes/rait/vtape1 on host bugs.
The following tapes are needed: RaitTape1
Restoring files into directory /restore
Continue [?/Y/n]? y
Extracting files using tape drive file:/var/lib/amanda/vtapes/rait/vtape1 on host bugs.
Load tape RaitTape1 now
Continue [?/Y/n/s/t]? y
./
./grub/
./lost+found/
./System.map-2.6.14-1.1656_lc1_FC4.root
./config-2.6.14-1.1656_lc1_FC4.root
./initrd-2.6.14-1.1656_lc1_FC4.root.img
./vmlinuz-2.6.14-1.1656_lc1_FC4.root
./grub/device.map
./grub/e2fs_stage1_5
./grub/fat_stage1_5
./grub/ffs_stage1_5
./grub/grub.conf
./grub/iso9660_stage1_5
./grub/jfs_stage1_5
./grub/menu.lst
./grub/minix_stage1_5
./grub/reiserfs_stage1_5
./grub/splash.xpm.gz
./grub/stage1
./grub/stage2
./grub/ufs2_stage1_5
./grub/vstafs_stage1_5
./grub/xfs_stage1_5
amrecover> quit
200 Good bye.
bash-3.00# ls
config-2.6.14-1.1656_lc1_FC4.root      lost+found
grub                                   System.map-2.6.14-1.1656_lc1_FC4.root
initrd-2.6.14-1.1656_lc1_FC4.root.img  vmlinuz-2.6.14-1.1656_lc1_FC4.root
bash-3.00#