Click Here!
home account info subscribe login search My ITKnowledge FAQ/help site map contact us


 
Brief Full
 Advanced
      Search
 Search Tips
To access the contents, click the chapter and section titles.

Complete Idiot's Guide to Linux
(Publisher: Macmillan Computer Publishing)
Author(s): Manuel Ricart
ISBN: 078971826x
Publication Date: 12/22/98

Bookmark It

Search this book:
 
Previous Table of Contents Next


dump Examples

The following command will create a level 0 dump (indicated by the 0) on the device specified by the -f flag (in this case /dev/nst0) of the specified disk /dev/hda1 (see /etc/fstab for the name of your disk devices):

     dump -0u -f /dev/nst0 -s 112778 /dev/hda1

Replace nst0 with the appropriate name for your tape device and hda1 with the device used by your root partition. This dump will include all the files found on the device. If you have additional disks, you’ll have to run dump again for each. If you specify the u option and the backup finishes successfully, dump will remember the date, time, and level of this backup. This effectively sets a starting point that can be used to evaluate which files need to be dumped next time.

To create an incremental backup that includes only files modified since the last backup of a lower level, in this case 0, use a higher level dump:

By default, dump writes its output to the default tape unit; you need to remember to specify the -f option followed by the device for your tape drive.

You can redirect the backup to a file using the -f option:

     dump -9uf /tmp/backup /dev/hda1

The preceding command will create a file called backup in the /tmp directory. To redirect the output of dump to STDOUT (standard output), specify a dash (-) instead of a filename:

     dump -9uf - /dev/hda1 | gzip > /dev/st0

In the preceding example, output from dump was sent to STDOUT and piped to the gzip (see Chapter 20, “Installing Programs and Applications”) program to be compressed. If your tape doesn’t provide hardware compression, using the preceding command can be an effective way of increasing tape capacity.

For complete information on the myriad of options that dump provides, read your system’s documentation.

The restore Command

To extract files backed up with dump, use restore. The restore copies files stored in a dump tape or file to the current directory. It’s important to note that using restore can, and will, clobber existing files with matching names. Restore will also create any directories or directory trees that it needs before extracting a file. This feature is powerful if you know what you are doing. When in doubt, extract files using restore to an empty directory and move the files by hand. Restore has the following syntax:

     restore [options [argument …]]

To specify the device holding your backup, use the -f option and follow it by the location of your dump.

The restore command has an easy-to-use interactive shell-like interface that allows you to navigate through the dump tape as if you were in a file system. The interactive session is started by using the -i option:

     restore -f /dev/nst0 -i

When restore loads, you can use commands such as cd and ls to move around the tape catalog. These commands are built into restore and are not the same ones you use on a shell.

To add a file to a list of files you wish to extract (restore), type add filename, where filename is the name of the file you want to extract. If you add a directory, all files and directories it contains are added. To remove files from a list, type del filename. This command doesn’t delete the file from the tape; it just removes it from the extract list. To extract the files, just type extract. At the end of the extraction, you will be asked if you want to set the owner/mode for ‘.’?[yn] You should respond no, as this could change the owner and mode of the directory where restore is going to extract files from.

Here’s a sample session:

     1: [root@digital /tmp]# restore -i -f /dev/nst0
     2: restore > ls
     3: .:
     4: auto/ dev/  etc/  home/ root/ tmp/  var/
     5: restore > add home
     6: restore > ls
     7: .:
     8:  auto/  dev/   etc/  *home/  root/  tmp/   var/
     9:
    10: restore > del home
    11: restore > ls
    12: .:
    13: auto/ dev/  etc/  home/ root/ tmp/  var/
    14:
    15: restore > cd home/alberto/test
    16: restore > ls
    17: ./home/alberto/test:
    18: afile
    19:
    20: restore > add afile
    21: restore > extract
    22: You have not read any tapes yet.
    23: Unless you know which volume your file(s) are on you should start
    24: with the last volume and work towards the first.
    25: Specify next volume #: 1
    26: restore > quit
    27: [root@digital /tmp]# ls
    28: home
    29: [root@digital /tmp]# cd home/alberto/test
    30: [root@digital test]# ls
    31: afile

The version of restore shipped with my version of Linux has a problem. If you try to add a file, it will give you an error message. The workaround is to add a directory such as home (see line 5 of the previous listing). Note that when you add a file or a directory, restore marks it by placing a star (*) next to it (see line 8). After adding this directory, delete it (see line 10). Then you can go ahead and add files as you want. Parent directories will be automatically added. When you are done making your file selection, type extract (see line 21). Dump will ask you to read a tape. If your dump only spans one tape, type 1; otherwise, type the number of the last tape you used for this dump. To get information on a dump, type what. To get help on an interactive restore, type help or ?, which will print the following information:

     restore > ?
     Available commands are:
             ls [arg] - list directory
             cd arg - change directory
             pwd - print current directory
             add [arg] - add `arg' to list of files to be extracted
             delete [arg] - delete `arg' from list of files
              to be extracted
             extract - extract requested files
             setmodes - set modes of requested directories
             quit - immediately exit program
             what - list dump header information
             verbose - toggle verbose flag (useful with ``ls'')
             help or `?' - print this list
     If no `arg' is supplied, the current directory is used


Previous Table of Contents Next


Products |  Contact Us |  About Us |  Privacy  |  Ad Info  |  Home

Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc.
All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited. Read EarthWeb's privacy statement.