su - # goto superuser

Create recover directory and cd into it

amrecover

You get Amanda prompt - amrecover>

amrecover> listdisk - gives you available directories

amrecover> setdisk <disk>

amrecover>history - gives you days available

amrecover> setdate <date - as per history (cut & paste)>

amrecover>ls - gives avail directories

amrecover> add <directory or filename>

repeat selection process adding files required when done

amrecover>extract

will ask for confirmation

Bare metal recovery (abe example)

If unsure of how partition is done, you can re-do it later if you see the /etc/fstab. Otherwise, our standard is

1: / ext3 -- around 30GB
2: SWAP -- around 2GB
3: /u ext3 -- rest of the disk

.Then do a minimal text only server install (this will be blown away later and overwritten with contents of tape). Once machine is booted up, install amanda rpm. Go to our amanda backup machine (gonzo) and run:

rpm -qa|grep amanda

This will give you the version number you need. Amanda RPMs are available at http://www.zmanda.com/download-amanda.php

wget <paste URL of amanda RPM for red hat enterprise 5 of your version>
rpm -ivh amanda-backup_client*.rpm

After installation, edit the /etc/amanda/amanda-client.conf and change index_server and tape_server to gonzo.crecom.com.au. Hash out the tapedev.

index_server "gonzo.crecom.com.au"      # your amindexd server
tape_server  "gonzo.crecom.com.au"      # your amidxtaped server
#tapedev      "tape:/dev/YOUR-TAPE-DEVICE-HERE" # your tape device

Next go to your amanda backup server (gonzo) and add your host to /var/lib/amanda/.amandahosts

test12.crecom.com.au root amindexd amidxtaped

Back on your blank host. you are ready to restore. (as root) run:

mkdir /u/restore
cd /u/restore
amrecover
listhost
sethost abe.crecom.com.au  <--- choose a host to restore from above list
setdisk /
add .
extract

Answer "Y" to all the questions. This will extract all your root partition files onto the /u partition since you can't just overwrite the root partition just yet. You will need to boot into the rescue CD to do that. Shutdown the server and boot the CentOS 5 rescue CD. (Very important, do NOT use a different distribution's CD) Choose not to search for previous installs and just get a shell. If your original server had raid, it might be a good idea to restore this, even if you only have one disk (check /u/restore/etc/fstab if there is md0 and/or md1 in it):

First use fdisk to change type of partition to linux-raid (fd). If this is not aligned, we need to make sure it is aligned.

mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sda1 missing
mkfs.ext3 /dev/md0
mkdir /mnt/sysimage
mkdir /mnt/oldu
mount /dev/md0 /mnt/sysimage
mount /dev/sda3 /mnt/oldu
cd /mnt/sysimage
rsync -av ../oldu/restore/ ./
mount -obind /proc proc
mount -obind /dev dev
mount -obind /sys sys
chroot /mnt/sysimage
grub-install /dev/md0

The above should restore your OS and make the system bootable. Next we can now boot into this OS and perform the rest of the recovery from there. Boot up as single user and start networking. Use fdisk to make partition 3 type fd if you have raid. At the same time make sure sectors are aligned. If it says you are still using old partition table, exit and restart in single user again.

mdadm --create /dev/md1 --level=1 --raid-devices=2 /dev/sda3 missing
mkfs.ext3 /dev/md1
mount /dev/md1 /u
cd /u
amrecover
setdisk /u [or other partitions]
add .
extract

This will restore all the other partitions.

Restoring files to the Windows client

To restore files to the Windows client, the backup image will have to be recovered on the Amanda server and copied to the Windows client. Windows machine to which files being restored to, does not require Amanda software.

Example:

 $ amrecover DailySet1
 AMRECOVER Version 2.6.1p1. Contacting server on localhost ...
 220 backups AMANDA index server (2.6.1p1) ready.
 Setting restore date to today (2010-07-29)
 200 Working date set to 2010-07-29.
 200 Config set to DailySet1.
 200 Dump host set to backups.foobar.com.
 Use the setdisk command to choose dump disk to recover
 amrecover> sethost bunsen.crecom.com.au
 200 Dump host set to bunsen.crecom.com.au
 amrecover> history
 200- Dump history for config "DailySet1" host "bunsen.crecom.com.au" disk "c:"
 201- 2010-07-28-23-00-04 1 DailySet1-03:6
 201- 2010-07-27-23-00-05 0 DailySet1-02:3
 201- 2010-07-26-23-00-05 1 DailySet1-01:6
 200 Dump history for config "DailySet1" host "bunsen.crecom.com.au" disk "c:"
 amrecover>

From this you will need to follow the procedure described under the term Level to determine which dumps to retrieve. NOTE: The dump level is the third column in on the history list. After determining which dumps you need, the tape names can be seen in the last column and the date/time stamp can be obtained for use with amfetchdump by removing the hyphens from the number in the second column in the history list.

Example:

$ amfetchdump DailySet1 bunsen.crecom.com.au c: 20100727

Hint:

 To avoid very long and convoluted filenames, use the -p switch and redirect the output to a filename of your choice.

Example:

$ amfetchdump -p DailySet1 client1.foobar.com C:/ 20100727230005 > client1_full.zip
$ amfetchdump -p DailySet1 client1.foobar.com C:/ 20100728230004 > client1_incr_1.zip

Then use unzip or windows explorer to unzip the file

If the files are big (>16GB), normal zip utilities will not work. Get a copy of pkware's zip reader utility. It is the only one that will work (right now).

amanda_restore (last edited 2015-02-02 05:41:09 by fuzzy)