Linux dump command details

Source: Internet
Author: User

Function Description: backs up the file system.

Syntax: dump [-cnu] [-0123456789] [-B <block size>] [-B <block quantity>] [-d <density>] [-f <Device Name>] [-h <level>] [-s <tape length>] [-T <date>] [directory or file system] or dump [-wW]

Note: dump is a backup tool program that backs up a directory or entire file system to a specified device, or backs up a large file.
Parameters:
-0123456789 backup level.
-B <block size> specifies the block size, in KB.
-B <block quantity> specifies the number of blocks in the backup volume.
-C. Modify the preset density and capacity of the backup tape.
-D <density> sets the tape density. The Unit is BPI.
-F <Device Name> specifies the backup device.
-H <level> when the backup level is equal to or equal to the level specified by heavy rain, files marked as "nodump" by the user are not backed up.
-N when the backup job requires administrator intervention, send a notification to all users in the "operator" group.
-S <tape length> Backup Tape length, in feet.
-T <date> specifies the backup start time and date.
-After the u backup is complete, record the backup file system, level, date and time in/etc/dumpdates.
-W is similar to-W, but only displays the files to be backed up.
-W: displays the file to be backed up and the level, time, and date of the last backup.
Linux Study Notes BACKUP command dump/restore command restore

Dump can execute functions similar to tar. However, dump tends to consider file systems rather than individual files. The following content is taken from the dump manual file: "dump checks files on the ext2 file system and determines which files need to be backed up. These files will be copied to a given disk, tape, or other storage media for security protection ...... A dump larger than the output media capacity is divided into multiple volumes. In most media, the capacity is determined by writing until an end-of-media mark is returned ."

The program that works with dump is restore, which is used to restore files from the dump image.

The restore command executes the reverse function of the dump. You can restore the full backup of the file system first, and the subsequent Incremental Backup can overwrite the restored full backup. Individual files or directory trees can be restored from full or partial backups.

Dump and restore can both run on the network. Therefore, you can back up or restore data from a remote device. Dump and restore use tape drives and file devices that provide a wide range of options. However, both are only applicable to ext2 and ext3 file systems. If you are using JFS, Reiser, or other file systems, you will need other utilities, such as tar.

Use dump for backup
Using dump for backup is quite simple. The following command executes a full Linux backup, which backs up all ext2 and ext3 file systems to a SCSI tape device.


Dump 0f/dev/nst0/boot

Dump 0f/dev/nst0/

In this example, there are two file systems. One is for/boot and the other is for/, which is a common configuration. They must be referenced separately during Backup. /Dev/nst0 references the first SCSI tape drive, but it is referenced in non-rewinding mode. This ensures that each volume is arranged one by one on the tape.

An interesting feature of dump is its built-in Incremental backup function. In the preceding example, 0 indicates zero or basic backup. This is a full system backup. You need to regularly execute it to save the entire system. For subsequent backups, you can use other numbers (1-9) instead of 0 to change the backup level. Level 1 backup saves all files changed since the level 0 backup is executed. Level 2 backup saves all the files that have been changed since the level 1 backup is executed, and so on. Using tar and script can perform the same functions, but requires the script creator to provide a mechanism to determine when the last backup was executed. Dump has its own mechanism, that is, it Outputs An Update file (/etc/dumpupdates) during Backup ). This update file will be reset every time a backup of level 0 is executed. Subsequent backups will keep their tags until another backup of level 0 is executed. If you are performing a tape-based backup, dump will automatically track multiple volumes.

Skip File
You can mark the files and directories that will be skipped by dump. The command to achieve this goal is chattr, which changes the extended attributes on the ext2 and ext3 file systems.


Chattr + d <filename>

The preceding command adds a flag to the file so that dump skips the file during Backup.

Use restore for restoration
To restore the information saved by using dump, you can use the restore command. Like tar, dump can list (-t) the content of an archive file and compare it with the current file (-C ). When using dump, you must be careful when restoring data. There are two very different restoration methods. You must use the correct method to obtain predictable results.

Reconstruction (-r)
Remember, when designing dump, you should consider more file systems than separate files. Therefore, there are two different file restoration styles. To recreate a file system, use the-r command line switch. The purpose of design reconstruction is to operate on an empty file system and restore it to a saved state. You should have created, formatted, and mounted the file system before performing reconstruction. File systems that contain files should not be rebuilt.

The following is an example of using the dump executed above to perform full reconstruction.


Restore-rf/dev/nst0

The above command needs to be executed separately for each file system to be restored.

When necessary, you can repeat this process to add incremental backup.

Extract (-x)
To use separate files instead of the entire file system, you must use the-x switch to extract them. For example, to extract only the/etc directory from our tape backup, run the following command:


Restore-xf/dev/nst0/etc

Interactive restoration (-I)
Another feature provided by restore is the interactive mode. Run the following command:


Restore-if/dev/nst0

You will be placed in the interactive shell, and items included in the archive file will also be displayed. Enter "help" to display a command list. Then you can browse and select the items you want to extract. Remember that any files you extract will go to the current directory.


Example:
The dump command is a dedicated backup tool.

[Root @ laptop pyegrp] # dump-0-u-f/dev/hda3/home/pyegrp/
DUMP: Date of this level 0 dump: Sat Nov 30 19:45:56 2002
DUMP: Dumping/dev/hda9 (/home/pyegrp) to/dev/hda3
DUMP: Added inode 7 to exclude list (resize inode)
DUMP: Label: none
DUMP: mapping (Pass I) [regular files]
DUMP: mapping (Pass II) [directories]
DUMP: estimated 15492 tape blocks.
DUMP: Volume 1 started with block 1 at: Sat Nov 30 19:46:01 2002
DUMP: dumping (Pass III) [directories]
DUMP: dumping (Pass IV) [regular files]
DUMP: Closing/dev/hda3
DUMP: Volume 1 completed at: Sat Nov 30 19:46:13 2002
DUMP: Volume 1 15490 tape blocks (15.13 MB)
DUMP: Volume 1 took 0:00:12
DUMP: Volume 1 transfer rate: 1290 kB/s
DUMP: 15490 tape blocks (15.13 MB) on 1 volume (s)
DUMP: finished in 12 seconds, throughput 1290 kBytes/sec
DUMP: Date of this level 0 dump: Sat Nov 30 19:45:56 2002
DUMP: Date this dump completed: Sat Nov 30 19:46:13 2002
DUMP: Average transfer rate: 1290 kB/s
DUMP: DUMP IS DONE

-0 indicates the backup level. Backup parameters are updated after 0-9 and 0. Commonly Used values include 0 and 9.
-U writes the backup records to the/etc/dumpdates file.

[Root @ laptop pyegrp] # cat/etc/dumpdates
/Dev/hda9 0 Sat Nov 30 19:45:56 2002
/Dev/hda9 9 Sat Nov 30 17:04:20 2002

Note: When the backup directory is a sub-directory rather than the top-level directory of a partition, the-u Parameter
Is not usable.

-F specifies the file to which the backup is made. You can also specify a device file. What I specify here is a partition.

Update backup:
Write some new files to/home/pyegrp Based on the zero-level backup, and then
Umount/home/pyegrp
Mount/home/pyegrp
Note that if this is not done, the newly written files will not be backed up.
Then:
[Root @ laptop pyegrp] # dump-9-u-f/dev/hda3/home/pyegrp/
Use restore tf/dev/hda3
The newly written file will appear in the list.

The restore command is used to restore the backup.
[Root @ laptop pyegrp] # restore rf/dev/hda3/home/pyegrp

Use the restore command to view the file list in the backup file
[Root @ laptop pyegrp] # restore ft/dev/hda3

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.