AMANDA – Restore – Getting your data back

While it is useful to be conscientious and change the back up tapes daily. These will be worthless unless you keep the tape drive clean and you periodically test your backups.

On the server you have been instructed to set up a cron job that will run the backups. On the server it is also useful running the AMANDA Index server which will allow you to access the AMANDA indexes to allow you to restore your data. This may be done by running the command chkconfig amidxtape on.

To start the recovery of your data you need to enter the command-line ftp style access to the AMANDA archives.

If your backup server has gone up in flames and all you are left without any Indexes, it is possible to search the tapes to discover what data is available. The command for this is amrestore, which will also restore your data once found. Check man amrestore for more options.. To search a tape issue the command: amrestore -p /dev/tape no-such-host > /dev/null . The results of the command will appear as follows:

amrestore -p /dev/tape no-such-host > /dev/null
amrestore: 0: skipping start of tape: date 20040720 label DailySet43
amrestore: 1: skipping
amrestore: 2: skipping
amrestore: 3: skipping
amrestore: 4: skipping
amrestore: 5: skipping
amrestore: 6: skipping
amrestore: 7: skipping
amrestore: 8: skipping
amrestore: 9: skipping
amrestore: 10: skipping
amrestore: 11: skipping
amrestore: 12: skipping
amrestore: 13: skipping
amrestore: 14: skipping
amrestore: 15: skipping
amrestore: 16: skipping
amrestore: 17: reached end of information

Once we have this information I may move to a directory that I want the data extracted to and then extract the data. The recommended commands for extracting the data from the man page did not work for me.

I use the following to for example extract the directory /raid/user2 from shown here as section 7 on the tape:

mt rewind;mt -f /dev/tape fsf 7;dd if=/dev/tape bs=32k skip=1 | gunzip | tar xvf –

So first we rewind the tape, we then fast forward to section 7 and read the tape to pipe to gunzip (most of my archives are zipped) and then to tar to extract them to the current directory.You could also try the following:

mt rewind; amrestore /dev/tape | tar xvf –

This ask for only the backups from and will drop the images from the tape in the current directory, called for example; this being partition /dev/hda1 from taken on the 12th December 2004. It is a third recursive dump and may not hold much data. You will then be able to extract the files manually using tar:

tar xvf