How To:Restore from Virtual Tapes
For recovering files from a backup to vtapes with chg-disk or chg-multi, make sure these settings are added in amanda.conf:
amrecover_do_fsf true amrecover_check_label true amrecover_changer "changer"
The first line assures we do an implicit rewind of the vtape before reading it. Remember: vtapes are always non-rewinding!
With the last line we give the changer a name, which we can use instead of the tape device in amrecover, when starting the command:
# /usr/local/amanda/sbin/amrecover daily -d changer
or from inside amrecover with the settape command, or even:
Extracting files using tape drive file:/BACKUP2/slots/ on host backupserver.local. Load tape B3_14 now Continue [?/Y/n/s/t]? t New tape device [?]: changer Using tape "changer" from server backupserver.local. Continue [?/Y/n/s/t]? y
Loading tapes manually (old)
Instead of letting amrecover use the changer, you can also do everything manually.
I will simply paste an amrecover session here (provided by JC Simonetti, author of chg-disk):
# /usr/local/amanda/sbin/amrecover woo AMRECOVER Version 2.4.4p3. Contacting server on backupserver.local ... 220 backupserver AMANDA index server (2.4.4p3) ready. 200 Access OK Setting restore date to today (2004-10-08) 200 Working date set to 2004-10-08. Scanning /BACKUP2/holding... Scanning /BACKUP/holding... 200 Config set to woo. 200 Dump host set to backupserver.local. Trying disk /tmp ... $CWD '/tmp/RECOVER' is on disk '/tmp' mounted at '/tmp'. 200 Disk set to /tmp. Invalid directory - /tmp/RECOVER amrecover> sethost backupserver.local 200 Dump host set to backupserver.local. amrecover> setdisk / 200 Disk set to /. amrecover> cd /etc /etc amrecover> add passwd Added /etc/passwd amrecover> list TAPE B3_14 LEVEL 0 DATE 2004-09-26 /etc/passwd amrecover> extract Extracting files using tape drive file:/BACKUP2/slots/ on host backupserver.local. The following tapes are needed: B3_14 Restoring files into directory /tmp/RECOVER Continue [?/Y/n]? Y Extracting files using tape drive file:/BACKUP2/slots/ on host backupserver.local. Load tape B3_14 now Continue [?/Y/n/s/t]? Y . /etc/passwd amrecover> quit 200 Good bye.
Nothing spectacular? The trick is this: When Amanda asks you
Load tape B3_14 now Continue [?/Y/n/s/t]?
you have to run the following in a second terminal:
$ amtape woo slot 14 amtape: changed to slot 14 on file:/BACKUP2/slots/
This step is necessary to load the proper tape into your virtual changer. Let me express this in a more general way:
When amrecover prompts for the tape it needs to restore the files you requested, you have to "load" the tape it requests. The recommended way to do this is to use amtape. The options that make sense in this context are:
# amtape Usage: amtape <conf> <command> Valid commands are: [...] slot <slot #> load tape from slot <slot #> [...] label <label> find and load labeled tape [...]
If you know which slot contains the requested tape (for example, if you have tape daily01 in slot 1, tape daily02 in slot 2, and so on) you may use the first option. If you just know the label of the tape you need, use the second option.
To continue the upper example:
amtape woo slot 14 # option 1 OR amtape woo label B3_14 # option 2
amtape will return something like:
amtape: label B3_14 is now loaded.
After this you can return to your amrecover-session and continue restoring your files.
Credit
Based on text by Stefan G. Weichinger, November - December, 2003, with updates in April, 2005.