restore command in Linux with Examples
restore command in Linux system is used for restoring files from a backup created using dump. The restore command performs the exact inverse function of dump. A full backup of a file system is being restored and subsequent incremental backups layered is being kept on top of it. Single files and directory subtrees can easily be restored from full or partial backups. Restore simply works across a network. Other arguments which need to be pass to the command are file or directory names specifying the files that need to be restored.
restore -C [-cdHklMvVy] [-b blocksize] [-D filesystem] [-f file] [-F script] [-L limit] [-s fileno] [-T directory]
Example: It will be going to print the general syntax of the command along with the various options that can be used with the restore command.
- restore -a: In -i o -x mode, restore will ask the user for the volume number on which the files needs to be extracted. The -a option simply disables this behavior and reads all the volumes starting with 1.
- restore -c: Normally, restore will try to determine dynamically whether the dump was made out of an old or from a new format file system. The -c flag simply disables this check, and it only allows reading a dump with the method of the old format.
- restore -d: The -d (debug) flag causes the restore to print all the debug information.
- restore -f: This option read the backup from the file that can be a special device file like /devfffrrr5/st0, /dev/sda1 (a disk drive) etc.
- restore -h: Extract the actual directory, rather than the files which is being referencing. This prevents the hierarchical restoration of complete subtrees from the dump.
- restore -C: This flag allows comparison of files from a dump. Restore command reads the backup and compares it’s with the contents of files present on the disk.
- restore -i: This flag allows the interactive restoration of files from a dump. After reading the directory information from the dump, restore command provides a shell-like interface which simply allows the user to move around the directory tree selecting files to be extracted.
- restore -P file: Restore creates a new Quickly File Access file from an existing dump file without any kind of restoring its contents.
- restore -R: Restore requests a particular tape of the multi-volume set to restart a full restore (see the -r flag below). This is proven useful if the restore has been interrupted.
- restore -r: Restore a file system. The target file system needs to be made pristine with mke2fs(8), mounted, and the user cd’d into a pristine file system before starting the restoration of the initial level 0 backup.
- restore -t: The names of the specified files are being listed if they occur on the backup. If no file argument is already given, the root directory is listed by default.
- restore -x: The names of the files are read from the given media. If a named file matches a particular directory whose contents are on the backup and the -h flag is not specified, the directory is then recursively extracted.
- restore -k: Uses the Kerberos authentication when contacting the remote tape server (Only available if this option was already enabled when restore was compiled).
- restore -l: When we are doing remote restores, then assume the remote file is a regular file (instead of a tape device). If you’re supposed to be restoring a remote compressed file, then you will need to specify this option or restore will fail to access it correctly.
- restore -m: Extracted by the inode numbers rather than by file name. This is proven useful if only a few files are being extracted, and one wants to avoid the regenerating to be completed pathname to the file.
- restore -m: Simply enables the multi-volume feature (for reading dumps made using the -M option of dump). The name must be specified with -f which is treated as a prefix and restore tries to read in the sequence from 001, 002 etc.
- restore -N: The -N flag causes the restore to perform a full execution as requested by one of the -i, -R, -r, t or x command without actually writing any file on the disk.
- restore -o: The -o flag causes the restore to automatically restore the current directory permissions without asking for the operator whether he needs to do so in one of -i or -x modes.
- restore -Q file: Use the file in order to read the tape position.
- restore -u: Whenever certain types of files are created, restore may generate a warning diagnostic if they already exist in the target directory. To prevent this, the -u (unlink) flag can causes restore to remove the old entries before attempting to create new ones.
- restore -v: Normally restore does his work silently under the hood. The -v (verbose) flag causes it to type the name each of file it simply treats preceded by its file type.
- restore -V: Enables reading a multi-volume non-tape mediums like CDROMs.
- restore -y: Do not ask for the user whether to abort the restore in the event of an error. It always tries to skip over the bad block and then continue.