How To:Build a Test Environment With Virtual Tapes
Here is a Quick Setup for a test configuration with a virtual tape changer, emulating tapes on disk.
A test environment is very handy to experiment with the more obscure features of amanda, or get more familiar with all the possible options in amanda.conf and the dumptype options. And you can practice restores quickly.
Let's call the configuration "test".
First find out where the configuration directory is, and create a new config, as user amanda:
$ amadmin x version | grep CONFIG_DIR CONFIG_DIR=/usr/local/etc/amanda $ cd /usr/local/etc/amanda $ mkdir test
Copy a template amanda.conf file to the directory created, and adapt the parameters to your environment. Here are some values:
org "Acme Inc." mailto "[email protected]" dumpcycle 7 runspercycle 5 tapecycle 5 dumpuser "amanda" tpchanger "chg-disk" # a virtual tape changer tapedev "file:/space/vtapes/test/slots" changerfile "/home/amanda/test/changerfile" labelstr "TEST-.*" tapetype DISK infofile "/home/amanda/test/curinfo" logdir "/home/amanda/test/log" indexdir "/home/amanda/test/index" tapelist "/home/amanda/test/tapelist" holdingdisk hd1 { directory "/space/amandahold/test" } define dumptype comp-tar { program GNUTAR compress fast index yes record no # Important! avoid interfering with production runs } define tapetype DISK { filemark 15 bytes length 1g }
The above contains only the bare minimum. The idea of a test environment is just to add and change most of the values in amanda.conf.
Note: you may set "record yes" in the dumptype for those directories that are NOT used by any real Amanda config.
Create some directories/files that we configured in amanda.conf:
# mkdir -p /space/amandahold # su - amanda $ mkdir /space/amandahold/test $ mkdir -p /home/amanda/test/curinfo $ mkdir /home/amanda/test/log $ mkdir /home/amanda/test/index $ touch /home/amanda/test/tapelist
And create the virtual tapes:
# mkdir /space/vtapes # chown amanda:disk /space/vtapes # su - amanda $ mkdir -p /space/vtapes/test/slots $ cd /space/vtapes/test/slots $ for i in 1 2 3 4 5; do mkdir slot$1; done $ ln -s slot1 data
In the loop above: create as many slots as you have specified tapecycle in the amanda.conf. (Do not add a leading zero to the numbers.)
Quick test to verify the virtual tape setup:
$ ammt -f file:/space/vtapes/test/slots status
Then label the tapes:
$ for i in 1 2 3 4 5; do amlabel test TEST-$i slot $i; done
And reset the changer to the first slot again:
$ amtape test reset
Now create a small disklist file:
amandaserver.example.com /var/log comp-tar client1.example.com /var/log comp-tar
Run amcheck and solve all issues.
And you're ready for the first test run:
$ amdump test