Sunteți pe pagina 1din 21

University of Virginia

Helali Bhuiyan

Amanda (Advanced Maryland Automatic Network Disk Archiver) Installation Guide


- Helali Bhuiyan
This document provides a step-by-step guide to install and test Amanda (Advanced Maryland Automatic Network Disk Archiver) on Linux machines. For test purposes, this document demonstrates how to setup virtual tapes instead of actual tape drives and execute the dump operation on these virtual tapes. Having average, and not expert level, knowledge of Linux I found that I needed additional guidance to install Amanda. Therefore, the purpose of this document is to provide other users information that I needed to successfully install Amanda. This document is created based on the Amanda installation guide and documentation, which can be found in the following two websites: 1. Amanda Homepage: 2. Amanda Wiki: http://www.amanda.org/docs/install.html http://wiki.zmanda.com/index.php/Quick_start

Both these websites contain almost the same content, but the wiki site provides better explanations. Therefore, I recommend the wiki site. In case of conflicts between the materials presented in this document and that presented on the Amanda websites, the websites are the authoritative sources of information. Users of this document are expected to know basic Linux commands. For example, creating/removing files/directories, changing the current directory, modifying access rights, etc. Some of the commands used to install Amanda require root access, while some require regular-user access. To distinguish between these two sets of commands, the root-privileged commands start with #, and regular-user invoked commands start with $ in the command prompt. For example, Command executed by root, # amrecover test Command executed by normal user, $ amdump test In this document, I described steps to install a server-side Amanda on mvstu2 machine, and a client-side Amanda on mvstu3 machine, which are located in our lab. As installing softwares in Linux machines are sometime dependent on the kernel version and the gcc version, I am providing these information below,

August 15, 2007

University of Virginia

Helali Bhuiyan

mvstu2: [amb6fp@mvstu2 ~]$ uname -a Linux mvstu2 2.6.20-1.2320.fc5 #1 Tue Jun 12 18:20:44 EDT 2007 i686 i686 i386 GNU/Linux [amb6fp@mvstu2 ~]$ gcc -v Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2.3/specs Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --enable-languages=c,c++,f77 --disable-libgcj --host=i386-redhat-linux Thread model: posix gcc version 3.2.3 20030502 (Red Hat Linux 3.2.3-56.fc5) mvstu3: [amb6fp@mvstu3 ~]$ uname -a Linux mvstu3 2.6.20-1.2312.fc5 #1 Tue Apr 10 14:53:08 EDT 2007 i686 i686 i386 GNU/Linux [amb6fp@mvstu3 ~]$ gcc -v Using built-in specs. Target: i386-redhat-linux Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-libgcj-multifile --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --with-cpu=generic --host=i386-redhat-linux Thread model: posix gcc version 4.1.1 20070105 (Red Hat 4.1.1-51)

1. Getting the source code:


You can download the Amanda source code from here: http://easynews.dl.sourceforge.net/sourceforge/amanda/amanda-2.5.2p1.tar.gz On a linux machine, you can execute the following command to download Amanda (version:2.5.2p1)

August 15, 2007

University of Virginia

Helali Bhuiyan

$ wget http://easynews.dl.sourceforge.net/sourceforge/amanda/ama nda-2.5.2p1.tar.gz Then unzip the downloaded file by executing the following command: $ tar xvzf amanda-2.5.2p1.tar.gz Now change your directory to this new unzipped Amanda source code directory: $ cd amanda-2.5.2p1

2. Compiling Amanda:
Before compiling Amanda, you should decide, under which user name Amanda will be run (usually this user is you or your username on that machine). Amanda is very strict about who runs what, and access rights. Some parts of Amanda can only be run by the selected user; others can only be run by the root. If a specific part of Amanda is supposed to be run by the selected user, you must not run that program as root or vice versa. Lets assume that the user name is amb6fp. You will also have to decide a group under which the Amanda programs will be run. I picked disk as the group, which has access to the disk in that machine. Now pick a configuration name. Amanda can have multiple configurations. I picked test as the configuration name. As a start, we will install the server part of Amanda on one of our machines mvstu2. So we have the following configurations so far: Username: amb6fp Group: disk Configuration name: test Machine: mvstu2 To compile Amanda, execute the following command within the Amanda source code directory under user amb6fp: $./configure -with-user=amb6fp -with-group=disk -with-config=test If you want to only install the client/server part of Amanda (which I did later for the client part of my installation), add -without-server or -without-client option to the end. Now build Amanda by, $ make

August 15, 2007

University of Virginia

Helali Bhuiyan

To install Amanda, you need to be the root. So switch to root account by (you will need to give the root account password after this), $ su root Now install Amanda by, # make install

3 Setting up the Tape Server:


Amanda is originally designed to backup data on tape-drives. As we do not have any tape-drive in any one of our machines, we will use the virtual tape-drive feature of Amanda. Amanda supports virtual tape-drive, where a hard-disk drive is configured as virtual tapes. To do this, we will follow the instructions from this link: http://wiki.zmanda.com/index.php/Test_environment_with_virtual_tapes First, we need to find out the configuration directory. Invoke the following command, # amadmin x version | grep CONFIG_DIR This should give the following output on default, CONFIG_DIR="/usr/local/etc/amanda" DEV_PREFIX="/dev/" This is the configuration directory for Amanda. Within this directory, we can have multiple configurations of Amanda. Now, we will create a configuration named test (the -with-config input). To do this, first, make a directory named test. # cd /usr/local/etc/amanda # mkdir test This will require you to have root access (note the # sign). So, switch to root account and create this directory. Then change the ownership to amb6fp and group disk. #chown amb6fp:disk /usr/local/etc/amanda/test/ Now get a copy of sample amanda.conf file. This file stores all the configuration parameters. You can get this sample from the Amanda source bundle (usually should be here: amanda-2.5.2p1/example). But you will have to make changes to this file to configure the virtual tapes. You will get details of these configuration parameter entries from the link above. Following are the minimum changes required to the configuration file, org "UVA" mailto "helai@virginia.edu" dumpcycle 7 runspercycle 5 tapecycle 5

August 15, 2007

University of Virginia

Helali Bhuiyan

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! avoids interfering with production runs } define tapetype DVD_SIZED_DISK { filemark 4 KB length 4482 MB } Based on these entries, now we need to create some directories/files. These should match with the entries in the amanda.conf file entries mentioned above. Some of these directory creations may require root privilege. But note that after creating them under the root account, we change the ownership to the Amanda user (amb6fp) and group disk. # mkdir -p /space/amandahold # chown amb6fp:disk /space/amandahold # chmod 750 /space/amandahold # su amb6fp $ mkdir /space/amandahold/test # mkdir /var/lib/amanda/test # chown amb6fp:disk /var/lib/amanda/test # chmod 750 /var/lib/amanda/test # su amb6fp $ touch /var/lib/amanda/test/tapelist

August 15, 2007

University of Virginia

Helali Bhuiyan

Now, we will create the virtual tapes, making sure the dumpuser amb6fp has access to the vtapes, but not everyone else on this server. # # # # $ $ $ $ mkdir /space/vtapes chown amb6fp:disk /space/vtapes chmod 750 /space/vtapes su amb6fp mkdir -p /space/vtapes/test/slots cd /space/vtapes/test/slots for i in 1 2 3 4 5; do mkdir slot$i; done ln -s slot1 data

The for loop above creates as many slots as you have specified in the tapecycle variable in the amanda.conf file. (Do not add a leading zero to the numbers.) Now a quick test to verify the virtual tape setup: $ ammt -f file:/space/vtapes/test/slots status If OK, the ammt command should give the following output, file:/space/vtapes/test/slots status: ONLINE Then label the tapes: $ for i in 1 2 3 4 5; do amlabel test TEST-$i slot $i; done This should give the following output, labeling tape in slot 1 (file:/space/vtapes/test/slots): rewinding, reading label, not an amanda tape (Read 0 bytes) rewinding, writing label TEST-1, checking label, done. labeling tape in slot 2 (file:/space/vtapes/test/slots): rewinding, reading label, not an amanda tape (Read 0 bytes) rewinding, writing label TEST-2, checking label, done. labeling tape in slot 3 (file:/space/vtapes/test/slots): rewinding, reading label, not an amanda tape (Read 0 bytes) rewinding, writing label TEST-3, checking label, done. labeling tape in slot 4 (file:/space/vtapes/test/slots): rewinding, reading label, not an amanda tape (Read 0 bytes) rewinding, writing label TEST-4, checking label, done. labeling tape in slot 5 (file:/space/vtapes/test/slots): rewinding, reading label, not an amanda tape (Read 0 bytes) rewinding, writing label TEST-5, checking label, done. And reset the changer to the first slot again: $ amtape test reset

August 15, 2007

University of Virginia

Helali Bhuiyan

This will give the following output, amtape: changer is reset, slot 1 is loaded. Thats the end of configuring the amanda.conf file. We will test this configuration later on, after doing some more setup given below.

4 Creating a disklist file:


The disklist file is the file that contains entries of clients and their specific directories, which will be backed up. Create the disklist file (the file name is also disklist) in the same directory where the amanda.conf is present (/usr/local/etc/amanda/test/). Now enter the client information into this file. Generally in Amanda, the server itself sometimes gets backed up. So the example in the website (http://wiki.zmanda.com/index.php/Test_environment_with_virtual_tapes) contains two entries, one for the server (which itself is a client) and one for the client. But remember, in principle both these entries are Amanda client. Lets assume that the machine we are working on is mvstu2 (hostname: mvstu2.ece.virginia.edu). So, we have installed an Amanda server on mvstu2 so far. Later, we will install a client on mvstu3 (hostname: mvstu3.ece.virginia.edu). So, we are not configuring mvstu2 as a client itself. Hence, put this only entry in the disklist file, mvstu3.ece.virginia.edu /home/amb6fp/amandatest comp-tar Here, mvstu3.ece.virginia.edu is the client machines fully-qualified name, /home/amb6fp/amandatest is the specific directory within mvstu3, which we want to backup, comp-tar is the dumping method.

5 Create .amandahosts file:


This step requires creating a file named .amandahosts (note the dot) inside the Amanda users home directory. In our example, this files full location should be, /home/amb6fp/.amandahosts Add the following two lines into this file, mvstu3.ece.virginia.edu amb6fp amdump mvstu3.ece.virginia.edu root amindexd amidxtaped These entries signifies that user amb6fp from mvstu3 is allowed to execute amdump on this machine (mvstu2). The second line means user root is permitted to execute the other two programs.

August 15, 2007

University of Virginia

Helali Bhuiyan

Amanda is very strict about permissions to this file. The .amandahosts file also needs strict permissions. They should be owned by the Amanda user (amb6fp) and not be readable or writeable by anyone else. Also, the home directory of the Amanda user (containing the .amandahosts file) should not be writeable by anyone else. So do the following to set up appropriate access rights: # chown amb6fp ~/.amandahosts # chmod 755 ~amb6fp # chmod 600 ~amb6fp/.amandahosts Later you can check the access rights to this file by executing, $ ls l .amandahosts This should give the following output, [amb6fp@mvstu2 ~]$ ls -l .amandahosts -rw------- 1 amb6fp amb6fp 87 Jul 25 16:43 .amandahosts

6 Adding Amanda service to the system:


Now we will add Amanda service to the operating system (OS). As Amanda is not run all the time, a daemon tool setup is needed. Whenever the scheduled time comes (we will also set this up later), the OS daemon (xinetd in this case) inside the server machine will invoke the Amanda daemon (amandad) on the server, which will in turn communicate with the xinetd daemon on the client machines (if we have multiple clients, which is normal). The xinetd daemon on the client will invoke the Amanda daemon within that client. Now both Amanda daemons on the server and the client are running. These Amanda daemons will now coordinate the transfer. To setup these daemons, we first need to add the Amanda service to the system. Adding Amanda service means adding the port number on which Amanda will listen for communication over TCP/UDP socket. To add this, add the following three lines to the file /etc/services amanda 10080/udp amandaidx 10082/tcp amidxtape 10083/tcp In most cases, there should be already these entries present on this file. In that case, you do not need to add these entries. Just open this file and check if they are there.

7 Configuring xinetd daemon:


Now we will configure the xinetd daemon, which is actually a super-server. It will listen to all the ports listed in the /etc/services file (so it will also listen to our

August 15, 2007

University of Virginia

Helali Bhuiyan

Amanda ports). In the website, they gave configuring options for other daemon tools like inetd. But we will use xinetd. So, ignore the other configurations for inetd or Dan Bernstein's daemontools. To configure xinetd, you first need to check if you have xinetd or not. You can check if xinetd is already running in your system by running, [amb6fp@mvstu2 ~]$ sudo service xinetd status xinetd (pid 2077) is running... This will give the output above. Note that I have used sudo access to run this command. You can also run this command under the root account. You will need to have sudo access/root privilege to check any services status. If xinetd is not installed, you can do that by, # yum install xinetd Then check again if xinetd is running. As we just installed xinetd, now we can just configure it to add the Amanda service, and restart the xinetd server. To add Amanda to xinetd, add the file amanda to the directory /etc/xinetd.d/. So the complete path to this file is /etc/xinetd.d/amanda. Now, add the following lines to this file, service amanda { socket_type = dgram protocol = udp wait = yes user = amb6fp group = disk groups = yes server = /usr/local/libexec/amandad server_args = -auth=bsd amdump amindexd amidxtaped disable = no } NOTE: You should note that in the website (http://wiki.zmanda.com/index.php/Configuring_bsd/bsdudp/bsdtcp_authentication), they give some examples. There is another parameter, only_from. This parameter means accept connections only from these hosts. For now, do not use it. It gave me problem. Now we will restart the xinetd server to take this new configuration file into effect. Do this by, [amb6fp@mvstu2 xinetd.d]$ sudo service xinetd reload Reloading configuration: [ OK ]

August 15, 2007

University of Virginia

Helali Bhuiyan

So we are done with the xinetd configuration.

8 Testing the configuration:


Now we will test the server configuration. To do this run the amcheck command. As the Amanda executables are not in your execution path by default, add the paths to your bash profile. To do this open the .bash_profile file from the home directory. Exact location would be /home/amb6fp/.bash_profile. Now add the two new paths /usr/local/sbin/ and /usr/local/libexec/ to the PATH variable. Now reload this new configuration by doing $ source .bash_profile In order to test the configuration, execute the following command $ amcheck test Here amcheck is the program name and test is the configuration name we are working on. NOTE: by default you will get the following error message, [amb6fp@mvstu2 ~]$ amcheck test bash: /usr/local/sbin/amcheck: Permission denied This happened because of the access rights for the amcheck program. To set the correct permission, do the following (go to the /usr/local/sbin directory first), [root@mvstu2 ~]# cd /usr/local/sbin/ [root@mvstu2 sbin]# chmod 6755 amcheck [root@mvstu2 sbin]# ls -l amcheck -rwsr-sr-x 1 root disk 53881 Jul 25 17:30 amcheck So you can see that we have set the SUID and SGID bit, which is necessary in this case (dont ask me why, thats how Amanda wants it to be). Now we test again, [amb6fp@mvstu2 sbin]$ amcheck test Amanda Tape Server Host Check ----------------------------ERROR: program /usr/local/libexec/planner: not executable ERROR: program /usr/local/libexec/dumper: not executable Holding disk /space/amandahold/test: 50169568 KB disk space available, using 50169568 KB slot 1: read label `TEST-1', date `X' NOTE: skipping tape-writable test Tape TEST-1 label ok

August 15, 2007

10

University of Virginia

Helali Bhuiyan

NOTE: conf info dir /var/lib/amanda/test/curinfo does not exist NOTE: it will be created on the next run. NOTE: index dir /var/lib/amanda/test/index does not exist NOTE: it will be created on the next run. Server check took 0.071 seconds Amanda Backup Client Hosts Check -------------------------------WARNING: mvstu3.ece.virginia.edu: selfcheck request failed: timeout waiting for ACK Client check: 1 host checked in 30.237 seconds, 1 problem found (brought to you by Amanda 2.5.2p1) As you can see, there are multiple errors. Pick one by one. ERROR: program /usr/local/libexec/planner: not executable ERROR: program /usr/local/libexec/dumper: not executable So we will make these two files executable and set appropriate access rights, [root@wuneng libexec]# chmod 4755 planner [root@wuneng libexec]# chmod 4755 dumper Now run the amcheck again to see how far we have corrected, [amb6fp@mvstu2 libexec]$ amcheck test Amanda Tape Server Host Check ----------------------------Holding disk /space/amandahold/test: 27947920 KB disk space available, using 27947920 KB slot 1: read label `TEST-1', date `X' NOTE: skipping tape-writable test Tape TEST-1 label ok NOTE: conf info dir /var/lib/amanda/test/curinfo does not exist NOTE: it will be created on the next run. NOTE: index dir /var/lib/amanda/test/index does not exist NOTE: it will be created on the next run. Server check took 0.118 seconds Amanda Backup Client Hosts Check -------------------------------WARNING: mvstu3.ece.virginia.edu: selfcheck request failed: timeout waiting for ACK

August 15, 2007

11

University of Virginia

Helali Bhuiyan

Client check: 1 host checked in 30.155 seconds, 1 problem found (brought to you by Amanda 2.5.2p1) As you can see, the first two errors are gone. But we have failed to test the client. That means the Amanda server cannot connect to the client. But this is normal as we did not install the client yet. So we will install a client now.

9 Install Amanda on Client:


To install a client on mvstu3, we will follow the similar procedure for the server, but we will add another parameter to install only client on the configure command, ./configure -with-user=amb6fp -with-group=disk -with-config=test -without-server Now install by running make and make install command (under root account) as we did before for the server.

10 Add amanda-client.conf file:


We will need to have a configuration file amanda-client.conf in the directory /usr/local/etc/amanda/. You can get a sample copy of this file from the source bundle amanda-2.5.2p1/example. Copy this amanda-client.conf file to the directory /usr/local/etc/amanda/. Make changes to add the server name, conf "test" # your config name index_server "mvstu2.ece.virginia.edu" # amindexd server tape_server "mvstu2.ece.virginia.edu" # amidxtaped server tapedev "file:/space/vtapes/test/slots" # tape device

11 Create .amandahosts file:


Now create a .amandahosts file on the home directory of the Amanda user (/home/amb6fp/.amandahosts) mvstu2.ece.virginia.edu amb6fp amdump mvstu2.ece.virginia.edu root amindexd amidxtaped Now change the access rights to this file just like the server case, # chown amb6fp ~/.amandahosts # chmod 755 ~amb6fp # chmod 600 ~amb6fp/.amandahosts

August 15, 2007

12

University of Virginia

Helali Bhuiyan

12 Create file /etc/amandates and chmod /etc/dumpdates:


Create an empty file /etc/amandates and make it owned by the Amanda user amb6fp. # touch /etc/amandates # chown amb6fp:disk /etc/amandates Make the file /etc/dumpdates writable by the Amanda user: # chmod 664 /etc/dumpdates # chgrp disk /etc/dumpdates where disk is the group, and the group that has read access to the raw disk devices.

13 Add Amanda to the /etc/services file.


This should be there by default just like the server case. If not, add them.

14 Configure the xinetd on client:


Configure xinetd on the client in a similar way. Install if not already present. Now add to the file /etc/xinetd.d/amanda the following service amanda { disable = no socket_type = dgram protocol = udp wait = yes user = amb6fp group = disk groups = yes server = /usr/local/libexec/amandad server_args = -auth=bsd amdump } Now reload/restart the xinetd server by, # service xinetd restart

15 Create the listed_incr_dir for gnutar


Create the following directory, making sure that Amanda user can write into it: # mkdir -p /usr/local/var/lib/amanda/gnutar-lists

August 15, 2007

13

University of Virginia

Helali Bhuiyan

# chown -R amb6fp:disk /usr/local/var/lib/amanda That is the end of the client configuration. Now we will test and resolve some problems.

16 Test
Run the amcheck command from the server machine (mvstu2). NOTE: Ensure that xinetd servers on both machines are running, and also any firewall is not blocking the traffic. If iptables is running, which is the firewall we use in our machines, you can check first if they are running by, # service iptables status If iptables is running (you will know by looking at the output of the previous command), you can either stop it for this test purpose (# service iptables stop), or add necessary rules to the iptables (that will allow traffic to the Amanda ports that we configured in the /etc/services file.). Now run the amcheck, [amb6fp@mvstu2 ~]$ amcheck test Amanda Tape Server Host Check ----------------------------Holding disk /space/amandahold/test: 27947884 KB disk space available, using 27947884 KB slot 1: read label `TEST-1', date `X' NOTE: skipping tape-writable test Tape TEST-1 label ok NOTE: conf info dir /var/lib/amanda/test/curinfo does not exist NOTE: it will be created on the next run. NOTE: index dir /var/lib/amanda/test/index does not exist NOTE: it will be created on the next run. Server check took 0.078 seconds Amanda Backup Client Hosts Check -------------------------------ERROR: NAK mvstu3.ece.virginia.edu: user amb6fp from 128.143.11.242 is not allowed to execute the service noop: Please add "amdump" to the line in /home/amb6fp/.amandahosts on the client Client check: 1 host checked in 0.204 seconds, 1 problem found

August 15, 2007

14

University of Virginia

Helali Bhuiyan

(brought to you by Amanda 2.5.2p1) As you can see that we have a new problem (ERROR at the bottom of this output). The solution to this problem is to change the .amandahosts file entries within the client machine (mvstu3). So, we will make the following changes in the .amandahosts file in mvstu3, 128.143.11.242 amb6fp amdump 128.143.11.242 root amindexd amidxtaped As you can see, I have changed the name of the server mvstu2.ece.virginia.edu to its corresponding IP address 128.143.11.242. I do not know the exact reason why Amanda gives this error, where we are supposed to write every address in url format (mvstu2.ece.virignia.edu). But in this case, unless we change the server name to its corresponding IP address, it does not work. Now run the amcheck again, [amb6fp@mvstu2 ~]$ amcheck test Amanda Tape Server Host Check ----------------------------Holding disk /space/amandahold/test: 27947884 KB disk space available, using 27947884 KB slot 1: read label `TEST-1', date `X' NOTE: skipping tape-writable test Tape TEST-1 label ok NOTE: conf info dir /var/lib/amanda/test/curinfo does not exist NOTE: it will be created on the next run. NOTE: index dir /var/lib/amanda/test/index does not exist NOTE: it will be created on the next run. Server check took 0.077 seconds Amanda Backup Client Hosts Check -------------------------------Client check: 1 host checked in 0.435 seconds, 0 problems found (brought to you by Amanda 2.5.2p1) So everything is OK now. We are done with the configuration successfully. Now we will do some actual dump.

August 15, 2007

15

University of Virginia

Helali Bhuiyan

17 Do the dump
Remember that in the disklist file inside the server, we said that we are going to dump the /home/amb6fp/amandatest directory from the client mvstu2. So you need to have this directory. If the directory is not there, make one and put some files in there for test, which we will dump on mvstu2, the server machine. Then we will do some recovery. To do the dump, run the following from the server machine. Remember, Amanda client does not dump the data; the server initiates the dump process (through the communication between the daemons). So run amdump from the mvstu2 machine, [amb6fp@mvstu2 ~]$ cd /var/lib/amanda/test/ [amb6fp@mvstu2 test]$ ls changerfile-access changerfile-clean changerfile-slot tapelist tapelist.amlabel [amb6fp@mvstu2 test]$ amdump test [amb6fp@mvstu2 test]$ ls amdump.1 changerfile-slot log.20070726225016.0 tapelist.amlabel changerfile-access curinfo oldlog tapelist.yesterday changerfile-clean index tapelist [amb6fp@mvstu2 test]$ In order to show that we actually dumped some data, I did something more than just running the amdump program. First, I showed the content of the /var/lib/amanda/test/ directory, which stores information related to each dump. As you can, there was no log file before the dump. Then I do the dump by running $ amdump test (amdump should be run under the Amanda user, not root). This command actually does the dump, fetches data from the client and writes them on the virtual tapes that we configured before. Then I showed the content of the directory again, and you can see that one log file and some other directories have been created. You should open the log file to see if everything went well. If everything went well, then you should see this in the log file, DISK planner mvstu3.ece.virginia.edu /home/amb6fp/amandatest START planner date 20070725192915 INFO planner Adding new disk mvstu3.ece.virginia.edu:/home/amb6fp/amandatest. START driver date 20070725192915 STATS driver hostname mvstu2 STATS driver startup time 0.032

August 15, 2007

16

University of Virginia

Helali Bhuiyan

START taper datestamp 20070725192915 label TEST-1 tape 0 FINISH planner date 20070725192915 time 0.429 SUCCESS dumper mvstu3.ece.virginia.edu /home/amb6fp/amandatest 20070725192915 0 [sec 1.060 kb 8474 kps 7992.7 orig-kb 12710] SUCCESS chunker mvstu3.ece.virginia.edu /home/amb6fp/amandatest 20070725192915 0 [sec 11.587 kb 8474 kps 734.1] STATS driver estimate mvstu3.ece.virginia.edu /home/amb6fp/amandatest 20070725192915 0 [sec 6 nkb 12742 ckb 6400 kps 1024] SUCCESS taper mvstu3.ece.virginia.edu /home/amb6fp/amandatest 20070725192915 0 [sec 0.059 kb 8480 kps 141392.2 {wr: writers 266 rdwait 0.013 wrwait 0.045 filemark 0.000}] INFO taper tape TEST-1 kb 8512 fm 1 [OK] FINISH driver date 20070725192915 time 13.089 NOTE: If the iptables firewall blocks traffic, then you may see this, DISK planner mvstu3.ece.virginia.edu /home/amb6fp/amandatest START planner date 20070725193103 INFO planner Adding new disk mvstu3.ece.virginia.edu:/home/amb6fp/amandatest. START driver date 20070725193103 STATS driver hostname mvstu2 STATS driver startup time 0.031 START taper datestamp 20070725193103 label TEST-1 tape 0 FINISH planner date 20070725193103 time 0.466 FAIL chunker mvstu3.ece.virginia.edu /home/amb6fp/amandatest 20070725193103 0 [cannot read header: got 0 instead of 32768] FAIL driver mvstu3.ece.virginia.edu /home/amb6fp/amandatest 20070725193103 0 [too many dumper retry: "[request failed: timeout waiting for ACK]"] FAIL chunker mvstu3.ece.virginia.edu /home/amb6fp/amandatest 20070725193103 0 [cannot read header: got 0 instead of 32768] INFO taper tape TEST-1 kb 0 fm 0 [OK] FINISH driver date 20070725193103 time 46.898 In that case, either stop the firewall, or configure the firewall to allow Amanda traffic.

August 15, 2007

17

University of Virginia

Helali Bhuiyan

18 Recover the data


To recover some data, we need to run the amrecover program from the client machine. Note that amrecover must be run under the root account. [root@mvstu3 amandatest]# amrecover test AMRECOVER Version 2.5.2p1. Contacting server on mvstu2.ece.virginia.edu ... NAK: user root from 128.143.11.243 is not allowed to execute the service amindexd: Please add "amindexd amidxtaped" to the line in /home/amb6fp/.amandahosts on the client As you can see, we have another problem. To solve this problem, edit the .amandahosts file within the server with the following, 128.143.11.243 amb6fp amdump 128.143.11.243 root amindexd amidxtaped This solution is similar to the problem we faced before. Change the machine names inside the .amandahosts file on the server machine with their respective IP addresses. Now run again the amrecover from the client under root account, NOTE: Run amrecover from within the directory you are going to recover. For example, as we dumped the /home/amb6fp/amandatest directory, run amrecover from this directory. Otherwise, recovery will not be successful. [root@mvstu3 amandatest]# amrecover test AMRECOVER Version 2.5.2p1. Contacting server mvstu2.ece.virginia.edu ... 220 mvstu2 AMANDA index server (2.5.2p1) ready. Setting restore date to today (2007-07-26) 200 Working date set to 2007-07-26. 200 Config set to test. 501 Host mvstu3 is not in your disklist. Use the sethost command to choose a host to recover amrecover>

on

As you can see, we have an ftp-like command prompt. We will use some commands to recover some data. Some useful commands are: help: lists all the available commands listhost: shows all the clients that are being dumped on this server listdisk: show all the directories of a certain client that are being dumped

August 15, 2007

18

University of Virginia

Helali Bhuiyan

sethost hostname: sets the hostname setdisk diskname: sets the disk (or directory) to do the recovery history: shows the dump history for a disk. History means on which date and time dumps were made. setdate: sets date of the dump add: adds a file to be extracted extract: extracts all the files that has been added to the list by the add command [root@mvstu3 amandatest]# amrecover test AMRECOVER Version 2.5.2p1. Contacting server on mvstu2.ece.virginia.edu ... 220 mvstu2 AMANDA index server (2.5.2p1) ready. Setting restore date to today (2007-07-26) 200 Working date set to 2007-07-26. 200 Config set to test. 501 Host mvstu3 is not in your disklist. Use the sethost command to choose a host to recover amrecover> listhost 200- List hosts for config test 201- mvstu3.ece.virginia.edu 200 List hosts for config test amrecover> sethost mvstu3.ece.virginia.edu 200 Dump host set to mvstu3.ece.virginia.edu. amrecover> listdisk 200- List of disk for host mvstu3.ece.virginia.edu 201- /home/amb6fp/amandatest 200 List of disk for host mvstu3.ece.virginia.edu amrecover> setdisk /home/amb6fp/amandatest 200 Disk set to /home/amb6fp/amandatest. amrecover> history 200Dump history for config "test" host "mvstu3.ece.virginia.edu" disk /home/amb6fp/amandatest 201- 2007-07-26-23-12-25 1 TEST-2:1 201- 2007-07-26-23-11-45 0 TEST-1:1 200 Dump history for config "test" host "mvstu3.ece.virginia.edu" disk /home/amb6fp/amandatest amrecover> setdate 2007-07-26-23-12-25 200 Working date set to 2007-07-26-23-12-25. amrecover> ls 2007-07-26-23-12-25 tracer/ 2007-07-26-23-12-25 nscode/ 2007-07-26-23-12-25 memtomem_old/ 2007-07-26-23-12-25 memtomem/ 2007-07-26-23-12-25 Server.java

August 15, 2007

19

University of Virginia

Helali Bhuiyan

2007-07-26-23-12-25 FileCreator.java 2007-07-26-23-12-25 Client.java 2007-07-26-23-12-25 CTCP-wad/ 2007-07-26-23-12-25 . amrecover> add Server.java Added file /Server.java amrecover> add Client.java Added file /Client.java amrecover> extract Extracting files using file:/space/vtapes/test/slots mvstu2.ece.virginia.edu. The following tapes are needed: TEST-2 tape on drive host

Restoring files into directory /home/amb6fp/amandatest Continue [?/Y/n]? y Extracting files using file:/space/vtapes/test/slots mvstu2.ece.virginia.edu. Load tape TEST-2 now Continue [?/Y/n/s/t]? y ./Client.java ./Server.java amrecover> quit 200 Good bye. tape on drive host

In the example above, we used some commands to see the host list, disk list, and files that were dumped on the server. First, we checked host names by running the listhost command. Then we set the host to mvstu3.ece.virginia.edu by using sethost command. Similarly, we set the disk that we want to recover. Then we use the history command to see the dump history, and later we select a specific date of dump by using the setdate command. To actually restore some files, we first add those files by using the add command. Later, when we are done with selecting which files to recover by using the add command, we use the extract command to finally restore the files. Later you can check your original directory to see if we really restored the data correctly.

19 Resetting the environment:


After doing some testing, you may want to reset the environment (clearing all the dumps, and start from the scratch). For this, remove the contents of the status directories and also the virtual tapes from the server machine (mvstu2). But do not

August 15, 2007

20

University of Virginia

Helali Bhuiyan

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. $ for i in 1 2 3 4 5; do amlabel test TEST-$i slot $i; done $ amtape test reset

20 Add crontab entries


Once you are done with all the testing, now you might want to do the dump operation on a regular basis. To do this, use the crontab. The crontab provides a way to do some job periodically based on scheduling rules. You can get enough information on crontab from the web. Just as an example, to add a new schedule to the crontab, do the following, $ crontab e This will open up a vi editor. Add the following line to it, 15 9 * * * /usr/local/sbin/amdump test This rule implies that the /usr/local/sbin/amdump test command will be automatically executed everyday at 9:15am. When you are doing production run by using the crontab entries, do not forget to remove the record no option from the amanda.conf file within the server, define dumptype comp-tar { program "GNUTAR" compress fast index yes record no # Important! avoids interfering with production runs. Remove it for production run } You should be done by now. If you face any problem while following this document, please consult the Amanda web pages that I provided at the beginning of this guide. Thanks.

August 15, 2007

21

S-ar putea să vă placă și