33.7. Restoring files with dump

The restore command performs the inverse function of dump(8). It restores files or file systems from backups made with dump. A full backup of a file system may be restored, and subsequent incremental backups layered on top of it. Single files and directory sub-trees may be restored from full, or partial backups. You have a number of possibile commands and options to restore backed up data with the dump program. Below, detailed is a procedure that uses the full potential of the restore program with the most options possible. It is also done in interactive mode.

In an interactive restoration of files from a dump, the restore program provides a shell like interface that allows the user to move around the directory tree selecting files to be extracted, after reading in the directory information from the dump. The following is what we will see if we try to restore our /home directory:

First of all, with the following command we must move to the partition file system where we want to restore our backup. This is required, since the interactive mode of the restore program will restore our backups from the current partition file system where we have executed the restore command from.


[root@deep] /# cd /home
To restore files from a dump in interactive mode, use the following command:

[root@deep /home]# restore -i -f  /dev/st0

restore >
A prompt will appear in your terminal, to list the current, or specified, directory. Use the ls command as shown below:

restore > ls
.:
admin/       lost+found/  named/       quota.group  quota.user   wahib/

restore >

To change the current working directory to the specified one, use the cd commands. In our example, we change to wahib directory, as shown below:


restore > cd wahib
restore > ls
./wahib:
.Xdefaults     .bash_logout   .bashrc
.bash_history  .bash_profile  Personal/

restore >

To add the current directory or file to the list of files to be extracted, use the add command. If a directory is specified, then it and all its descendents are added to the extraction list as shown below:


restore > add Personal/
restore >

Files that are on the extraction list are prepended with a * when they are listed by the ls command: restore > ls ./wahib: .Xdefaults .bash_logout .bashrc .bash_history .bash_profile *Personal/

To delete the current directory or specified argument from the list of files to be extracted, use the delete command. If a directory is specified, then all its descendents including itself are deleted from the extraction list, as shown below:


restore > cd Personal/
restore > ls
./wahib/Personal:
*Ad?le_Nakad.doc                        *Overview.doc
*BIMCOR/                                        *Resume/
*My Webs/                               *SAMS/
*Contents.doc                           *Templates/
*Divers.doc                             *bruno universite.doc
*Linux/                                 *My Pictures/

restore > delete Resume/
restore > ls
./wahib/Personal:
*Ad?le_Nakad.doc                        *Overview.doc
*BIMCOR/                                        Resume/
*My Webs/                               *SAMS/
*Contents.doc                           *Templates/
*Divers.doc                             *bruno universite.doc
*Linux/                                 *My Pictures/

Tip: The most expedient way to extract most of the files from a directory is to add the directory to the extraction list and then delete those files that are not needed.

To extract all files in the extraction list from the dump, use the extract command. Restore will ask which volume the user wishes to mount. The fastest way to extract a few files is to start with the last volume and work towards the first volume, as shown below:


restore > extract
You have not read any tapes yet.
Unless you know which volume your file(s) are on you should start
with the last volume and work towards the first.
Specify next volume #: 1
set owner/mode for '.'? [yn] y

To exit from the interactive restore mode after you have finished extracting your directories or files, use the quit command as shown below.


/sbin/restore > quit

Tip: Other methods of restoration exist with the dump program, consult the man page of dump for more information.

Further documentation, for more details, there are man pages you can read:

dump(8)

ext2 filesystem backup

restore(8)

restore files or file systems from backups made with dump