Backing Up Files with dump


The dump command was historically one of the most commonly used tools for performing backups on UNIX systems. This command traces its history back to the early days of UNIX and thus is a standard part of nearly every version of UNIX. Likewise, the dump package is included in Fedora and Red Hat Linux. If it was not installed by default when you first set up your Linux system, you can install it from the dump RPM file located on the Fedora Linux installation DVD.

Note 

The dump and restore commands, while widely used for many years, are not considered to be particularly reliable or robust backup and restore tools these days. Descriptions of those tools are included here to support those with legacy backup media and automated scripts that still use those commands.

The dump package actually consists of several commands. You can read online man pages for more information about them. Table 13-2 provides a short description of the programs.

Table 13-2: Programs in the dump Package

Command

Description

dump

Creates backup archives of whole disk partitions or selected directories.

restore

Can be used to restore an entire archive or individual files from an archive to the hard drive.

rmt

A program used by the dump and restore commands to copy files across the network. You should never need to use this command directly.

Creating a backup with dump

When making a file system backup using the dump command, you must supply parameters specifying the dump level, the backup media, and the file system to back up. You can also supply optional parameters to specify the size of the backup media, the method for requesting the next tape, and the recording of file system dump times and status.

The first parameter to dump is always a list of single-letter option codes. This is followed by a space-separated list of any arguments needed by those options. The arguments appear in the same order as the options that require them. The final parameter is always the file system or directory being backed up.

# dump options arguments filesystem 

Table 13-3 lists the various one-letter option codes for the dump command.

Table 13-3: Options to dump

Dump Options

Description

0-9

The dump level. Selecting a dump level of 0 backs up all files (a full dump). A higher number backs up only those files modified since the last dump of an equal or lower number (in essence, an incremental dump). The default dump level is 9.

-B records

The number of dump records per volume. Basically, the amount of data you can fit on a tape. This option takes a numeric argument.

-b kbperdump

The number of kilobytes per dump record. Useful in combination with the -B option. This option takes a numeric argument.

-h level

Files can be marked with a nodump attribute. This option specifies the dump level at or above which the nodump attribute is honored. This option takes a numeric argument of 1-9.

-f file

The name of the file or device to write the dump to. This can even be a file or device on a remote machine.

-d density

Sets the tape density. The default is 1600 bits per inch. This option takes a numeric argument.

-n

When a dump needs attention (such as to change a tape), dump will send a message to all of the users in the operator group. This option takes no arguments.

-s feet

Specifies the length in feet of the dump tape. This calculation is dependent on tape density (option d) and the dump record (options B and b). This option takes a numeric argument.

-u

Record this backup in the /etc/dumpdates file. It is a good idea to use this option, especially if you create incremental backups.

-t date

Specify a date and time on which to base incremental backups. Any files modified or added after that time will be backed up. This option causes dump to ignore the /etc/dumpdates file. It takes a single argument, a date in the format specified by the ctime man page.

-W

This option causes dump to list the file systems that need to be backed up. It does this by looking at the /etc/dumpdates file and the /etc/fstab file.

-w

This works like the W option but lists the individual files that should be backed up.

Thus, a typical dump command may look similar to the following:

 # dump 0uBf 500000 /dev/qft0 /dev/hda6 

This command results in dump performing a level zero (full) backup of the /dev/hda6 file system, storing the backup on the tape drive /dev/qft0, and recording the results in /etc/dumpdates. The B option is used to increase the expected tape block count to 500000; otherwise, dump would prompt for a new tape far earlier than required. The dump command prints status messages to the screen, letting you know how far along the backup has progressed and estimating how much time it will take to complete. The output looks similar to this:

 DUMP: Date of this level 0 dump: Sat Aug 23 23:33:37 2003   DUMP: Dumping /dev/hda6 (/home) to /dev/qft0   DUMP: Exclude ext3 journal inode 8   DUMP: Label: /home   DUMP: mapping (Pass I) [regular files]   DUMP: mapping (Pass II) [directories]   DUMP: estimated 93303 tape blocks on 0.19 tape(s).   DUMP: Volume 1 started with block 1 at: Sat Aug 23 23:33:47   DUMP: dumping (Pass III) [directories]   DUMP: dumping (Pass IV) [regular files]   DUMP: Closing /dev/qft0   DUMP: Volume 1 completed at: Sat Aug 23 23:35:35 2003   DUMP: Volume 1 94360 tape blocks (92.15MB)   DUMP: Volume 1 took 0:01:48   DUMP: Volume 1 transfer rate: 873 kB/s   DUMP: 94360 tape blocks (92.15MB) on 1 volume(s)   DUMP: finished in 108 seconds, throughput 873 kBytes/sec   DUMP: Date of this level 0 dump: Sat Aug 23 23:33:37 2003   DUMP: Date this dump completed: Sat Aug 23 23:35:35 2003   DUMP: Average transfer rate: 873 kB/s   DUMP: DUMP IS DONE 

Understanding dump levels

The dump command can back up all files on a file system, or it can selectively back up only those files that have changed recently. The dump level parameter is used to specify this behavior. A dump level of 0 results in a full backup of all files on the file system. Specifying a higher number (1-9) backs up only those files that have been changed or added since the most recent dump of the same or lower dump level. I recommend you use dump levels to implement a full and incremental backup schedule similar to the one shown in Table 13-4.

Table 13-4: Recommended dump Schedule

Day of Week

Dump Level

Sunday

Level 0 (full dump). Eject the tape when done.

Monday

Level 9 (incremental dump).

Tuesday

Level 8 (incremental dump).

Wednesday

Level 7 (incremental dump).

Thursday

Level 6 (incremental dump).

Friday

Level 5 (incremental dump).

Saturday

Level 4 (incremental dump).

Note that after the full backup on Sunday, a level 9 incremental dump is done the next day, and a successively lower dump level is done each day after that. This results in all the files that have changed since Sunday being backed up on every single incremental backup. Each incremental backup is thus larger than the previous one; the backup contains all of the files from the previous incremental backup plus any files that have changed since then. This may seem wasteful of storage space on the backup tape, but it will save a lot of time and effort should there be a need to restore the file system.

For example, imagine that your hard drive crashed on Friday. After replacing the hard drive, you can restore the entire file system in two steps: restore the full backup from the prior Sunday, and then the most recent incremental backup from Thursday. You can do this because Thursday’s backup contains all of the files from Monday, Tuesday, and Wednesday’s tape as well as the files that changed after that. If the dump levels had progressed in positive order (level 1 for Monday, level 2 for Tuesday, and so on), all of the incremental backups would have to be restored in order to restore the file system to its most current state.




Red Hat Fedora Linux 3 Bible
Red Hat Fedora Linux 3 Bible
ISBN: 0764578723
EAN: 2147483647
Year: 2005
Pages: 286

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net