How To:Build a Test Environment With Virtual Tapes: Difference between revisions
Paul.bijnens (talk | contribs) mNo edit summary |
Paul.bijnens (talk | contribs) (label_new_tapes is handy + /var/lib instead of /home is more standard) |
||
Line 13: | Line 13: | ||
$ amadmin x version | grep CONFIG_DIR | $ amadmin x version | grep CONFIG_DIR | ||
CONFIG_DIR= | CONFIG_DIR=/etc/amanda | ||
$ cd | $ cd /etc/amanda | ||
$ mkdir test | $ mkdir test | ||
Line 28: | Line 28: | ||
tpchanger "chg-disk" # a virtual tape changer | tpchanger "chg-disk" # a virtual tape changer | ||
tapedev "file:/space/vtapes/test/slots" | tapedev "file:/space/vtapes/test/slots" | ||
changerfile "/ | changerfile "/var/lib/amanda/test/changerfile" | ||
labelstr "TEST-.*" | labelstr "TEST-.*" | ||
#label_new_tapes "TEST-%%" | |||
tapetype DVD_SIZED_DISK | tapetype DVD_SIZED_DISK | ||
logdir "/var/lib/amanda/test" | |||
infofile "/var/lib/amanda/test/curinfo" | |||
indexdir "/ | indexdir "/var/lib/amanda/test/index" | ||
tapelist "/ | tapelist "/var/lib/amanda/test/tapelist" | ||
holdingdisk hd1 { | holdingdisk hd1 { | ||
Line 64: | Line 65: | ||
# su - amanda | # su - amanda | ||
$ mkdir /space/amandahold/test | $ mkdir /space/amandahold/test | ||
$ mkdir | $ mkdir /var/lib/amanda/test | ||
$ touch /var/lib/amanda/test/tapelist | |||
$ | |||
And create the virtual tapes, making sure the dumpuser has access to the vtapes, but not everyone else on this server: | And create the virtual tapes, making sure the dumpuser has access to the vtapes, but not everyone else on this server: | ||
Line 96: | Line 95: | ||
$ amtape test reset | $ amtape test reset | ||
Since Amanda version 2.5.0 you can also add the parameter '''label_new_tapes''', which will | |||
automatically label any tape if needed -- very handy in this case (unless you want to test '''amlabel''' commands). | |||
Now create a small '''disklist''' file: | Now create a small '''disklist''' file: | ||
Line 114: | Line 116: | ||
For this, remove the contents of the status directories and also the virtual tapes. But do not remove the directories or files themselves. | For this, remove the contents of the status directories and also the virtual tapes. But do not remove the directories or files themselves. | ||
$ rm -rf /space/vtapes/test/slots/slot*/* | $ rm -rf /space/vtapes/test/slots/slot*/* | ||
$ rm -rf /space/amandahold/test/* | $ rm -rf /space/amandahold/test/* | ||
$ rm -rf /var/lib/amanda/test/* | |||
$ > /var/lib/amanda/test/tapelist | |||
And amlabel the tapes again as above. | And amlabel the tapes again as above. When using the '''label_new_tape''' parameter, Amanda will label them even automatically again. | ||
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. | 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 10:20, 22 January 2006
Here is a Quick Setup for a test configuration with a virtual tape changer, emulating tapes on disk.
For a more complete description of virtual tapes and their use, see File driver.
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=/etc/amanda $ cd /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 "/var/lib/amanda/test/changerfile" labelstr "TEST-.*" #label_new_tapes "TEST-%%" tapetype DVD_SIZED_DISK logdir "/var/lib/amanda/test" infofile "/var/lib/amanda/test/curinfo" indexdir "/var/lib/amanda/test/index" tapelist "/var/lib/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 DVD_SIZED_DISK { filemark 15 bytes length 4700m }
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 this is only a subdirectory of that directory.
Create some directories/files that we configured in amanda.conf:
# mkdir -p /space/amandahold # chown amanda:disk /space/amandahold # chmod 750 /space/amandahold # su - amanda $ mkdir /space/amandahold/test $ mkdir /var/lib/amanda/test $ touch /var/lib/amanda/test/tapelist
And create the virtual tapes, making sure the dumpuser has access to the vtapes, but not everyone else on this server:
# mkdir /space/vtapes # chown amanda:disk /space/vtapes # chmod 750 /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
Since Amanda version 2.5.0 you can also add the parameter label_new_tapes, which will automatically label any tape if needed -- very handy in this case (unless you want to test amlabel commands).
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.
$ rm -rf /space/vtapes/test/slots/slot*/* $ rm -rf /space/amandahold/test/* $ rm -rf /var/lib/amanda/test/* $ > /var/lib/amanda/test/tapelist
And amlabel the tapes again as above. When using the label_new_tape parameter, Amanda will label them even automatically again.
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.