On the care and feeding of amrecover

Amrecover is the prefered utility for recovering small numbers of files from linux filesystems, particularly if the user involved is standing in front of you and doesn't know exactly was lost or when, as there is interactive access to the catalogue.

The tape drive doesn't (didn't used to) take kindly to being forced to stop streaming, so restores need to be carried out directly to bilsdale at present, as the tape runs at 20Mbyte/sec, which cannot be squashed into even a 100Mbit pipe. It may be that the introduciton of 1Gbit networking and/or the tape drive swap will avoid this, but until this is tested, the safest thing is to restore to bilsdale and move the files later. If this interactive recovery cannot be used, the next best thing is to use amrecover as far as is needed to get a list of tapes, and dump images, then to use amrestore to stage these on disk and selectively restore from these images.

Here is an annotated typescript showing the use of amrecover.

  1. You need to know which machine and mounted device the target files are eventually to be restored to. Use df to find out. You may also need to lookup a user home directory in the password file.
    [root@bilsdale tmp]# ssh byerhope -l root "df /export/staff1"
    root@byerhope's password: 
    Filesystem           1k-blocks      Used Available Use% Mounted on
    /dev/sdf2             17496716   6279872  10328048  38% /export/staff1
    
  2. Launch amrecover. You can ignore the warnings about invalid index records.
    [root@bilsdale tmp]# PATH=/usr/local/amanda/current/sbin:$PATH
    [root@bilsdale tmp]# export PATH
    [root@bilsdale tmp]# amrecover -s bilsdale -t bilsdale -d /dev/st0
    AMRECOVER Version 2.4.2p2. Contacting server on bilsdale ...
    220 bilsdale AMANDA index server (2.4.2p2) ready.
    200 Access OK
    Setting restore date to today (2002-05-30)
    200 Working date set to 2002-05-30.
    200 Config set to ncl.
    501 No index records for host: bilsdale.ncl.ac.uk. Invalid?
    
  3. Select the required host, the date and the disk volume. Dates are specified in ISO (YYYY-MM-DD) format. The backup starts in the late evening, so for a backup overnight on 28th/29th May, the 28th should be specified. Disk volume names generally need the leading /dev/ for linux systems, but not for solaris systems.
    amrecover> sethost byerhope
    200 Dump host set to byerhope.
    amrecover> setdate 2002-05-28
    200 Working date set to 2002-05-28.
    amrecover> setdisk /dev/sdf2
    200 Disk set to /dev/sdf2.
    
  4. Make sure you are working in a local filesystem with enough space. lcd can fix that if you forgot. At this point, amrecover has ls and cd commands to navigate through the virtual filesystem made up from the backup indexes.
    amrecover> lcd /var/spool/amanda
    amrecover> ls
    2002-05-28 .
    ...
    2002-05-28 ncrr/
    ...
    amrecover> cd ncrr
    /dev/sdf2/ncrr
    
  5. When you have navigated to the correct place, the add command will mark a file for extraction, and the extract command will start the recovery operation.
    amrecover> add .bash_history
    Added /ncrr/.bash_history
    amrecover> extract
    
    Extracting files using tape drive /dev/st0 on host bilsdale.
    The following tapes are needed: byerhope02
    
    Restoring files into directory /var/spool/amanda
    Continue? [Y/n]: y
    
  6. The list of tapes required is now displayed. The best thing is to load them all into sequential slots starting from slot 1 so that no further visits to the robot are needed until the restore has been done. Once the tapes are physically in the changer, loading them is best done from a separate signon to the server, bilsdale - this time as operator (Sign on as root and use su - operator).
    [root@bilsdale tmp]# su - operator
    sh-2.04$ amtape ncl slot 5
    amtape: changed to slot 5 on /dev/nst0
    sh-2.04$ logout
    [root@bilsdale tmp]# 
    
  7. Once the required tape has been loaded, return to the amrecover job and confirm this to continue. Amrecover will read the tape (slowly). If you want to know what is going on look in /tmp/amanda for recently modified files matching amrecover.*.debug or amidxtaped.*.debug.
    Load tape byerhope02 now
    Continue? [Y/n]: y
    ./ncrr/.bash_history
    
  8. The amrecover job will cycle through all the necessary tapes asking for them in turn, then allow you to quit.
    amrecover> quit
    200 Good bye.
    [root@bilsdale tmp]# 
    
  9. Once you have finished, you should run amcheck and should re-fill the robot as needed to ensure the next backups can proceed normally.
    [root@bilsdale amanda]# su - operator
    sh-2.04$ amcheck -s ncl
    Amanda Tape Server Host Check
    -----------------------------
    Holding disk /var/spool/amanda2: 6971800 KB disk space available, using 6255000 KB
    Holding disk /var/spool/amanda: 32030448 KB disk space available, using 28884720 KB
    amcheck-server: slot 7: date 20020412 label byerhope10 (active tape)
    amcheck-server: slot 1: date 20020404 label byerhope04 (exact label match)
    NOTE: skipping tape-writable test
    Tape byerhope04 label ok
    Server check took 170.367 seconds
    
    (brought to you by Amanda 2.4.2p2)
    sh-2.04$ logout
    [root@bilsdale amanda]# 
    

C.R.Ritson@newcastle.ac.uk
19 June 2002