HOWTO Restore Files From Amanda: Difference between revisions
Line 46: | Line 46: | ||
This process will output the files and directories in the current folder. You can aboard the process at anytime when your file has been recovered (CTRL-C). | This process will output the files and directories in the current folder. You can aboard the process at anytime when your file has been recovered (CTRL-C). | ||
<br> | <br> | ||
If you need multiple tapes, simply rewind (below), eject (below), insert the next tape, and repeat the above '''amrestore''' command. | If you need multiple tapes, simply rewind (below), eject (below), insert the next tape, and repeat the above '''amrestore''' command. | ||
<br> | |||
Now that the files have been extracted, you can copy them to their final destination. If the final destination is local to the amanda-server where you've just extracted the files, simply use '''cp''', probably with the '''-r''' option to recurse and copy subdirectories. | |||
<br>If the final destination is a remote-machine, use '''scp''', again with '''-r''' recursive option if you need subdirectories copied over also. | |||
== Finish Up == | == Finish Up == |
Revision as of 05:32, 5 May 2007
How to restore files from an Amanda tape backup.
SSH to musashi for recovering files from a machine, and SSH to yamato to recover files from users or projects.
Finding Where the Files you want to Restore are Located
hostname / # su - amanda amanda@hostname ~ $ amadmin $backupname find $hostname/$ipaddress $directorypath
Worked Example: amanda@hostname ~ $ amadmin DailyMusashi find 209.87.56.16 /etc
You should see something like this:
2006-04-07 209.87.56.16 /etc/ 0 DailyMusashi20 24 OK 2006-04-10 209.87.56.16 /etc/ 1 DailyMusashi21 16 OK 2006-04-11 209.87.56.16 /etc/ 1 DailyMusashi22 19 OK 2006-04-12 209.87.56.16 /etc/ 1 DailyMusashi23 23 OK 2006-04-13 209.87.56.16 /etc/ 1 DailyMusashi24 29 OK 2006-04-18 209.87.56.16 /etc/ 1 DailyMusashi25 23 OK
Another example:
amanda@trainwreck ~ $ amadmin Daily find inferno /srv/www Scanning /holding... Scanning /holding... date host disk lv tape or file file status 2007-04-23 inferno /srv/www 0 Daily05 8 OK 2007-04-24 inferno /srv/www 1 Daily06 4 OK 2007-04-25 inferno /srv/www 1 Daily07 2 OK 2007-04-26 inferno /srv/www 1 Daily08 2 OK 2007-04-27 inferno /srv/www 1 Daily09 2 OK 2007-04-30 inferno /srv/www 0 Daily10 10 OK 2007-05-01 inferno /srv/www 1 Daily01 6 OK 2007-05-02 inferno /srv/www 1 Daily02 2 OK 2007-05-03 inferno /srv/www 1 Daily03 2 OK 2007-05-04 inferno /srv/www 1 Daily04 2 OK
Restoring Files
Looking at the file-listing, you are interested in the most-recent level0 backup (to begin with), and the most-recent level1. None of the others (ie xxx ) are of any interest at all. We will only use DailyMusashi20, and DailyMusashi25 in the first example; Daily10 and Daily04 in the second example. If you had level2, level3 or higher, then they would get "layered" on top of the level0 and level1 restores.
Now that you know what tape the files are on, insert the first tape into the drive and ask for the files. Note: The files will be extracted into the current directory.
NOTE: Make sure you have enough drive-space for the extraction to succeed! df -h
amanda@hostname ~ $ mkdir restore; cd restore amanda@hostname ~ $ amrestore -p /dev/nst0 209.87.56.16 /etc | tar xvf -
This process will output the files and directories in the current folder. You can aboard the process at anytime when your file has been recovered (CTRL-C).
If you need multiple tapes, simply rewind (below), eject (below), insert the next tape, and repeat the above amrestore command.
Now that the files have been extracted, you can copy them to their final destination. If the final destination is local to the amanda-server where you've just extracted the files, simply use cp, probably with the -r option to recurse and copy subdirectories.
If the final destination is a remote-machine, use scp, again with -r recursive option if you need subdirectories copied over also.
Finish Up
Rewind a tape; as root:
hostname / # mt -f /dev/st0 rewind (/dev/nst0 is the non-rewinding device, although it may rewind anyway) hostname / # mt -f /dev/nst0 eject