restore Command

Purpose

Extracts files from archives created with the rmt special file.
Note:

File-System Archives

File-system archives are also known as i-node archives due to the method used to archive the files. A file-system name is specified with the backup command, and the files within that file system are archived based on their structure and layout within the file system. The restore command restores the files on a file-system archive without any special understanding of the underlying structure of the file system.

When restoring file-system archives, the restore command creates and uses a file named restoresymtable. This file is created in the current directory. The file is necessary for the restore command to do incremental file-system restores.
Note: Do not remove the restoresymtable file if you perform incremental file-system backups and restores.

The File parameter is ignored when using either the -r or the -R flag.

File-Name Archives

File-name archives are created by specifying a list of file names to archive to the backup command. The restore command restores the files from a file-name archive without any special understanding of the underlying structure of the file system. The restore command allows for metacharacters to be used when specifying files for archive extraction. This provides the capability to extract files from an archive based on pattern matching. A pattern filename must be enclosed in single quotations, and patterns must be enclosed in brackets (...).

About Sparse Files

Operating system filesystems, files containing long strings of NULLs can be stored much more efficiently than other files. To be specific, if a string of NULLs spans an entire allocation block, that whole block is not stored on disk at all. Files where one or more blocks are omitted in this way are called sparse files. The missing blocks are also known as holes.
Note: Sparse files are not the same as compressed files. Sparse files are exactly the same as their non-sparse equivalents when they are read.

Sparse files are generally created by database applications. Since whenever a database file is created it is formatted with NULLs. These fragments may be either filled with allocated or unallocated NULLs.

Flags

Item Description
-a Specified with the t and/or T option, the -a option displays the list of files in the archive, along with their permissions.
-B Specifies that the archive must be read from standard input. Normally, the restore command examines the actual medium to determine the backup format. When using a | (pipe), this examination cannot occur. As a result, the archive is assumed to be in file-system format, and the device is assumed to be standard input (-f -).
-b Number For backups done by name, specifies the number of 512-byte blocks; for backups done by i-node, specifies the number of 1024-byte blocks to read in a single output operation. When the restore command reads from tape devices, the default is 100 for backups by name and 32 for backups by i-node.

The read size is the number of blocks multiplied by the block size. The default read size for the restore command reading from tape devices is 51200 (100 * 512) for backups by name and 32768 (32 * 1024) for backups by i-node. The read size must be an even multiple of the tapes physical block size. If the read size is not an even multiple of the tapes physical block size and it is in fixed block mode (nonzero), the restore command tries to determine a valid value for Number. If successful, the restore command changes Number to the new value, writes a message about the change to standard output, and continues. If unsuccessful in finding a valid value for Number, the restore command writes an error message to standard error and exits with a nonzero return code. Larger values for the Number parameter result in larger physical transfers from the tape device.

The value of the -b flag is always ignored when the restore command reads from diskette. In this case, the command always reads in clusters that occupy a complete track.

-d Indicates that, if the File parameter is a directory, all files in that directory must be restored. This flag can only be used when the archive is in file-name format.
-e Restores the non-sparse files as non-sparse as they were archived by the name format of backup command for both packed and unpacked files. It is necessary to know the sparseness/non-sparseness of the file(s) before archiving the files, since enabling this flag restores the sparse files as non-sparse.

This flag must be enabled only if files are to be restored are non-sparse consisting of more than 4K NULLs. If the -e flag is specified during restore, it successfully restores all normal files normally and non-sparse database files as non-sparse.

-E The -E option extracts beginning at a specified volume number and requires one of the following arguments. If you omit the -E option, warn is the default behavior.
force
Fails the restore operation on a file if the fixed extent size or space reservation of the file cannot be preserved.
ignore
Ignores any errors in preserving extent attributes.
warn
Issues a warning if the space reservation or the fixed size of the file cannot be preserved.
-f Device Specifies the input device. To receive input from a named device, specify the Device variable as a path name (such as /dev/rmt0). To receive input from the standard output device, specify a - (minus sign). The - (minus) feature enables you to pipe the input of the restore command from the dd command.

You can also specify a range of archive devices. The range specification must be in the following format:

/dev/deviceXXX-YYY

where XXX and YYY are whole numbers, and XXX must always be less than YYY; for example, /dev/rfd0-3.

All devices in the specified range must be of the same type. For example, you can use a set of 8mm, 2.3GB tapes or a set of 1.44MB diskettes. All tape devices must be set to the same physical tape block size.

If the Device variable specifies a range, the restore command automatically goes from one device in the range to the next. After exhausting all of the specified devices, the restore command halts and requests that new volumes be mounted on the range of devices.

-h Restores only the actual directory, not the files contained in it. This flag can only be used when the archive is in file-system format. This flag is ignored when used with the -r or -R flags.
-I Label The restore command applies this integrity label for files without security labels in the archive. The label that is supplied must exist on the system. This option is valid only for restoring files by name on Trusted AIX®.
-i Allows you to interactively restore selected files from a file-system archive. The subcommands for the -i flag are:
cd Directory
Changes the current directory to the specified directory.
add [File]
Specifies that the File parameter is added to the list of files to extract. If File is a directory, that directory and all the files contained in it are added to the extraction list (unless the -h flag is used). If File is not specified, the current directory is added to the extraction list.
delete [File]
Specifies that the File parameter is to be removed from the list of files to be extracted. If File is a directory, that directory and all the files contained in it are removed from the extraction list (unless the -h flag is used).
ls [Directory]
Displays the directories and files contained within the Directory parameter. Directory names are displayed with a / (slash) after the name. Files and directories, within the specified directory, that are on the extraction list are displayed with an * (asterisk) before the name. If verbose mode is on, the i-node number of the files and directories is also displayed. If the Directory parameter is not specified, the current directory is used.
extract
Restores all the directories and files on the extraction list.
pwd
Displays the full path name of the current directory.
verbose
Causes the ls subcommand to display the i-node number of files and directories. Additional information about each file is also displayed as it is extracted from the archive.
setmodes
Sets the owner, mode, and time for all directories added to the extraction list.
quit
Causes restore to exit immediately. Any files on the extraction list are not restored.
help
Displays a summary of the subcommands.
-l Specified with the -t and -T option. When specified, displays a detailed list of files, which includes the timestamp, file permissions, file size, owner, and group. The -l option overrides the -a option.
-L Label The restore command applies this sensitivity label for files without security labels in the archive. The label that is supplied must exist on the system. This option is valid only for restoring files by name on Trusted AIX.
-M Sets the access and modification times of restored files to the time of restoration. If a restored file is an archive created by the html