UNIX System Administration Handbook - Evi Nemeth [117]
been placed in /users/janet/iamlost.restored.
Your name, Humble System Administrator
Some administrators prefer to restore files into a special directory, allowing users to copy their files out by hand. In that scheme, the administrator must protect the privacy of the restored files by verifying their ownership and permissions. If you choose to use such a system, remember to clean out the directory every so often.
If you created a backup with rdump and are unable to restore files from it with restore, try running rrestore instead. To minimize the chance of problems, use the same host to read the tape as was used to write it.
In general, restore i is the easiest way to restore a few files or directories from a dump. However, it will not work if the tape device cannot be moved backward a record at a time (a problem with some 8mm drives). If restore i fails, try restore x before jumping out the window. restore x requires you to specify the complete path of the file you want to restore (relative to the root of the dump) on the command line. The following sequence of commands repeats the previous example, using restore x:
# mkdir /var/restore
# cd /var/restore
# rsh tapehost mt -f /dev/nst0 fsf 3
# rrestore xf tapehost:/dev/nst0 /users/janet/iamlost
Restoring entire filesystems
With luck, you will never have to restore an entire filesystem after a system failure. However, the situation does occasionally arise. Before attempting to restore the filesystem, you must make sure that whatever problem caused the filesystem to be destroyed in the first place has been taken care of. It’s pointless to spend numerous hours spinning tapes only to lose the filesystem once again.
Before you begin a full restore, you must create and mount the target filesystem. See Chapter 8, Adding a Disk, for more information about how to prepare the filesystem. To start the restore, cd to the mount point of the new filesystem, put the first tape of the most recent level 0 dump in the tape drive, and type restore r.
restore will prompt for each tape in the dump. After the level 0 dump has been restored, mount and restore the incremental dumps. Restore incremental dumps in the order they were created. Because of redundancy among dumps, it may not be necessary to restore every incremental. Here’s the algorithm for determining which dumps to restore:
Step 1: Restore the most recent level 0 dump.
Step 2: Restore the lowest-level dump of all dumps made subsequent to the dump you just restored. If multiple dumps were made at that level, restore the most recent one.
Step 3: If that was the last dump that was ever made, you are done.
Step 4: Otherwise, go back to step 2.
Here are some examples of dump sequences. You would only need to restore the levels shown in boldface.
0 0 0 0 0 0
0 5 5 5 5
0 3 2 5 4 5
0 9 9 5 9 9 3 9 9 5 9 9
0 3 5 9 3 5 9
See Chapter 8 for more information about newfs and mount.
Let’s take a look at a complete command sequence. If the most recent dump was the first monthly after the annual level 0 in the “moderate” schedule on page 180, the commands to restore /home, residing on the physical device /dev/dsk/c201d6s0, would look like this (the device names and newfs command are OS dependent):
# /etc/newfs /dev/dsk/c201d6s0 QUANTUM_PD1050S
# /etc/mount /dev/dsk/c201d6s0 /home
# cd /home
/* Mount first tape of level 0 dump of /home. */
# restore r
/* Mount the tapes requested by restore. */
/* Mount first tape of level 5 monthly dump. */
# restore r
If you had multiple filesystems on one dump tape, you would have to use the mt command to skip forward to the correct filesystem before running each restore. See page 186 for a description of mt.
This sequence would restore the filesystem to the state it was in when the level five dump was done, except that all deleted files would be ghoulishly resurrected. This problem can be especially nasty when you are restoring an active filesystem or are restoring to a disk that is nearly full. It is