Restoring from tape


Below are instructions for recovering files from backup tapes. This is relevant to the nightly differential backups we do in the lab, but not necessarily to the weekly full backups run in the Barnes lab.

Please contact Carl Welch with any problems or questions.

In our backup routine, several filesystems are sequentially written to a
single tape in a single backup (eg., in a single night).  The dump command
in the backup script is "ufsdump".  The appropriate command for restoring
from tape is "ufsrestore".  

The tape needs to fully rewound before doing this.  From the machine that
runs the tape drive, run the following command (don't need to be root):
UNIXprompt> mt -f /dev/rmt/0hn rewind

Let's say that we want to restore some files from the wayback:/home dump
(see the note at the bottom to determine where in a given dump a particular
filesystem is located).  Currently, this is the second filesystem dumped to
the tape.  So, if the rewound tape is in the tape drive, run the following
command from bullwinkle (or whatever machine runs the tape drive):
UNIXprompt> sudo ufsrestore ifs /dev/rmt/0hn 2
"2" because it's the second filesystem on the tape, "s" to go to the second
filesystem, "f" to do this with the "file" /dev/rmt/0hn, and "i" for an
interactive session.  Root owns ufsrestore, so it has to be run as root or
with sudo.

A ufsrestore prompt will appear.  "cd", "pwd" and "ls" work just like at
the UNIX prompt.  After the files to be restored are found, add them to the
list of files to be restored:
ufsrestore> add filename1
ufsrestore> add filename2
ufsrestore> add filename3
etc.  If a file is added by mistake, it can be removed from the list:
ufsrestore> delete filename2
After the list is complete, extract the files:
ufsrestore> extract
It may ask for a volume number -- try a 1.  It'll ask if you want to change 
the permissions -- I wouldn't.  The files will be restored in the directory 
from which ufsrestore was run in a directory structure identical to the
structure in which the files were dumped:  if restoring
/home/carl/lostfile.txt into the directory /home/carl, that file
will have the following path: /home/carl/irstuds/carl/lostfile.txt
(the directories /home/carl/irstuds and /home/carl/irstuds/carl
will be created, and the file lostfile.txt put into the latter).

Then end the ufsrestore session:
ufsrestore> quit



Note -- how to locate the desired filesystem dump on a backup tape:

Log files of the dumps are kept as gzipped files in
/var/spool/backups/nightly .  The files are named according to the date on
which they occurred.  For example, the dump for 10 February 2000 was logged
to the file 000210.22045.gz (the 22045 is a semi-random number: it's
actually the process ID of the dump -- not important).

Copy this file into your home directory and uncompress it (I'm assuming
that you are in your home directory when you run these commands):
UNIXprompt> cp /var/spool/backups/nightly/000210.22045.gz .
(that period at the end IS necessary)
UNIXprompt> gunzip 000210.22045.gz
This will create a text file called 000210.22045 which is the log of the
dump which happened around 3 am on Thursday 10 February 2000.  View the
contents of this file to determine at what point in the dump sequence the
desired filesystem was backed up to tape.  The first _successfully dumped_
filesystem is "1", the second is "2", etc.  Occasionally, a problem will
occur during a dump, and something like "THE ENTIRE DUMP IS ABORTED" will
appear in that section of the dump log.  Skip these in your counting when
trying to locate the filesystem you want.

Home The NIR group Research Colloquia RAC Picture Gallery Outreach Internal Links Students