Professional Documents
Culture Documents
Abstract
Amanda is the most popular open source backup and recovery software in the
world because of its openness, robustness, functionality and scalability. Yet it is
very easy to set up and maintain in production. This article illustrates how, in
about 15 minutes, you can:
• Install and configure an Amanda backup server.
• Prepare three different client machines (SLES 11, Fedora 13, and
Windows XP) for backup.
• Set backup parameters.
• Verify the configuration.
• Verify backup and restore.
Revision: 1.4
Table of Contents
1 The Problem .................................................................................................................................3
2 The Challenge ..............................................................................................................................3
3 The Solution: Amanda .................................................................................................................3
3.1 Installation Prerequisites ......................................................................................................5
4 Installing the Amanda Backup Server .........................................................................................6
5 Installing the Amanda Clients ......................................................................................................7
5.1 Installing Amanda Client RPM on Iron (Fedora 13) ............................................................7
5.2 Installing Amanda Client RPM on Copper (SLES 11) ........................................................8
5.3 Installing Amanda Client on Uranium (Windows XP) ........................................................9
6 Configuring the Backup Server ...................................................................................................9
6.1 Configuring the Server .......................................................................................................10
6.2 Adding Client Iron (Fedora 13) ..........................................................................................11
6.3 Adding Client Copper (SLES 11) ......................................................................................11
6.4 Adding Client Uranium (Windows XP) .............................................................................12
7 Verification and Backup ............................................................................................................13
8 Recovery ....................................................................................................................................14
8.1 Recovery of Linux client (Copper) ....................................................................................14
8.2 Recovery of ZWC client (Uranium) ...................................................................................16
9 Conclusion .................................................................................................................................17
10 Request for Feedback ...............................................................................................................17
11 Glossary ...................................................................................................................................18
Page 2 of 18
1 The Problem
Today's businesses rarely run on just one operating system. Linux users and administrators often
have strong preferences for one distribution over another, web designers might lean towards the
Mac, and legacy software and hardware may require various UNIX operating systems. Yet,
despite the complexity of modern business computing environments, a system administrator is
expected to find a reliable backup solution.
Many enterprises expect users to keep important files on networked resources, both for sharing
and to back them up. Others expect to back up desktop machines and laptops. With the price of
hard disk storage continuously falling, today it is common to have terabytes of storage and
corresponding amounts of data that can be lost1. Furthermore, we live in a global and e-
commerce economy, where businesses run around the clock and crucial business data is
constantly changing. In this environment, it is more critical than ever to have a reliable backup
system in place.
2 The Challenge
For our 15-minute challenge, we want to backup two Linux systems (each running a different
Linux distribution) , and one Windows XP system. We use only freely available open source
software.
Our scenario is as follows:
The user Sunil works with sensitive information. We need to make a backup of his home
directory, /home/sunil, which resides on a Linux system called Iron, running Fedora 13. Our
webmaster needs to backup the /srv/www/htdocs/ directory on the webserver, Copper,
running SUSE Linux Enterprise Server 11 (SLES 11). Our manager works solely on a Windows
XP system called Uranium, and keeps all of his work in a folder called C:\Data.
Here is a summary of our configuration:
Client Filesystem OS Compression?
Copper /srv/www/htdocs/ SLES 11 Yes
Iron /home/sunil Fedora 13 Yes
Uranium C:\Data Windows XP Yes
The “Compression?” column refers to whether that client should compress the data rather than
the server (or even the tape drive).
1 "Data expands to fill the space available for storage" is a special case of Parkinson's Law which dates back
decades.
Page 3 of 18
standalone machine to hundreds of clients. Amanda is so thoroughly documented, from
community wikis to published system administration texts, that it might be hard to discern just
how easy an Amanda backup can be.
This article will show you how, in about 15 minutes, you can:
1. Install and configure the Amanda backup server.
2. Install and configure the three different clients for backup.
3. Set backup parameters.
4. Verify the configuration.
5. Perform a backup.
6. Recover some files from a backup.
We will install and configure Amanda backup server software on a machine running Red Hat
Enterprise Linux 5 named Quartz. The Amanda Server software manages the backup data, the
backup schedule, and stores the backups on media. We will install and configure Amanda backup
client software on Copper and on Iron. The Windows XP client, Uranium, will be backed up
using Zmanda Windows Client Community Edition (ZWC).
Page 4 of 18
• Less data to send over the network, so faster backups.
• Because of Amanda's parallelism, you don't have the backup server compressing several
dumps simultaneously, which relieves the backup server considerably.
On the other hand, compression on the client may use up resources (CPU and memory) on the
client. Depending on the relative resources of the client and server, it may be optimal to
compress on the server rather than the client.
Page 5 of 18
You can get free Amanda binary and source RPM packages, and source tarballs from
http://www.amanda.org/download.php. You can get the binary of Zmanda Windows Client
(ZWC) Community Edition for free from http://www.zmanda.com/download-amanda.php. Your
Linux distribution repositories may have amanda packages, but those may not be the most recent
and may not contain some of the utility scripts we show here. We recommend the most recent
version, so we will install those.
Download as follows:
1. The Amanda backup server RPM package onto Quartz.
2. The Amanda client RPM onto Iron and Copper. On Iron, if there is no RPM for Fedora
13, get that for 12.
3. The ZWC client onto Uranium.
Also note that this article assumes a fresh install of Amanda. If you have an existing Amanda
installation, additional steps are needed to ensure the proper upgrade to the latest Amanda release
(3.1.0 and later).
While this article shows using Amanda 3.1.0, we recommend the latest versions1. The latest
version of the Windows client may not agree exactly with the Linux server. Usually clients will
work just fine with an Amanda server version of similar version number. For additional details
about ZWC client installation please refer to the Amanda Wiki. The messages on your screen
will be similar to what we show below. To conserve paper and bandwidth, we have omitted a lot
of the installation output.
Note: You can install Amanda on a host that had a previous installation of Amanda. In that
event, you will see messages indicating that the user amandabackup already exists and that you
should check certain properties. This is generally not a problem.
Page 6 of 18
…
Need enterprise level support for Amanda? Upgrade to Amanda
Enterprise Edition: http://www.zmanda.com/amanda-enterprise-
edition.html
Jun 11 2010 16:15:23: === Amanda backup server installation
complete. ===
Amanda installation log can be found in
'/var/log/amanda/install.log' and errors (if any) in
'/var/log/amanda/install.err'.
Installed:
amanda-backup_server.i386 0:3.1.0-2.rhel5
Complete!
[root@quartz ~]#
3. As root set a password for user amandabackup on Quartz
[root@quartz]# passwd amandabackup
Changing password for user amandabackup.
New UNIX password:
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
4. Later, you may wish to back up Quartz or to recover files on Quartz. In fact later on we
will recover some data on Quartz. To recover on a Linux client, you must first specify
the tape device on the server to use. In each Linux clients we change the file
/etc/amanda/amanda-client.conf. Change this line:
tapedev "tape:/dev/YOUR-TAPE-DEVICE-HERE" # your tape device
to this:
tapedev "file://data/amanda/vtape/DailySet1" # your tape device
Page 7 of 18
…
Installed:
amanda-backup_client.i686 0:3.1.0-1.fc12
Dependency Installed:
xinetd.i686 2:2.3.14-30.fc13
Complete!
[root@iron ~]#
3. As root set password for user amandabackup on Iron
[root@iron]# passwd amandabackup
Changing password for user amandabackup.
New UNIX password:
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
4. To recover on a Linux client, you must first specify the tape device on the server to use.
In each Linux clients we change the file /etc/amanda/amanda-client.conf.
Change this line:
tapedev "tape:/dev/YOUR-TAPE-DEVICE-HERE" # your tape device
to this:
tapedev "file://data/amanda/vtape/DailySet1" # your tape device
Page 8 of 18
…
Need enterprise level support for Amanda? Upgrade to Amanda
Enterprise Edition: http://www.zmanda.com/amanda-enterprise-
edition.html
Jun 17 2010 14:48:43: Setting ownership and permissions for
'/var/lib/amanda/.profile'
Jun 17 2010 14:48:44: === Amanda backup client installation
complete. ===
Amanda installation log can be found in
'/var/log/amanda/install.log' and errors (if any) in
'/var/log/amanda/install.err'.
copper:~ #
4. As root set password for user amandabackup on Copper
copper:~ # passwd amandabackup
Changing password for amandabackup.
New Password:
Reenter New Password:
Password changed.
5. To recover on a Linux client, you must first specify the tape device on the server to use.
In each Linux clients we change the file /etc/amanda/amanda-client.conf.
Change this line:
tapedev "tape:/dev/YOUR-TAPE-DEVICE-HERE" # your tape device
to this:
tapedev "file://data/amanda/vtape/DailySet1" # your tape device
Page 9 of 18
6.1 Configuring the Server
We will specify a number of parameters on the command line. There is more on these in the wiki
and in the man page for amserverconfig. There are other options, but the defaults will do
just fine for now. There is a brief description of the parameters we set initially in the Glossary, on
page 18.
We will back up all our clients to Quartz in the /data directory. Ensure that we are logged-in
to Quartz as user root.
1. Create a directory for our vtapes, and set its ownership and permissions:
[root@quartz ~]# mkdir -p /data/amanda/vtape/DailySet1
[root@quartz ~]# chown amandabackup:disk
/data/amanda/vtape/DailySet1
[root@quartz ~]# chmod -R 750 /data/amanda/vtape/DailySet1
2. Change to the amandabackup user:
[root@quartz ~]# su – amandabackup
3. As amandabackup user, run amserverconfig to create a vtape configuration:
-sh-3.2$ amserverconfig DailySet1 --template harddisk --tapedev
/data/amanda/vtape/DailySet1 --mailto root@localhost --dumpcycle
1week --runspercycle 5 --tapecycle 12 --runtapes 1
Logging to /var/log/amanda/amserverconfig.20100621131218.debug
/etc/amanda/template.d directory created
/var/lib/amanda/gnutar-lists directory exists
/etc/amanda/DailySet1/advanced.conf created and updated
curinfo and index directory created
tapelist file created
disklist file created
Creating custom configuration using templates
custom amanda.conf created
creating vtape directory
amlabel vtapes
changer is reset
/var/lib/amanda/example/xinetd.amandaserver contains the latest
Amanda server daemon configuration.
Please merge it to /etc/xinetd.d/amandaserver.
/var/lib/amanda/.ssh/client_authorized_keys created. Please append
to /var/lib/amanda/.ssh/authorized_keys file on Amanda clients
DONE.
Note the creation of SSH keys, useful for backups over SSH. It is up to you to manually
(and securely) add the public key to the client amandabackup user's
authorized_keys file.
Page 10 of 18
6.2 Adding Client Iron (Fedora 13)
Use amaddclient to enable backups of client iron:
-sh-3.2$ amaddclient --config DailySet1 --client iron.example.com
--diskdev /home/sunil --dumptype comp-user-tar
Logging to /var/log/amanda/amaddclient.20100621133307.debug
/etc/amanda/DailySet1/disklist updated
updating /var/lib/amanda/.amandahosts on quartz.example.com
Attempting to update /var/lib/amanda/.amandahosts on
iron.example.com
.amandahosts 100% 76 0.1KB/s
00:00
.amandahosts.tmp 100% 112 0.1KB/s
00:00
iron.example.com:/var/lib/amanda/.amandahosts updated successfully
Creating amanda-client.conf for iron.example.com
Creating /etc/amanda/DailySet1 on iron.example.com
amanda-client.conf-iron.example.com 100% 380
0.4KB/s 00:00
Copy /var/lib/amanda/amanda-client.conf-iron.example.com to
iron.example.com successfully
File /var/lib/amanda/example/xinetd.amandaclient contains the latest
Amanda client daemon configuration.
Please merge it to /etc/xinetd.d/amandaclient.
Page 11 of 18
File /var/lib/amanda/example/xinetd.amandaclient contains the latest
Amanda client daemon configuration.
Please merge it to /etc/xinetd.d/amandaclient.
Page 12 of 18
Please copy /var/lib/amanda/amanda-client.conf-uranium.zmanda.com
to uranium.zmanda.com manually
File /var/lib/amanda/example/xinetd.amandaclient contains the latest
Amanda client daemon configuration.
Please merge it to /etc/xinetd.d/amandaclient.
Page 13 of 18
[amandabackup@quartz ~]$ amdump DailySet1
3. Once the backup run is complete, the root user should receive an e-mail with the backup
summary on the Amanda server.
4. We can now create a cron job for user amandabackup that will execute amdump and
initiate the backups automatically. Execute the crontab command to create the job:
[amandabackup@quartz ~]$ crontab –e
and add this line to the file to run backups daily Monday through Friday at 1 AM:
0 1 * * 1-5 /usr/sbin/amdump DailySet1
8 Recovery
Finally, we will perform a recovery of some of the data we have backed-up. This is a crucial step
– always verify a backup system to confirm that you can recover data.
The recovery procedure for windows client is different from that for a Linux client. ZWC
Community Edition does not yet support direct restore on a client. Instead, first restore data on
your Amanda server (or another client), and then copy it to the client.
Page 14 of 18
2010-06-22-14-14-31 apache_pb22_ani.gif
2010-06-22-14-14-31 apache_pb22.png
2010-06-22-14-14-31 apache_pb22.gif
2010-06-22-14-14-31 apache_pb.png
2010-06-22-14-14-31 apache_pb.gif
2010-06-22-14-14-31 .
amrecover> add *
Added file /robots.txt
Added file /index.html
Added file /favicon.ico
Added file /apache_pb22_ani.gif
Added file /apache_pb22.png
Added file /apache_pb22.gif
Added file /apache_pb.png
Added file /apache_pb.gif
amrecover> extract
./apache_pb.gif
./apache_pb.png
./apache_pb22.gif
./apache_pb22.png
./apache_pb22_ani.gif
./favicon.ico
./index.html
./robots.txt
amrecover> exit
200 Good bye.
Note that in the listing in amrecover, the dates are those of the backup, not necessarily
those of the underlying files.
3. We can now verify that the files have been recovered successfully by running tree,
find, ls -R, or any other suitable command.
copper:~/tmp/amanda # ll -R
total 40
drwxr-xr-x 2 root root 4096 2010-06-22 14:55 .
Page 15 of 18
drwxr-xr-x 3 root root 4096 2010-06-22 14:53 ..
-rw-r--r-- 1 root root 2205 2005-12-14 09:25 apache_pb22_ani.gif
-rw-r--r-- 1 root root 2410 2005-12-14 09:25 apache_pb22.gif
-rw-r--r-- 1 root root 1502 2005-12-14 09:25 apache_pb22.png
-rw-r--r-- 1 root root 2326 2004-11-20 13:16 apache_pb.gif
-rw-r--r-- 1 root root 1385 2004-11-20 13:16 apache_pb.png
-rw-r--r-- 1 root root 302 2008-07-23 10:08 favicon.ico
-rw-r--r-- 1 root root 44 2004-11-20 13:16 index.html
-rw-r--r-- 1 root root 26 2010-05-05 08:43 robots.txt
Page 16 of 18
-sh-3.2$ file uranium.C__Data.20100622141431.0
uranium.C__Data.20100622141431.0: Zip archive data, at least v2.0 to
extract
6. You can test the file locally.
-sh-3.2$ unzip -t uranium.C__Data.20100622141431.0
Archive: uranium.C__Data.20100622141431.0
testing: ZWCBackupInfo
error: invalid compressed data to inflate
testing: ZWC-Community-3.1.beta-32bit.zip OK
At least one error was detected in uranium.C__Data.20100622141431.0.
The error on ZWCBackupInfo is normal, and will not affect your ability to extract the
payload.
7. Move the file to the Windows system where you want to restore and extract the data
using Compressed Folders utility in Windows XP or programs such as Winzip or Pkzip.
Or you can extract it locally with unzip.
[root@quartz restore]# unzip uranium.C__Data.20100622141431.0
Archive: uranium.C__Data.20100622141431.0
skipping: ZWCBackupInfo volume label
inflating: ZWC-Community-3.1.beta-32bit.zip
Note the difference in the two recovery clients. amfetchddump recovers a complete dump as a
zip file while amrecover extracts files from the storage medium. Use amfetchdump where
you may have ownership or permissions issues. For example, we might use amfetchdump to
recover our Windows machines because Windows and Linux have different permissions
schemes.
Note also that Amanda uses operating system utilities (tar, dump, zip, etc.) to create the dumps;
this means you are not dependent on proprietary programs to recover your data.
Note well the implications for security: with proper (or improper!) access permissions, anyone
can recover data for any client on any other client.
9 Conclusion
As we have just seen, backing-up and restoring files with Amanda is incredibly easy. Setup is
also very quick. For more information, there is a wealth of documentation and examples
available on the Amanda Wiki. There is also a large community ready to respond to ideas and
requests for help on the Amanda Forums. As you explore the features and flexibility of Amanda,
you will find that there is much more power to be harnessed from building your backup and
recovery solution around Amanda.
Page 17 of 18
11 Glossary
DLE: Disk List Entry, the quantum unit of Amanda backup.
dumpcycle: The number of days in the backup cycle, whether you run backups on all of those
days or not. Each DLE will be backed up in its entirety at least once during this period.
Specify per DLE in amanda.conf.
dumptype: A definition of a dump. It specifies whether the client or server will compress or
encrypt the dump (and with which program), what exclusions to apply (e.g. excluding a
package cache under /var), and other characteristics.
holding disk: an intermediate storage area for caching backup data. Specify per DLE in
amanda.conf.
mailto: One or more email addresses to send reports to. Specify per DLE in amanda.conf.
runspercycle: How many dumps per cycle. In our example (see Section 6, Configuring the
Backup Server, on page 9), we have a dump cycle of a week, but only five runs per week.
Later, we will set this up as a cron job to run Monday through Friday (see Section 7,
Verification and Backup, on page 13). Specify per DLE in amanda.conf.
runtapes: The maximum number of tapes per a single run. You can span tapes (use multiple
tapes per run) with this parameter, but we are going to keep our calculations simple by
ignoring that capability. Specify per DLE in amanda.conf.
tapecycle: How many tapes we will have. With physical tapes, of course, a physical count is
the maximum. With virtual tapes, we can change this count on the fly according to disk
usage. We will run five dumps a week. With 12 tapes, we keep a week of old backups in
reserve, and still have two spares. The reserve week ensures that we always have at least
one full backup for each DLE on hand. Spares are more important for physical tapes, but
it's good practice to have them even with virtual tapes. Specify per DLE in
amanda.conf.
tapedev: The actual backup device. Normally this is a tape drive, e.g. /dev/st0; in this
case a directory we will build. Specify per DLE in amanda.conf.
template: Specify the type of backup medium, in this case virtual tapes on a hard drive.
Specify per DLE in amanda.conf.
Page 18 of 18