How To:Build a Test Environment With Virtual Tapes: Difference between revisions
Paul.bijnens (talk | contribs) No edit summary |
Paul.bijnens (talk | contribs) (resetting the environment) |
||
Line 80: | Line 80: | ||
$ ammt -f file:/space/vtapes/test/slots status | $ ammt -f file:/space/vtapes/test/slots status | ||
If OK, the ammt command should print "ONLINE". | |||
Then label the tapes: | Then label the tapes: | ||
Line 99: | Line 101: | ||
$ amdump test | $ amdump test | ||
== Resetting the environment == | |||
After some tests, you may want to start from scratch, removing all the garbage created while testing. | |||
For this, remove the contents of the status directories and also the virtual tapes. But do not remove the directories or files themselves. | |||
$ > /home/amanda/test/tapelist | |||
$ rm -rf /home/amanda/test/curinfo/* | |||
$ rm -rf /home/amanda/test/log/* | |||
$ rm -rf /home/amanda/test/index/* | |||
$ rm -rf /space/vtapes/test/slots/slot*/* | |||
$ rm -rf /space/amandahold/test/* | |||
And amlabel the tapes again as above. | |||
Hopefully, you have a made a safe copy of the "base" amanda.conf and disklist before starting the experiments, otherwise you'll have to walk through these files and inspect the values. |
Revision as of 17:38, 14 December 2005
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. It is ok to add "record yes" if the parent of a directory is part of another amanda config, but his is only a subdirectory of that directory.
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
If OK, the ammt command should print "ONLINE".
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
Resetting the environment
After some tests, you may want to start from scratch, removing all the garbage created while testing.
For this, remove the contents of the status directories and also the virtual tapes. But do not remove the directories or files themselves.
$ > /home/amanda/test/tapelist $ rm -rf /home/amanda/test/curinfo/* $ rm -rf /home/amanda/test/log/* $ rm -rf /home/amanda/test/index/* $ rm -rf /space/vtapes/test/slots/slot*/* $ rm -rf /space/amandahold/test/*
And amlabel the tapes again as above.
Hopefully, you have a made a safe copy of the "base" amanda.conf and disklist before starting the experiments, otherwise you'll have to walk through these files and inspect the values.