Online Book Reader

Home Category

UNIX System Administration Handbook - Evi Nemeth [116]

By Root 2766 0
level of dumps.

This schedule requires 24 tapes plus however many tapes are needed to perform the level 0 dumps. Although it does not require too many tapes, it also does not provide much redundancy.

10.4 RESTORING FROM DUMPS


Most of the many variations of the program that extracts data from dump tapes are called restore. We first discuss restoring individual files (or a small set of files), then explain how to restore entire filesystems.

Restoring individual files


The first step to take when you are notified of a lost file is to determine which tapes contain versions of the file. Users often want the most recent version of a file, but that is not always the case. For example, a user who loses a file by inadvertently copying another file on top of it would want the version that existed before the incident occurred. It’s helpful if you can browbeat users into telling you not only what files are missing, but also when they were lost and when they were last modified.

If you do not keep on-line catalogs, you must mount tapes and repeatedly attempt to restore the missing files until you find the correct tape. If the user remembers when the files were last changed, you may be able to make an educated guess about which tapes the files might be on.

After determining which tapes you want to extract from, create and cd to a temporary directory such as /var/restore where a large directory hierarchy can be created; most versions of restore must create all of the directories leading to a particular file before that file can be restored. Do not use /tmp—your work could be wiped out if the machine crashes and reboots before the restored data has been moved to its original location.

The restore command has many options. Most useful are i for interactive restores of individual files and directories and r for a complete restore of an entire filesystem. You might also need x, which requests a noninteractive restore of specified files—be careful not to overwrite existing files.

restore i reads the catalog from the tape and then lets you navigate through the directory of the dump as you would a normal directory tree, using commands called ls, cd, and pwd. You mark the files that you want to restore with the add command. When you are done selecting, type extract to pull the files off the tape.

If you placed multiple files on a single tape, you must use the mt command to position the tape at the correct dump file before running restore. Remember to use the nonrewinding device!

See page 186 for a description of mt.

For example, to restore the file /users/janet/iamlost on a FreeBSD system from a remote tape drive, you might issue the following commands. Let’s assume that you have found the right tape, mounted it on tapehost:/dev/nst0, and determined that the filesystem containing janet’s home directory is the fourth one on the tape.

# mkdir /var/restore

# cd /var/restore

# rsh8

tapehost mt -f /dev/nst0 fsf 3

# rrestore if tapehost:/dev/nst0

restore> ls

.

..

janet/ garth/ lost+found/ lynda/

restore> cd janet

restore> ls

afile bfile cfile iamlost

restore> add iamlost

restore> ls9

afile bfile cfile iamlost*

restore> extract

You have not read any volumes yet.

Unless you know which volume your files are on you should

start with the last volume and work towards the first.

Specify next volume #: 1

set owner/mode for '.'? [yn] n

Volumes (tapes) are enumerated starting at 1, not 0, so for a dump that fits on a single tape, you specify 1. When restore asks if you want to set the owner and mode for “.”, it’s asking if it should set the current directory to match the root of the tape. Unless you are restoring an entire filesystem, you probably do not want to do this.

Once the restore has completed, you need to give the file to janet:

# cd /var/restore

# ls users/janet

iamlost

# ls ~janet

afile bfile cfile

# cp -p users/janet/iamlost ~janet/iamlost.restored

# chown janet ~janet/iamlost.restored

# chgrp student ~janet/iamlost.restored

# rm -rf /var/restore

# mail janet

Your file iamlost has

Return Main Page Previous Page Next Page

®Online Book Reader