Assumptions

Up
  • Debian Lenny
  • Amanda 2.5.2
  • disks representing tapes in one of two ways:
    • vtapes (take tapes on disk)
    • external disks, each representing a "tape", in a usb cradle "tape drive"
  • amandahosts authentication (ssh auth is a future project)
  • using gnutar for the dump program
  • You don't want to put regularly-written files like the index files or the tapelist in /etc/
  • You have installed the amanda-server and amanda-client packages on the backup server and the amanda-client package on the backup clients. Also with amanda-client on the server, if you can back up the backup server.
  • You have not done any configuration yet.
Note 1: If you want amrecover to work properly, install amanda-client on the server. Otherwise, amrecover will not be able to talk to the server. I think amrecover on the client wants to talk to amandad on the server, but amandad is in the amanda-client package.

Overview

Up

amanda's footprint on Linux filesystem

Configure Server:

Up

edit server config: /etc/amanda/daily1/amanda.conf

  • Keep the rest of the stuff in amanda.conf, and change the following to suit your environment and organization.
            org "linuxbutler"
            mailto "root"
            dumpuser "backup"
    
            dumpcycle 1 week
            runspercycle 7
            tapecycle 10 tapes #at least one more than dumpcycle days
            runtapes 1
    
            # for vtapes;
            tpchanger "chg-disk"
            tapedev "file:/srv/amanda/daily1/vtapes/slots"
            changerfile "/var/lib/amanda/daily1/changer-status"
            changerdev "/dev/null"
    
            # for removable-disk-pretending-to-be-tape
            # don't define tpchanger
            tapedev "file:/srv/amanda/daily1/vtapes/slot"
            # don't define changerfile
            # don't define changerdev
    
            tapetype HARD-DISK
    
            labelstr "^daily1-[0-9][0-9]*$"
    
            holdingdisk hd1 {
            comment "main holding disk"
    
            # where the holding disk is
            directory "/srv/amanda/daily1/holding"
    
    
            # how much space can we use on it
            # a non-positive value means:  use all space but that value
            use -100 Mb
    
            # size of chunk if you want big dump to be
            # dumped on multiple files on holding disks
            #  N Kb/Mb/Gb split images in chunks of size N
            #             The maximum value should be
            #             (MAX_FILE_SIZE - 1Mb)
            #  0          same as INT_MAX bytes
            chunksize 1Gb
            }
    
            infofile "/var/lib/amanda/daily1/curinfo" # it's a directory
            logdir "/var/log/amanda/daily1"
            indexdir "/var/lib/amanda/daily1/index"
            tapelist "/var/lib/amanda/daily1/tapelist"
    
            define tapetype HARD-DISK {
            comment "Dump onto hard disk (vtape)"
            length 32768 mbytes
            }
          

make files and dirs: config/operations

  • Decide on name for config: suggestions daily1 or normal
  • Then:
            sudo -u backup mkdir /etc/amanda/daily1
            sudo -u backup cp /usr/share/doc/amanda-common/examples/amanda.conf  /etc/amanda/daily1
            sudo -u backup cp /usr/share/doc/amanda-common/examples/disklist /etc/amanda/daily1
            sudo -u backup mkdir -p /var/log/amanda/daily1
            sudo -u backup touch /var/lib/amanda/daily1/tapelist
        
  • You may have to adjust permissions. I will check this next time I do a full amanda install.

make files and dirs: data

Holding disk and "tape" areas - ensure that only the backup user can read/write these.

  • Some shell code to create the holding disk
            sudo mkdir /srv/amanda
            sudo chown backup.backup /srv/amanda
            sudo -u backup mkdir -p /srv/amanda/daily1/holding
          

Tape Setup

for vtape setup

  • vtapes (fake tape changer, using disk space for the tapes - no need to physically rearrange the "tapes"). In amanda.conf:
            tpchanger "chg-disk"
            tapedev "file:/srv/amanda/daily1/vtapes/slots"
          
    In the shell, do the following to set it up:
            for ii in `seq 1 10`; do
              sudo -u backup mkdir -p /srv/amanda/daily1/vtapes/slots/slot$ii
              sudo -u backup amlabel daily1 daily1-$ii slot $ii
            done
            sudo -u backup touch /srv/amanda/daily1/vtapes/slots/info
            sudo -u backup ln -s /srv/amanda/daily1/vtapes/slots/slot1 /srv/amanda/daily1/vtapes/slots/data
          

As each tape is labeled, it will appear in the tapelist file (in /var/lib/amanda/daily1/tapelist).

for removable hard disk

  • "hard disk pretending to be a tape in a usb cradle". Don't try to use a USB 1.1 connection - it's too slow. USB high speed works well for us (in the range of several GB to 120 GB backed up daily) and takes a few hours to write to the USB disk. In amanda.conf:
            # tpchanger ""
            tapedev "file:/srv/amanda/daily1/vtapes/slot"
          
    In the shell, do the following to set it up:
            sudo -u backup mkdir -p /srv/amanda/daily1/vtapes/slot
            # for each "tape" - put it in tape drive (ie, mount it on "slot") and ...
            sudo -u backup mkdir /srv/amanda/daily1/vtapes/slot/data
            sudo -u backup touch /srv/amanda/daily1/vtapes/slot/info
            sudo -u backup amlabel daily1 daily1-xx 
          

networking config: allow client to talk to server (amrecover)

  • server /etc/amandahosts (which is linked to from /var/backups/.amandahosts)
            client1.fqdn root amindexd amidxtaped
            client2.fqdn root amindexd amidxtaped
          

/etc/amandahosts should be owned by backup.backup

disklist

The disklist is on the server, and contains a list of hosts/partitions-or-directories/dumptypes to be backed up.

  • /etc/amanda/daily1/disklist
  • Can list by disk device "sda1" or directory (when using tar instead of dump)
  • Can use gnutar "include" and "exclude" lists
  • Specify "dumptype" (which are defined in amanda.conf) - compression, includes/excludes, other parameters
  • ... specific syntax ... host.fqdn disk-or-dir dumptype
  • can you put comments in an exclude file?

I recommend leaving host/disk specific includes/excludes in disklist - more generic excludes (shared between machines) can go in dumptype definition for re-use. example exclude file for root dir of linux systems:

  •         /proc
            /sys
            /tmp
            /dev/shm
            /var/lock
            /var/run
            /lib/modules/*/volatile
            /lib/init/rw
            /dev ???
          

cron

server: user backup

Example crontab for user backup on server.

    16 16 * * * /usr/sbin/amcheck -m daily1
    45 2 * * * /usr/sbin/amdump daily1
  

client: root

If you have a database, you might like to dump it to disk in a format that tar can package up neatly, before the backup is scheduled to start. Here's an example for postgres. Add to root users's cron:

    30 2 * * * sudo -u postgres /usr/bin/pg_dumpall -f /root/backup_pg/pg_dump.sql
  

after creating /root/backup_pg and restricting access to /root/backup_pg. This runs as root (and has to sudo to postgres) so it can write to roots home directory (as the backup contents are potentially confidential). I actually have a script that erases the old pg_dumpall, re-creates it with proper permissions, before calling pg_dumpall, that I call instead of this direct call to pg_dumpall.

Configure email

exim

Ensure email can be delivered to where you will read it. dpkg-reconfigure exim4-config

Configure Client

Up

make files and dirs

  •         sudo -u backup mkdir /etc/amanda # if it's not already there
            sudo -u backup cp /usr/share/doc/amanda-cmmon/examples/amanda-client.conf /etc/amanda/
          

config

  • /etc/amanda/amanda-client.conf
            conf "daily1"
    
            index_server "server.fqdn"
            tape_server "server.fqdn"
            tapedev "same_string_as_for_tapedev_in_server_amanda.conf"
    
            auth "bsd"
        

networking config: allow server to talk to client (amdump)

  • client /etc/amandahosts
            server.fqdn backup amdump
        

/etc/amandahosts should be owned by backup.backup.

there should already exist:

  •         /var/log/amanda/amandad
            /var/log/amanda/server
            /var/log/amanda/client
          

exclude lists(from dumptypes): /var/lib/amanda/exclude.gtar

    exclude files or lists (from disklist):
    use exclude file ... so it is visible right in disklist

    - can specify exclude file multiple times
    need "append" keyword to accumulate
    it uses it by putting each pattern in a file and using
    gnutar's --exclude-from option on that file
  

Operations

Up
  • Tape management
    • amrmtape daily1 daily1-4
    • amlabel daily1 [-f] daily1-4 Use the -f if you're purposely relabeling a tape that has already been labeled.
    • amadmin daily1 no-reuse daily1-4
    • amflush daily1 If the dumps didn't all get copied from the holding disk to the tapes
    • amadmin daily1 tape
  • Status
    • amoverview daily1
    • amstatus daily1
    • amcheck daily1
  • Data recovery
    • from client
      • amrecover Don't have to give conf if it is specified in amanda-client.conf
    • from server
      • amadmin daily1 find, then
      • amrestore daily1

Later

Up
  • change amanda conf to use ssh key authentication

Problems

Problem with ssh key authentication

If you get a "selfcheck request failed: EOF on read from " client, it might be because the server's known_hosts doesn't contain an entry with a name that matches the name in the disklist file.

Amanda Tape Server Host Check                                    
-----------------------------                                    
Holding disk /srv/amanda/daily1/holding: 357410564 KB disk space available, using 357308164 KB
slot 9: read label `daily1-9', date `20091031024502'                                          
NOTE: skipping tape-writable test                                                             
Tape daily1-9 label ok                                                                        
Server check took 0.049 seconds                                                               
Host key verification failed.                                                                 

Amanda Backup Client Hosts Check
--------------------------------
WARNING: blueeyes.stuffed.animals: selfcheck request failed: EOF on read from blueeyes.stuffed.animals
Client check: 3 hosts checked in 1.088 seconds, 1 problem found                                       

        

To fix this, su to be the backup user on the server, and run the ssh command to ssh to the client using the client name that is listed in the disklist. So if the client is named as client.fqdn.net in the disklist, then from the server give the command ssh client.fqdn.net. If the client is named as client in the disklist, give the command ssh client. Once that is done, amcheck should work.

Questions

Up

How to read amanda docs in /usr/share/doc/amanda-common/docs It has a Makefile.am and a Makefile.in.gz, but no configure.ac. Supposedly it has a pdf output ... (and ps and html and info and dvi) Might have to download full sources and build it that way. Ugh. The documentation seems to be a text dump of some web site. There is no markup and no hyperlinking in the text (although you can see it should be there) - even in the amanda sources. Ugh.

combining include and exclude

Can you put exclude or include clauses in dumptypes in parent-child relationships?

Can you combine exclude list and exclude file?