RESTORE(8,C) AIX Commands Reference RESTORE(8,C)
-------------------------------------------------------------------------------
restore
PURPOSE
Copies back files created by the backup command.
SYNTAX
one of
+----+ +----------------------+
/etc/restore ---| -t |---| +--------------+ |---|
| -T | +---| -v -q |---+
+----+ ^ | -f device | |
| | -C num | |
| +--------------+ |
+------------------+
+----------------------+ +------------+
/etc/restore --- -x ---| +--------------+ |---| |---|
+---| -d -h |---+ +--- file ---+
^ | -v -q | | ^ |
| | -f device -s | | +--------+
| | -C num -I | |
| +--------------+ |
+------------------+
one of
+----+ +----------------------+
/etc/restore ---| -r |---| +--------------+ |--- filesystem ---|
| -R | +---| -v -q |---+
+----+ ^ | -f device -s | |
| | -C num | |
| +--------------+ |
+------------------+
+----------------------+
/etc/restore --- -m ---| +--------------+ |--- filesystem ---|
+---| -v -q |---+
^ | -f device -s | |
| | -C num | |
| +--------------+ |
+------------------+
DESCRIPTION
The restore command reads files written by the backup command to a backup
medium and restores them to a file system.
There are four ways to use the restore command:
Processed November 8, 1990 RESTORE(8,C) 1
RESTORE(8,C) AIX Commands Reference RESTORE(8,C)
o To display a table of contents for the backup (-T) or to display label
information (-t)
o To restore specified files (-x)
o To restore an entire file system (-r) or begin at an arbitrary volume
number (-R)
o To restore an entire minidisk (-m).
When you do not specify a restore device with the -f flag, the restore command
reads files from a default device. For restore by name, restore -x, the system
reads from the default device, /dev/rfd0. For restore by file system, restore
-r, or restore by minidisk, restore -m, restore checks /etc/filesystems for a
stanza that matches the file name you specified. If such a stanza exists and
contains a backupdev entry, the system reads from the device specified by
backupdev. Otherwise, the system reads from the default device, /dev/rfd0.
Notes:
1. If the file system you are restoring is mounted and is not the root
filesystem, restore unmounts the filesystem before it performs an inode
restore and then remounts the filesystem after completion. If an error
occurs during restore, the filesystem remains unmounted.
2. Files must be restored using the same method by which they were backed up.
For example, if a file system was backed up by minidisk, it must be
restored by minidisk.
3. When more than one diskette is required, restore reads the one mounted,
prompts the user for a new one, and waits for the user's response. After
inserting the new diskette, press Enter to continue restoring files.
4. For internal tape backup units, use a 200 series minor device (for
example, /dev/rst204) to restore a tape backed up with a 0 series (best for
backup) minor device (for example, /dev/rst0). Using the 0 series minor
device number can, under some circumstances, result in a "READ ERROR on
sector ####, assuming zeros" message, but should not affect the data being
restored.
FLAGS
-Cnum Specifies the number of blocks to read in a single input operation. If
you do not specify this flag, restore selects a default value
appropriate for the physical device you have selected. Larger values of
num result in longer physical transfers from tape devices. restore
always ignores the value of the -C flag when it reads a diskette; the
input is always read in clusters that occupy a complete track.
-d Indicates that if file is a directory, all files in that directory
should be restored. In this case, the name of each restored file is
always its name as shown by restore -T, whether the backup was by name
or by inode. The file names supplied need not be directories. Thus,
for inode backups:
Processed November 8, 1990 RESTORE(8,C) 2
RESTORE(8,C) AIX Commands Reference RESTORE(8,C)
/etc/restore -x a/b/file.c
creates a file whose name is its inode number, while:
/etc/restore -xd a/b/file.c
creates a file named "a/b/file.c". With this flag, file names can
include pattern-matching characters, although you must quote these
characters to prevent their expansion by the shell.
Use this flag only when you are restoring by individual file name (-x).
-fdevice
Specifies the input device. Specify device as a file name (such as
/dev/rmt0) to get input from the named device or specify - (minus) to
get input from the standard output device. The - feature enables you to
improve performance when restoring from streaming tape by piping the
output of a dd command to the restore command (see example). The
restore command recognizes a special syntax for the names of input
files. If the device parameter is a range of names, for example
/dev/rfd0-3, restore automatically goes from one drive in the range to
the next. After using all of the specified drives, it stops and
requests that another diskette be inserted.
-h Specifies that the access and modification times of restored files are
to be set to the time of restoration. (The default action is to set the
access and modification times to the file times on the backup medium.)
If a restored file is an archive, the modification times in all the
member headers are also set to the time of restoration. You can specify
this flag only when you are restoring individually named files.
-I Used only with the -x flag. Operates exactly like -x except that file
names are read from standard input.
-m Restores an entire minidisk as an exact image.
Note: You can use this flag only with minidisks that are at least as
large as the original minidisk that was backed up. If the
minidisk is larger than the original, the leftover space becomes
unusable after restoring the minidisk. You can use "restore -t"
to see how large a minidisk you need.
-q Specifies that the removable medium is ready to use. In this case,
restore proceeds without prompting you to prepare the removable medium.
-r Restores an entire file system. Use this flag with inode backups only
(see "backup"). filesystem can be a device name (block or character
special file) or a directory name that restore looks up in
/etc/filesystems.
If you are restoring a full (level 0) backup, run the mkfs command to
create an empty file system before doing the restore. If you are
Processed November 8, 1990 RESTORE(8,C) 3
RESTORE(8,C) AIX Commands Reference RESTORE(8,C)
restoring an incremental backup at, say, level 2, run mkfs, restore the
appropriate level 0 backup, then the level 1 backup, and finally the
level 2 backup.
Warning: If you do not follow this procedure carefully, you can ruin an
entire file system. As an added safety precaution, run fsck after you
restore each backup level.
-R Restarts an aborted restore at a specified point. restore prompts you
for the starting volume number. This flag is invalid in combination
with the -m flag.
-s type
"Flattens" hidden directory when restoring on a system of the given
type. This flag is only used with the -x (restore file name) flag. A
restore of x@/i370 using the -s i370 flag restores x@/i370 as x.
-T Displays the backup file header and the names of the backed up files.
If the backup was made by name (backup -i), the names displayed are the
ones you provided to backup. If the backup was made by inode, restore
displays the i-number of each file along with the file name. The names
are relative to the root directory of the file system backed up. The
only exception is the root directory itself, whose name is given as a
slash ("/").
-t Displays only the backup file header.
-v Reports the progress of the restoration as it proceeds.
-x Restores individually named files. The names must be in the same form
as the names shown by restore -T. With a name backup, restore gives the
restored file whatever name was supplied when the file was backed up.
If the original name was specified relative to the current directory,
restore creates a file relative to the current directory. restore
automatically creates any needed directories. With an inode backup, the
name of the restored file is the same as its i-number. This flag is
invalid with the -m flag.
EXAMPLES
1. To list the names of files previously backed up:
/etc/restore -T
Information is read from the default backup device /dev/rfd0. If
individual files were backed up, only the file names are displayed. If an
entire file system was backed up, the i-number is also shown.
2. To display technical information about a backup:
/etc/restore -t
Processed November 8, 1990 RESTORE(8,C) 4
RESTORE(8,C) AIX Commands Reference RESTORE(8,C)
This command displays information including when the backup was made, which
file system was saved, and whether it is a backup by name, a backup by
minidisk, or a backup by file system or inode.
3. To restore files to the main file system:
/etc/restore -x -v
The "-x" extracts all the files from the backup medium and restores them to
their proper places in the file system. The "-v" displays a progress
report as each file is restored. If a file system backup is being
restored, the files are named with their i-numbers. Otherwise, just the
names are displayed.
4. To copy selected files:
/etc/restore -xv /u/tom/manual/chap1
This command extracts the file "/u/tom/manual/chap1" from the backup medium
and restores it. To work properly, "/u/tom/manual/chap1" must be a name
that can be displayed by restore -T.
5. To copy all the files in a directory:
/etc/restore -xdv manual
This command restores the directory "manual" and the files in it. If it
does not exist, a directory named "manual" is created in the current
directory to hold the files being restored.
6. To restore an entire file system backup:
mkfs /dev/hd1
/etc/restore -rv /dev/hd1
This command restores an entire file system backup onto "/dev/hd1". It
destroys and replaces any file system that was previously stored on
"/dev/hd1". If the backup was made using incremental file system backups,
restore the backups in increasing backup-level order (0, 1, 2...).
7. To restore a minidisk:
/etc/restore -m /dev/hd1
This restores the exact image of minidisk "/dev/hd1". You can also
identify the minidisk by its stanza name in the /etc/filesystems file.
8. To improve performance on streaming tape, pipe the dd command to the
restore command:
dd if=/dev/rmt0 bs=30b |/etc/restore -xf-
Processed November 8, 1990 RESTORE(8,C) 5
RESTORE(8,C) AIX Commands Reference RESTORE(8,C)
This command cannot be used on multi-volume backups.
The dd command copies the files from an input file which is a streaming
tape device ("if=/dev/rmt0") and specifies a file size of thirty 512-byte
blocks ("bs=30b"). The output is piped to restore. The restore command
gets the input from the standard input device ("f-") and restores up by
name ("x").
FILES
/etc/filesystems
Descriptions of mountable file systems; consulted for default
parameters.
/dev/rfd0 Default restore device.
RELATED INFORMATION
See the following commands: "backup" and "print."
See the discussion of filesystems and backup in AIX Operating System Technical
Reference.
See "Backing up and Restoring Files" in Using the AIX Operating System.
Processed November 8, 1990 RESTORE(8,C) 6