Recovering Files

Configuration

We'll be using amrecover(8) to recover files from backup. Before we can recover files, a little more configuration is in order. Amrecover is technically a client tool, and contacts the server to "pull" the recovery down to the client. You'll recall this is the reverse of the backup situation, where the server contacts the client to ask for its data. As such, we'll need to configure the client to talk to the server. Put the following in /etc/amanda/amanda-client.conf:

index_server "localhost"
tapedev "changer"
auth "local"

There, that wasn't so bad.

Start the Recovery

Amrecover will recover into subdirectories of the current directory. It's good form to run amrecover in an empty directory, so (as root):

mkdir /tmp/test-recovery
cd /tmp/test-recovery

amrecover runs as root, since it's restoring files and permissions - something a non-root user can't do. It's time to start amrecover:

knuth ~ # amrecover MyConfig
Using index server from environment AMANDA_SERVER (knuth)
AMRECOVER Version 3.2.1. Contacting server on knuth ...
220 knuth AMANDA index server (3.2.1) ready.
Setting restore date to today (2011-01-01)
200 Working date set to 2011-01-01.
200 Config set to MyConfig.
501 Host knuth is not in your disklist.
Use the sethost command to choose a host to recover
amrecover> 

Amrecover tries to be useful and guess the hostname you want to restore. We used "localhost" instead of "knuth", so this guess didn't work out. That's OK, though! You just need to tell amrecover what host to use.

amrecover> sethost localhost
200 Dump host set to localhost.

and let's narrow in and recover the latest backup of 'groups':

amrecover> setdisk /etc
200 Disk set to /etc.
amrecover> add group
Added file /group

and extract the file

amrecover> extract
Extracting files using tape drive changer on host knuth.
The following tapes are needed: MyData01
Extracting files using tape drive changer on host knuth.
Load tape MyData01 now
Continue [?/Y/n/s/d]? Y
Restoring files into directory /root
All existing files in /root can be deleted
Continue [?/Y/n]? Y
./group

Hit control-d to exit amrecover, and there's your file:

knuth ~ # find .
.
./group

That's nice and easy, isn't it?

Although amrecover was designed for use by users, most Amanda admins only run amrecover on the Amanda server, and then transfer the recovered files into place using some other mechanism like scp or rsync.

For More Info

Have a look at How To:Recover Data for the basic guide to amrecover.

Last updated