How To:Do a Bare Metal Restore

From The Open Source Backup Wiki (Amanda, MySQL Backup, BackupPC)
Jump to navigationJump to search

The purpose of this wiki page is to give users a fairly easy step by step process to do a bare metal restore of an Amanda client. This could be particularly useful should the replacement client be of a different Linux OS that does not appear to be immediately compatible to the version of Amanda due to dependencies, or perhaps a windows client. I have developed this from my own off site backup system designed to rebuild in a crisis.

To use this guide you should have basic shell skills, understand the scp utility, and have your amanda server up and running on the network with data to restore.

Restoring Data on the Amanda Server:

The two Amanda utilities we are going to use are amadmin and amfetchdump. In each case you must log in as amandabackup as a user. Additionally, it’s wise to create a default directory, named something like ‘restore’ to do your backup restoration from.

1)Find the most recent backup for the drive you want to restore.

Syntax - amadmin <backup config>  <host>  <disklist>
 Ex: amadmin dailybackup client netdrive
 Warning: no log files found for tape dailybackup-2 written 2010-03-26 13:00:03
 Warning: no log files found for tape dailybackup-2 written 2010-03-26 13:00:03
 date      host   disk                 lv tape or file   file part                 status                                                                                                               
 2010-02-12 12:00:02 client /netdrive   1 dailybackup-9    1  1/1   OK                                                                                                                       
 2010-03-04 13:00:03 client /netdrive   0 dailybackup-3    1  1/1 OK                                                                                                                              
 2010-03-04 17:44:14 client /netdrive/user 0 dailybackup-4    5  1/1 OK                                                                                                                               
 2010-03-05 10:44:32 client /netdrive/user  1 dailybackup-5    5  1/1   OK                                                                                                                               
 2010-03-15 13:00:03 client /netdrive/user  0 dailybackup-6    5  1/1 OK                                                                                                                               
 ………………….etc

2)Choose the backup that you require, based on what you see listed. If you see a zero it is a total backup, and if you see a 1, it is incremental. For a bare metal restore it would be best to choose a total backup. At this point, you should change to your recovery directory set up before, if you haven’t already.

 Syntax -amfetchdump <Backup conf>  <host> <disklist> <YYYYMMDDHHMMSS>
 Ex:  amfetchdump dailybackup client /netdrive/data 20100305104432
 amfetchdump: slot 5: time 20100305104432 label dailybackup-5 (exact label match)
 Scanning volume dailybackup-5 (slot 5)
 amfetchdump: 2: restoring FILE: date 20100305104432 host client disk /netdrive/data lev 0 comp .gz program /bin/tar

4)Check the directory with the list command, and you should see a file that looks like this:

 client._netdrive_data.20100305104432.0  

Again, the 0 represents that it is a total backup. This is also a tarball, so using the tar command will extract it

5)Provided the new system is set and ready to go, you can now either copy the file onto a USB stick, or scp the file over to the machine being rebuilt. If the tar is large a USB copy would probably be faster. Should you choose to scp, simply use the command:

 scp <file> <user@newserver:/directory/to/restore>
 scp  client._netdrive_data.20100305104432.0 user@newserver:/directory-to-restore/

6)Once on the new machine, you will need to untar as root, using either sudo, or the su user. Do not forget to change permissions so that the data can be accessed by the correct users.

 tar –xvf  client._netdrive_data.20100305104432.0
 sudo chmod 775 –R extracted-directory 
      • If you are going to a windows machine you might need a client like 7-zip to enable you to untar the archive.