From RootdevWiki

Jump to: navigation, search

Contents

Amanda

The Amanda Client

The Amanda client enables the amanda server to backup files accross the network. This task assumes that you have sudo access and a logon to both the server and the new client computer.

Backups are indexed by the server to permit ready location and recovery of date-specified versions. Restoration is managed on client systems, and permits either interactive or filesystem wide recovery.

The last implementation of amanda I deployed failed to utilise some of the more advanced features of the software such as kerberised authentication. However, it successfully archived, indexed and recovered material from our unix servers. Pending activities included examining the functionality of amanda with samba, optimising network and tape transfer rates, optimising backup schedules, configuring amanda with xinetd and examining stronger authentication such as kerberos and ssh.

For additional amanda information visit the official amanda website: http://www.amanda.org/

Setting up an Amanda client

Note: the following steps are performed on the new client computer and not the server.

1. Make sure that the user amanda and group disk exist
2. You need to copy the source files from the fileserver.The current version we are using on the server and all the other boxes is 2.4.4p1 The source can be found at /filesrv/software/linux/amanda/amanda-2.4.4p1.tar.gz. Untar and unzip the source then cd into the amanda directory.
3. run : configure with the install options

./configure --with-user=amanda --with-group=disk --with-config=[[TapeDump]] \
--with-index-server=backup.server.com --with-tape-device=/dev/nst0 \
--with-gzip=/bin/gzip  --with-gnutar-listdir=/usr/local/etc/amanda/gnutar-lists 
\
 --with-amandahosts --with-buffered-dump --with-tmpdir=/var/log/amanda/debug

4. Type: make
5. Type: sudo make install

6. Create a .amandahosts file in amanda's home directory containing

backup.server.com 
amanda
backup amanda

7. Copy the following into /etc/xinetd.d/amanda

service amanda
{
        disable = no
        protocol = udp
        socket_type = dgram
        wait = yes
        user = amanda
        group = disk
        groups = yes
        server = /usr/local/libexec/amandad
        server_args = amandad
}   

8. Restart xinetd (or inetd if xinetd isnt installed)
9. Create the following directories :

 /var/log/amanda/debug
 /usr/local/etc/amanda/gnutar-lists

10. Create the following files:

 /etc/amandates
 /etc/dumpdates

11. Check that amanda can write to all these files and directories.
12. Check that the following entries are in /etc/services.

amanda   10080/udp

That's it for the client for the moment

Configuring the server

We need to tell the server to backup our new client.

1. Log on to the server
2. su to amanda
3. You need to edit a file called /usr/local/etc/amanda/{TapeDump|Friday}/disklist you should see something like this :

backup.company.com       /var            high-tar
backup.company.com       /       root-tar
backup.company.com       /boot   user-tar
backup.company.com       /home   user-tar
backup.company.com       /usr    user-tar
backup.company.com       /var/www        high-tar
backup.company.com       /cvs    user-tar

# Windows servers
backup.server.com       //Windows1.company.com/Sharing         user-tar
backup.server.com       //Windows2.company.com/E/Backups    user-tar

# Linux Servers
client1.company.com      /cvs    high-tar
client1.company.com      /var/chroot     high-tar
client1.company.com     /var/www/       high-tar

## fileserver disk currently mounted on client2
client2.company.com       /filesrv/manage     high-tar
client2.company.com       /filesrv/main       high-tar
client2.company.com       /filesrv/admin      high-tar
client2.company.com       /filesrv/templates  high-tar

# Mail / listserver
mail.company.com    /var    high-tar
mail.company.com    /etc    high-tar
mail.company.com    /usr/share      high-tar

# Project Server
project.company.com        /usr/local      high-tar
project.company.com        /var/www        high-tar

This is a list of servers that the server has clients on with instructions as to which partitions on that server need to be backed up. Hash out all the other server partitions in this file (whilst the new client is being tested) Decide what partitions need to be backup up on the new client and then add entries for them. Use the options root-tar for the root partition and user-tar for everything else.

4. Add an entry in /home/amanda/.amandahosts allowing the server to contact the client with root permissions (just copy the format for the other servers).

5. Test it to see if everything works.

[amanda@backup.company.com TapeDump]$ amcheck TapeDump

This will run the amcheck command to check that the configuration is ok. You will see a bunch of errors saying amanda can't find some files and directories.

6. Create the files/directories that amanda can't find (make sure that they are owned by amanda and belong to group disk). 7. Go through this process until amanda reports no more errors. 8. Re-edit the disklist file and uncomment all the machines you commented out earlier.

Thats it, the new client will be backed up with the other machines the next time the server runs its backup cycle (every weeknight).

Restoring Files from Backup

Running amrecover to restore data

  • Log in as root on the server you wish to restore data onto.
  • Make a directory in your home to temporarily copy the data into and call it something like restore.
    • Do not copy the data straight into the folder that you want to restore into.
cd /
/usr/local/sbin/amrecover -C TapeDump/Friday
  • To check out all the options in amrecover type ?. The ones you will probably need though are as follows:
  • Setdate to the day that the data was copied on to the tape. eg
> setdate 2006-01-11
  • lcd to the directory that you created earlier to restore the data into. ie
> lcd /home/user/restore
  • lpwd will show you the local present working directory. This is the one on the local file system.
  • Setdisk to the partition that you want to restore from. eg
> setdisk /www
  • ls will show you all the directories at your level in the partition on the tape.
  • cd to move around the directories on the tape.
  • When you have found the data that you want to restore, add it to the extraction list.
> add file.blarg (note: you can add both files or directories).
  • If you make a mistake you can use clear to clear the extraction list.
  • Type extract when you are ready. This will restore the data from the tape into the directory that you specified.
  • The program will ask you to confirm the location to restore into and tell you to load the correct tape (check out the identifying the right tape section). Check the right tape is in the drive and type y
  • Amanda will now begin the lengthy task of finding the right place on the tape and restoring the data. Note: this can take up to half an hour.
  • Don't forget to take the tape out of the drive, turn the write protection off and put in the correct tape in for the evening backup.
  • Finally quit the program and copy the files that you restored into the correct location.
> quit