restore
PURPOSE
Copies back files created by the backup command.
SYNOPSIS
restore [ -t ] [ -T ] [ [ -v ] [ -f device ] [ -C num ] ] ...
restore -x [ [ -d ] [ -f device ] [ -v ] [ -C num ] ] [ file ]
restore [ -r ] [ -R ] [ [ -f device ] [ -v ] [ -C num ] ] filesystem
restore -m [ [ -C num ] [ -f device ] [ -v ] ] filesystem
DESCRIPTION
The restore command reads files written by the backup
command to a backup medium and restores them to a file
system. You can restore files that are backed up on a
local system or on a remote system.
There are four ways to use the restore command:
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, the restore
command reads files from a default backup device. For
restore by name, restore -x, the system reads from
/dev/rfd0 unless you specify a device with the -f flag.
For restore by file system, restore -i, or restore by
minidisk, restore -m, if /etc/filesystems contains a
stanza that matches the name you specified and a stanza
with a backupdev entry, then the system reads from the
device specified by backupdev. Otherwise, the system
reads from /dev/rfd0 or the device specified with the -f
flag.
If neither -i nor -u is specified, files are restored to
the local node in the current directory. If either -i or
-u is specified, the system needs to know where to
restore the files. Either a target node or a qualifying
directory or both can be used to tell the system where to
restore the files. If they are not specified, restore
looks for the information in the header file of the
backup. If you are restoring files backed up with an old
version of the backup that does not contain a header and
you do not specify a target node and a qualifying direc-
tory on the command line, the restore command ends in an
error.
Notes:
1. If you restore by file system or by minidisk, the
source and target must be on the local system. To
restore from a remote system, restore by name with
the -i or -u flags. These flags allow users in a
distributed services environment to restore files
backed up on a remote tape drive.
2. If the file system you are restoring is mounted and
is not the root file system, restore unmounts the
file system before it performs an i-node restore and
then remounts the file system before quitting. If
the file systems you are restoring include the root
file system, restore ensures that the other file
systems are not in use. If one is, it warns you of
this and quits.
3. You can also use the print -restore command to
restore files from a remote system. When restoring
files from a remote system with the -Q and -N flags,
specify -Q before -N.
4. 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.
5. 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 (unless you
are in unattended mode). After inserting the new
diskette, press Enter to continue restoring files.
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 i-node. The file
names supplied need not be directories. Thus,
for i-node backups:
restore -x a/b/file.c
creates a file whose name is its i-node number,
while:
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 char-
acters 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 Enables users in a distributed services envi-
ronment to restore from a backup medium on a
remote system in interactive mode (user input
is permitted).
-m Restores an entire minidisk as an exact image.
Note: You can use this flag only with mini-
disks that are at least as large as the ori-
ginal minidisk that was backed up. If the
minidisk is larger than the original, the left-
over space becomes unusable after restoring the
minidisk. You can use "restore -t" to see how
large a minidisk you need.
-N node Specifies the node on which to restore files.
The node can be a node nickname or a node id.
The restore command uses this node instead of
the node in the backup header.
-q Specifies that the removable medium is ready to
use. In this case, restore proceeds without
prompting you to prepare the removable medium.
-Q qdir Specifies the qualifying directory in which to
restore files. The qdir can be a relative or
absolute directory. The restore command uses
this qualifying directory instead of the direc-
tory in the backup header. Current directory
relative names extracted from the backup medium
are placed in this directory.
-r Restores an entire file system. Use this flag
with i-node backups only (see "backup").
filesystem can be a device name (block or char-
acter 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
restoring an incremental backup at, say, level
2, run mkfs, then 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 combi-
nation with the -m flag.
-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 i-node, 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.
-u Enables users to restore files in unattended
mode (user input is not permitted) from a
backup medium on a remote system. If any user
input (such as "Please mount volume 1 on
/dev/rfd0") is required, the command ends in an
error. This enables users to set up a shell
file that restores files at night or at other
times when a user is unavailable.
-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 i-node
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:
restore -T
Information is read from the default backup device
/dev/rfd0. If individual files were backed up, then
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:
restore -t
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 i-node.
3. To restore files to the main file system:
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, then the files are named with their
i-numbers. Otherwise, just the names are displayed.
4. To copy selected files:
restore -xv /u/jim/manual/chap1
This command extracts the file "/u/jim/manual/chap1"
from the backup medium and restores it. To work
properly, "/u/jim/manual/chap1" must be a name that
can be displayed by restore -T.
5. To copy all the files in a directory:
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
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:
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 restore files in interactive mode from the remote
default device specifying a new target node and qual-
ifying directory:
restore -xi -N nick -Q /u/nick
This command extracts the files from the default
remote backup device and restores them to the node
"nick". Any unqualified names from the media are
extracted relative to the directory "/u/nick". The
contents of the backup header (if a header exists) is
ignored.
9. To restore files in unattended mode specifying a
target node id:
restore -xuN 10813661
Files from the default backup device are restored at
the node whose node id is "10813661". Since a quali-
fying directory is not specified and the backup con-
tains a backup header file, the restore command
extracts the files to the qualifying directory speci-
fied in the header.
10. To improve performance on streaming tape, pipe the dd
command to the restore command:
dd of=/dev/rmt0 bs=30b | restore -xf-
The dd command copies the files from an output file
which is a streaming tape device ("of=/dev/rmt0") and
specifies a file size of 30 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 param-
eters.
/dev/rfd0 Default restore device.
RELATED INFORMATION
The following commands: "backup" and "print."
The discussion of filesystems and backup in AIX Operating
System Technical Reference.
"Backing up and Restoring Files" in Using the AIX Oper-
ating System.