Recovering Backups
You use the restore command either to restore an entire file system or to just retrieve particular files. restore will extract files or directories from a backup archive and copy them to the current working directory. Make sure you are in the directory you want the files restored to when you run restore. restore will also generate any subdirectories as needed. restore has several options for managing the restore operation (see Table 34-4).
To recover individual files and directories, you run restore in an interactive mode using the -i option. This will generate a shell with all the directories and files on the tape, letting you select the ones you want to restore. When you are finished, restore will then retrieve from a backup only those files you selected. This shell has its own set of commands that you can use to select and extract files and directories (see Table 34-5). The following command will generate an interactive interface listing all the directories and files backed up on the tape in the /dev/tape device:
restore -ivf /dev/tape
This command will generate a shell encompassing the entire directory structure of the backup. You are given a shell prompt and can use the cd command to move to different directories, and the ls command to list files and subdirectories. You use the add command to tag a file or directory for extraction. Should you later decide not to extract it, you can use the delete command to remove from the tagged list. Once you have selected all the items you want, you enter the extract command to retrieve them from the backup archive. To quit the restore shell, you enter quit. The help command will list the restore shell commands.
If you need to restore an entire file system, you would use restore with the -r option. You can restore the file system to any blank formatted hard disk partition of adequate size, including the file system's original partition. It may be advisable, if possible, to restore the file system on another partition and check the results.
Restoring an entire file system involves setting up a formatted partition, mounting it to your system, and then changing to its top directory to run the restore command. First you should use mkfs to format the partition where you are restoring the file system, and then mount it onto your system. Then you use restore with the -r option and the -f option to specify the device holding the file system's backup. In the next example, the user formats
|
Operation |
Description |
|
-C |
Lets you check a backup by comparing files on a file system with those in a backup. |
|
-i |
The interactive mode for restoring particular files and directories in a backup. A shell interface is generated where the user can use commands to specify file and directories to restore (see Table 34-5). |
|
-R |
Instructs restore to request a tape that is part of a multivolume backup, from which to continue the restore operation. Helpful when multivolume restore operations are interrupted. |
|
-r |
Restores a file system. Make sure that a newly formatted partition has been mounted and that you have changed to its top directory. |
|
-t |
Lists the contents of a backup or specified files in it. |
|
-x |
Extracts specified files or directories from a backup. A directory is restored with all its subdirectories. If no file or directory is specified, the entire file system is restored. |
|
Additional Option |
Description |
|
-b blocksize |
Use a specific block size; otherwise, restore will dynamically determine it from the block device. |
|
-f file/device |
Restores the backup on the specified file or device. Specify a hostname for remote devices. |
|
-F script |
Runs a script at the beginning of the restore. |
|
-k |
Uses Kerberos authentication for remote devices. |
|
-h |
Extracts only the specified directories, without their subdirectories. |
|
-M file/device |
Restores from multivolume backups, where the file is treated as a prefix and the suffix is a numbered sequence, file001, file002. |
|
-N |
Displays the names of files and directories, does not extract them. |
|
-T directory |
Specifies a directory to use for the storage of temporary files. The default value is /tmp. |
|
-v |
The verbose mode, where each file and its file type that restore operates on is displayed. |
|
-y |
By default, restore will query the operator to continue if an error occurs, such as bad blocks. This option suppresses that query, allowing restore to automatically continue. |
Table 34-4 Operations and Options for restore
Table 34-4 Operations and Options for restore and mounts the /dev/sda5 partition and then restores on that partition the file system backup, currently on a tape in the /dev/tape device.
mkfs /dev/sda5
mount /dev/sda5 /mystuff cd /mystuff restore -rf /dev/tape
|
Command |
Description |
|
add [arg] |
Adds files or directories to the list of files to be extracted. Such tagged files display an * before their names when listed with ls. All subdirectories of a tagged directory are also extracted. |
|
cd arg |
Changes the current working directory. |
|
delete [arg] |
Deletes a file or directory from the extraction list. All subdirectories for deleted directories will also be removed. |
|
extract |
Extracts files and directories on the extraction list. |
|
help |
Displays a list of available commands. |
|
ls [arg] |
Lists the contents of the current working directory or a specified directory. |
|
pwd |
Displays the full pathname of the current working directory. |
|
quit |
Exits the restore interactive mode shell. The quit command does not perform any extraction, even if the extraction list still has items in it. |
|
setmodes |
Sets the owner, modes, and times for all files and directories in the extraction list. Used to clean up an interrupted restore. |
|
verbose |
In the verbose mode, each file is listed as it is extracted. Also, the ls command lists the inode numbers for files and directories. |
Table 34-5 Interactive Mode Shell Commands for restore
Table 34-5 Interactive Mode Shell Commands for restore
To restore from a backup device located on another system on your network, you would have to specify that hostname for the system and the name of its device. The hostname is entered before the device name and delimited with a colon. In the following example, the user restores a file system from the backup on the tape device with the name /dev/tape on the rabbit.mytrek.com system:
restore -rf rabbit.mytrek.com:/dev/tape
This page intentionally left blank
Network Administration
Continue reading here: DNS Clients Resolvers
Was this article helpful?