Build a Basic Configuration

Let's jump right in. Presumably you have Amanda-3.2.0 or higher installed already!

Contents

Setup

First, make some directories. You'll need to know your Amanda user, probably "amandabackup" or "amanda" or "backup", depending on how you installed Amanda. We'll use "amandabackup" here to avoid ambiguity. As root:

mkdir -p /amanda /etc/amanda
chown amandabackup /amanda /etc/amanda

Use your Amanda username instead of 'amandabackup', if necessary. As the Amanda user:

mkdir -p /amanda/vtapes/slot{1,2,3,4}
mkdir -p /amanda/holding
mkdir -p /amanda/state/{curinfo,log,index}
mkdir -p /etc/amanda/MyConfig

All of the data will be under /amanda to stress that there is no system-specific place to put them. Of course, in the end, you can put them wherever you'd like!

Now, add an amanda.conf(5) file at /etc/amanda/MyConfig/amanda.conf with the following contents. Note that you should edit dumpuser appropriately if your Amanda user has another name.

org "MyConfig"
infofile "/amanda/state/curinfo"
logdir "/amanda/state/log"
indexdir "/amanda/state/index"
dumpuser "amandabackup"

tpchanger "chg-disk:/amanda/vtapes"
labelstr "MyData[0-9][0-9]"
autolabel "MyData%%" EMPTY VOLUME_ERROR
tapecycle 4
dumpcycle 3 days
amrecover_changer "changer"

tapetype "TEST-TAPE"
define tapetype TEST-TAPE {
  length 100 mbytes
  filemark 4 kbytes
}

define dumptype simple-gnutar-local {
    auth "local"
    compress none
    program "GNUTAR"
}

holdingdisk hd1 {
    directory "/amanda/holding"
    use 50 mbytes
    chunksize 1 mbyte
}

Next, add a disklist(5) with a single disk list entry (DLE). This is /etc/amanda/MyConfig/disklist:

localhost /etc simple-gnutar-local

That's it.

Check

Amanda has a nice utility called amcheck(8) which can check a configuration for you. Running it on the test configuration should give something like the following. Note that almost all Amanda commands take the configuration name ("MyConfig" in this case) as the first argument.

amanda@knuth ~ $ amcheck MyConfig
Amanda Tape Server Host Check
-----------------------------
NOTE: tapelist will be created on the next run.
Holding disk /amanda/holding: 868352 kB disk space available, using 51200 kB as requested
slot 1: contains an empty volume
Will write label 'MyData01' to new volume in slot 1.
NOTE: skipping tape-writable test
NOTE: host info dir /amanda/state/curinfo/localhost does not exist
NOTE: it will be created on the next run.
NOTE: index dir /amanda/state/index/localhost does not exist
NOTE: it will be created on the next run.
Server check took 0.276 seconds

Amanda Backup Client Hosts Check
--------------------------------
Client check: 1 host checked in 7.089 seconds.  0 problems found.

(brought to you by Amanda 3.2.1)

Oh Noes!

If something's gone wrong already, it's time to seek help. See the "Getting Help" section of user documentation for pointers. Be sure to let folks know that you're working on "Getting Started with Amanda", so they know what to expect. A few common errors:

  • Using an older version of Amanda. Amanda came a long way from 2.4.x or even 2.5.x to 3.2.x, and the older versions are just downright cranky and hard to use. Upgrade.

  • Permissions problems. If you've had a few different installs of Amanda, you may have several Amanda users, and your directories may be owned by several users. Sadly, the various operating system distributions do not at all agree on how Amanda should be built or installed, so things can get a bit chaotic. If at all possible, start over from a clean slate, and only install one copy of Amanda!

Test Run

The moment of truth is near. The tool to run backups is amdump(8). It takes only the configuration name, and it doesn't print anything to the terminal. It should be run as the Amanda user.

amdump MyConfig

how'd that go? Hard to tell from the terminal, although if it took a few seconds then you're probably in good shape. On the very next line, run

echo $?
0

if you see something other than zero, then the backup failed. In either case, you can see a handy report of what happened with amreport(8):

amanda@knuth ~ $ amreport MyConfig
Hostname: knuth
Org     : MyConfig
Config  : MyConfig
Date    : January 1, 2011

These dumps were to tape MyData01.
The next tape Amanda expects to use is: 1 new tape.


STATISTICS:
                          Total       Full      Incr.   Level:#
                        --------   --------   --------  --------
Estimate Time (hrs:min)     0:00
Run Time (hrs:min)          0:00
Dump Time (hrs:min)         0:00       0:00       0:00
Output Size (meg)            5.9        5.9        0.0
Original Size (meg)          5.9        5.9        0.0
Avg Compressed Size (%)    100.0      100.0        --
DLEs Dumped                    1          1          0
Avg Dump Rate (k/s)       1884.6     1884.6        --

Tape Time (hrs:min)         0:00       0:00       0:00
Tape Size (meg)              5.9        5.9        0.0
Tape Used (%)                5.9        5.9        0.0
DLEs Taped                     1          1          0
Parts Taped                    1          1          0
Avg Tp Write Rate (k/s)  60400.0    60400.0        --

USAGE BY TAPE:
  Label               Time         Size      %  DLEs Parts
  MyData01            0:00        6040k    5.9     1     1

NOTES:
  planner: Adding new disk localhost:/etc.
  taper: tape MyData01 kb 6040 fm 1 [OK]


DUMP SUMMARY:
                                       DUMPER STATS               TAPER STATS
HOSTNAME     DISK        L ORIG-kB  OUT-kB  COMP%  MMM:SS   KB/s MMM:SS    KB/s
-------------------------- ------------------------------------- --------------
localhost    /etc        0    6040    6040     --    0:03 1884.1   0:00 60400.0

(brought to you by Amanda version 3.2.1)

of course, your numbers may be different, but this gives you a good idea of the total time and space used, broken down by tape and by DLE.

Automating

Nobody wants to have to remember to run the backups every night. That's why we have cron! Add lines like

0 18 * * * amanda /usr/sbin/amcheck -m MyConfig
15 3 * * * amanda /usr/sbin/amdump MyConfig

to /etc/crontab. Again, depending on how you've installed Amanda, you may need to change /usr/sbin to something else. Use which amcheck on the command line to find out where your distro has put the Amanda tools.

Automation is no good if you never find out something is broken. Amcheck can email you for problems (that's the -m flag in the crontab), and amdump will happily email you a report every night. Just add a mailto configuration to your amanda.conf:

mailto "[email protected]"

Recovering

Recovering files is important, but let's defer that to a later article - Recovering Files.

Last updated