Tuesday, September 18, 2012

How to Amanda Backup Restore?


Amanda backup has can been done by recovery program amrecover, specifying your backup config, host, date, and disk entry. You can then select files with an FTP-like interface.

# amrecover BackupSet1
AMRECOVER Version 2.6.0p2. Contacting server on localhost ...
220 bass AMANDA index server (2.6.0p2) ready.
Setting restore date to today (2008-11-04)
200 Working date set to 2008-11-04.
200 Config set to BackupSet1.
200 Dump host set to bass.foo.com.
Use the setdisk command to choose dump disk to recover
amrecover> sethost bass.foo.com
200 Dump host set to bass.foo.com.
amrecover> setdate 2008-10-14
200 Working date set to 2008-10-14.
amrecover> setdisk /mnt/home8/foobar
200 Disk set to /mnt/home8/foobar.
amrecover> ls
2008-10-09-22-39-10 Mail/
2008-10-09-22-39-10 .
amrecover> cd Mail
/mnt/home8/foobar/Mail
amrecover> add .SENT
Added dir /Mail/.SENT/ at date 2008-10-09-22-39-10
amrecover> list
TAPE BackupSet1-50:2301 LEVEL 0 DATE 2008-10-09-22-39-10
/Mail/.SENT
amrecover> extract

Extracting files using tape drive changer on host localhost.
The following tapes are needed: BackupSet1-50

Restoring files into directory /root
Continue [?/Y/n]? y

Extracting files using tape drive changer on host localhost.
Load tape BackupSet1-50 now
Continue [?/Y/n/s/d]? y
./Mail/.SENT/cur/1223511955.M324978P13311V0000000000000015I008595CF_18.mail.foo.com,S=29990:2,S
./Mail/.SENT/cur/1223511956.M67589P13311V0000000000000015I008595D0_19.mail.foo.com,S=26280:2,S
./Mail/.SENT/cur/1223511956.M719310P13311V0000000000000015I008595D1_20.mail.foo.com,S=15081:2,S
./Mail/.SENT/cur/1223511959.M145867P13311V0000000000000015I008595D2_21.mail.foo.com,S=17364:2,S
./Mail/.SENT/cur/1223511959.M702977P13311V0000000000000015I008595D3_22.mail.foo.com,S=12392:2,S
./Mail/.SENT/cur/1223511960.M193662P13311V0000000000000015I008595D4_23.mail.foo.com,S=15823:2,S
./Mail/.SENT/cur/1223511960.M746504P13311V0000000000000015I008595D5_24.mail.foo.com,S=9819:2,S
./Mail/.SENT/cur/1223511961.M236364P13311V0000000000000015I008595D6_25.mail.foo.com,S=13464:2,S
...
amrecover> quit

Files are restored to the current working directory, retaining their subdirectories.

If you receive the error "Can't open tape device /dev/YOUR-TAPE-DEVICE-HERE: No such file or directory", then edit the /etc/amanda/amanda-client.conf and set tapedev. If you set tapedev to "", the client will ask the server for the changer config. Or you can manually set the device with something like setdevice tape:/dev/nst1 at the client prompt.

If you receive "[request failed: Connection refused]" or "[request failed: timeout waiting for ACK]", you may also need to edit or create the /etc/amanda/amanda-client.conf file:

conf "BackupSet1"
index_server "foo.bass.com"
tape_server "foo.bass.com"
tapedev ""
auth "bsdtcp"

or update the /etc/xinetd.d/amanda service config:

service amanda
{
    disable             = no
    socket_type         = stream
    protocol            = tcp
    wait                = no
    user                = amandabackup
    group               = disk
    groups              = yes
    server              = /usr/lib/amanda/amandad
    server_args         = -auth=bsdtcp amdump amindexd amidxtaped
}

service amanda
{
    disable             = no
    socket_type         = dgram
    protocol            = udp
    wait                = yes
    user                = amandabackup
    group               = disk
    groups              = yes
    server              = /usr/lib/amanda/amandad
    server_args         = -auth=bsd amdump amindexd amidxtaped
}

and make sure your host is correctly set in the /etc/hosts file.

No comments:

Post a Comment