Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The usage of dump command in Linux system

2025-01-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "the usage of dump command in Linux system". The content of the explanation in this article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn the usage of dump command in Linux system.

Dump

Check the ext2/3/4 file system to determine which files need to be backed up. These files that need to be backed up will be copied to the specified disk or other storage media. Dump examines the files on the Ext 2-3-4 file system and determines which files need to be backed up. These files are copied to a given disk, tape, or other storage medium to ensure safe preservation (see the-f option below for remote backup). Dumps larger than the output medium are decomposed into a plurality of volumes. On most media, the size is determined by writing until the media end instruction is returned.

On media that cannot reliably return media end instructions (such as some cartridge drives), each volume is of a fixed size; the actual size is determined by specifying the ink cartridge media or by the tape size, density, and / or block count options below. By default, each volume uses the same output file name after prompting the operator to change the media.

The scope of this command: RedHat, RHEL, Ubuntu, CentOS, SUSE, openSUSE, Fedora.

1. Grammar

Dump [option] [- f target file] source file

Dump [- level#] [- ackMnqSuv] [- A file] [- B records] [- b blocksize] [- d density] [- D file] [- e inode numbers] [- E file] [- F file] [- h level] [- I nr errors] [- jcompression level] [- L label] [- Q file] [- s feet] [- T date] [- y] [- zcompression level] files-to-dump

Dump [- W |-w]

The files-to-dump is either the mount point of the file system or the list of files and directories to back up as a subset of the file system. In the former case, you can use the path where the file system is mounted or the device where the file system is unmounted. In the latter case, some restrictions are imposed on backups:-u is not allowed, the only supported dump level is 0, and all files and directories must reside on the same file system.

2. List of options

Option

Description

-level#

Backup level. If 0, the entire file system is backed up; if it is greater than 0, the new and modified files that were backed up at a lower level than the previous one are backed up. The default is 0. Only level 0 backups are allowed in subdirectories

-a

Automatic size. Bypass all tape length calculations and write until the media end instruction returns. This is the most suitable for most modern tape drives, which is the default. This option is especially recommended when attaching to an existing tape or using a tape drive with hardware compression (in which case you can never determine the compression ratio).

-An archive_file

Archive the content dump Table in the specified file, which is used by RESTORE (8) to determine whether the file is in the dump file being restored.

-b blocksize

Kilobytes per dump record. The default block size is 10 unless the-d option has been used to specify a tape density of 6250 BPI or higher, in which case the default block size is 32. Note, however, that because the IO system splits all requests into blocks of MAXBSIZE (which can be as low as 64 KB), you may experience dump (8) and recovery (8) problems when using higher values, depending on the kernel and / or libC version.

-B records

The number of 1 kB blocks per volume. It is usually not necessary because the dump can detect the end of the media. When the specified size is reached, dump will wait for you to change the volume. This option overrides tape size calculations based on length and density. If compression limits the size of the compressed output of each volume. Multiple values can be given as a parameter separated by a comma. Each value will be used for one dump volume in the order listed, and if the dump creates more volumes than the given number of values, the remaining volumes will use the last value. This is useful for populating partially populated media (and then continuing to use full-size volumes on empty media) or mixing media of different sizes.

-c

Change the default tape drive to a density of 8000 BPI and a length of 1700 feet. Specifies that the ink cartridge drive will override media-side detection.

-d density

Sets the tape density. The default is 1600 BPI. Specifies that the tape density will override media-side detection.

-D file

Sets the pathname of the file that stores information about the previous full dump and incremental dump. The default location is / etc/dumpdate

-e inodes

Does not contain the specified inodes. The inodes parameter is a comma-separated list of inode numbers

-E file

Read the list of inode to exclude when backing up from a text file. This file should be a normal file with inode numbers separated by newline characters.

-f filename

Write the backup to a file; the file may be a special device file, such as / dev/st0 (atAPE drive), / dev/rsd1c (floppy drive), plain file, or-(standard output). Multiple file names can be used as a parameter separated by commas. Each file will be used for one dump volume in the order listed, and if the number of volumes required for the dump exceeds the given number of names, the last file name will be used for all remaining volumes when prompted for media changes. If the name of the file is "host:file" or "user@host:file", dump writes to the named file on the remote host (it should already exist, so the dump will not use RMT (8) to create a new remote file). The default pathname of the remote RMT (8) program is "/ etc/rmt"; this can be overridden by the environment variable RMT

-F script

Run the script at the end of each tape (except the last one). The device name and the current volume number are passed on the command line. The script must return 0 if the dump should continue without requiring the user to change the tape, or 0 if the dump should continue. Change the tape. Any other exit code will cause the dump to abort. For security reasons, the dump returns to the actual user ID and the real group ID before running the script.

-h level

The user node flag UF_NODUMP is granted only for dumps of a given level or above. The default honor level is 1, so the incremental backup omits these files, but the full backup retains them. When a given backup level is greater than the level specified by this-h, files marked "UF_NODUMP" are not backed up.

-I nr_errors

By default, the dump ignores the first 32 read errors on the file system before requesting operator intervention. You can use this flag to change it to any value. This is useful when running a dump on the active file system because the read error simply indicates an inconsistency between the mapping and the dump transfer. 0, which means to ignore all errors

-jcompression_level

Use the bzlib library to compress each block to be written to the tape. This option works only when a file or pipe is dumped to a file or pipe, or when a tape drive is dumped to a tape drive, if the tape drive can write to a variable length block. You need at least a restore of the 0.4b24 version to extract the compressed tape. Tapes written with compression will not be compatible with the BSD tape format. The (optional) parameter specifies the level of compression that bzlib will use. The default compression level is 2. If an optional parameter is specified, there should be no space between the option letter and the parameter.

-k

Use Kerberos authentication to talk to the remote tape server. (available only when this option is enabled when compiling dumps.)

-L label

The user-supplied text string label label is placed in the dump header, where tools such as RESTORE (8) and FILE (8) can access it. Please note that this tag is limited to LBLSIZE (currently 16) characters, which must include termination\ 0

-m

If this flag is specified, dump optimizes the output of inode that has changed but not modified since the last dump (the meaning of "changed" and "modified" is defined in stat (2)). For these inode,dump, only the metadata will be saved, not the entire inode content. The use of this flag must be consistent, which means that every dump in the incremental dump set has the flag, or no one owns it.

If you use this option, note that many programs that extract files from archives (such as tar, rpm, unzip, dpkg) may set the file's mtime to a past date. If the modified mtime is dumped earlier than the previous level, files installed in this way may not be dumped correctly using "dump-m". Tapes written using this "metadata" inode will not be compatible with bsd tape format or earlier versions of restores.

-M

Enable the multi-volume feature. The name specified with "- f" is treated as a prefix and is written to 001002 in order, and so on. This is useful when dumping files to files on the Ext 2-3-4 partition to bypass the 2GB file size limit

-n

Whenever the dump requires operator attention, all operators in the group operator are notified in a manner similar to wall (1).

-Q

Abort the dump immediately whenever the operator's attention is required without prompting for write errors, tape changes, and so on.

-Q file

Enable fast file access support. The tape location of each inode is stored in the file used by RESTORE (if called with parameter Q and file name) to position the tape directly in the file recovery currently in progress. This will save time restoring individual files from large backups and saving tape and drive heads.

It is recommended that the st driver be set to return to the logical tape location instead of the physical tape location before invoking the dump / restore with parameters. Because not all tape devices support physical tape locations, these tape devices return an error during dump / restore when the st driver is set to the default physical setting. See the st (4) man page, option MTSETDRVBUFFER. , or the mt (1) man page, describes how to set the driver to return to the logical tape location. Before calling RESTORE with the parameter "- Q", always make sure that the st driver is set to return the same type of tape location used during the call dump. Otherwise, the restore may be confused.

This option can be used when dumping to a local tape (see above) or a local file.

-s feet

An attempt is made to calculate the number of tapes required at a specific density. If this number is exceeded, the dump prompts for a new tape. It is recommended that this option be a little conservative. The default tape length is 2300 feet. The specified tape size will override the media-side detection.

-S

Size estimate. Determines the amount of space required to perform the dump without actually performing the dump and displays the estimated number of bytes it will occupy. This is useful for incremental dumps to determine how many volumes of media are required.

-T date

Specify the date of the backup. Uses the specified date as the start time for the dump, rather than the time determined from View / etc/dumpdate. The format of the date is the same as that of ctime (3), followed by the rfc 822 time zone specification: a plus or minus sign, followed by two-digit hours and two-digit minutes. For example, eight hours west of Greenwich is 0800 hours, and two and a half hours east of Greenwich is 0230 hours. This time zone setting takes into account daylight saving time (if applicable to the time zone): when daylight saving time takes effect, the UTC offset will be different from the offset value when daylight saving time is invalid. For backward compatibility, local time is assumed if no time zone is specified. This option is useful for automatic dump scripts that want to be dumped within a specific time. The-T option and the-u option are mutually exclusive.

-u

After the backup is complete, record the file system and date of the backup in / etc/dumpdates. People can read the format of / etc/dumpdate, including one free format record per line: file system name, incremental level, and ctime (3) format dump date, followed by the rfc 822 time zone specification (see the-u option for details). If no time zone offset is specified, the time is interpreted as local time. Whenever a file is written, all dates in the file are converted to the local time zone without changing the UTC time. Each file system may have only one entry at each level. If desired, you can edit the / etc/dumpdate file to change any field.

-v

Display detailed information to help debug errors

-W

Displays the most recent backup time and level, and detects the files that need to be backed up. When the W option appears, all other options are ignored. The dump tells the operator which file systems need to be dumped. This information is collected from the files "/ etc/dumpdate" and "/ etc/fsman". The-W option causes all file systems in "/ etc/dumpdate" and all file systems in "/ etc/mtab" as well as file systems identified in "/ etc/mtab" and "/ etc/fstat" to be printed. The most recent dump date and level highlights the file system that should be dumped.

-w

Similar to "- W", but only prints recognizable file systems that need to be dumped in "/ etc/mtab" and "/ etc/fstat".

-y

Use the lzo library to compress each block to write to the tape. This cannot be compressed like the zlib library, but it is much faster. This option works only when a file or pipe is dumped to a tape drive, or when the tape drive can write to a variable-length block. You need at least a restore of the 0.4b34 version to extract the compressed tape. Tapes written with compression will not be compatible with the bsd tape format.

-zcompression level

Use the zlib library to compress each block to be written to the tape. This option works only when a file or pipe is dumped to a file or pipe, or if the tape drive can write to a variable-length block when a tape drive is dumped to a tape drive. You will need at least a 0.4b22 version of the recovery to extract the compressed tape. Tapes written with compression will not be compatible with the BSD tape format. The (optional) parameter specifies the level of compression that zlib will use. The default compression level is 2. If an optional parameter is specified, there should be no space between the option letter and the parameter.

3. Description

Dump requires the operator to intervene in the following conditions: tape end, dump end, tape write error, tape open error, or disk read error (if there is an nr error above the threshold). In addition to notifying all operators implied by the-n key, the dump interacts with the operator on the dump control terminal when the dump cannot continue, or when a serious error occurs. All question dump components must be answered appropriately by typing "Yes" or "No".

Because it takes a lot of time and effort to make a dump, the checkpoint is dumped at the beginning of each tape volume. If writing to the volume fails for some reason, the dump restarts from the checkpoint after the old tape is remounted and deleted and the new tape is installed, with the permission of the operator.

Dump tells the operator what is happening at periodic intervals, including usually low estimates of the number of blocks to write, the number of tapes required, the completion time, and the tape change time. The output is lengthy, so others know that terminal-controlled dumps are busy and last for some time.

In the event of a catastrophic disk event, the time required to restore all necessary backup tapes or files to disk can be kept to a minimum by staggered incremental dumps. An effective way to minimize the number of tapes for incremental dumps is as follows:

1) always start with a level 0 backup, for example: "/ sbin/dump-0u-f / dev/st0 / usr/src". This should be done at regular intervals, such as once a month or every two months, and on a new set of tapes that are permanently preserved.

2) after level 0, the active file system is dumped every day and this dump level sequence is used: "3 2 5 4 7 6 9 8 9 9 9."

After a few months or so, daily and weekly tapes should be rotated out of the dump cycle and new tapes should be brought in.

4. Environmental variables

1) TAPE. If the "- f" option is not specified, dump uses the device specified through TAPE as the dump device. TAPE can be the name of the tape, host:tapename, user@host:tapename.

2) RMT. The environment variable RMT will be used to determine the pathname of the remote rmt (8) program.

3) RSH. Dump uses the contents of this variable to determine the name of the remote shell command (rsh, ssh, and so on) to use for remote backup. If this variable is not set, rcmd (3) is used, but only root can make remote backups.

5. Files

1) / dev/st0, the default tape unit to back up to.

2) date record of / etc/dumpdates,dump.

3) / etc/fstab, dump table: file system and frequency

4) / etc/mtab, dump table: mounted file system

5) / etc/group, find the group operator

6. Exit code

The dump status is zero on success. The startup error is indicated by the exit code 1; the abnormal termination is indicated by the exit code 3.

When a read error occurs, the dump outputs the corresponding physical block and sector number, as well as the Ext 2-3-4 logical block number. It does not print the corresponding file name, or even the inode number. The user must use the debugger (8) to command nCheck and icheck to convert the ext2blk number from the dump output to the inode number, and then to the file name.

Each scroll needs a new process, so the parent process of the scroll has been written just hanging together until the entire tape is written. If compressed to ON, the estimated number of tapes is incorrect. If dump knew the dump sequence, it would be fine, keep tracking tapes, tell operators what tapes to install, and provide more help to operators running the recovery.

Due to the security history of the dump, it cannot make a remote backup without running as the root user. Currently, if you set up setuid (as before), it will work, but this may pose a security risk. Note that rsh can be set to use a remote shell program.

7 、 bug

This version of dump can only handle the Ext 2-3-4 file system, which may be considered an error. Specifically, it does not apply to the FAT file system. Ignore fewer than 32 read errors on the file system (change this error with-I). If it is important to note that read errors are important, you can parse the output of the dump to find lines that contain the text "read errors."

8. Examples

Backup directory / weijie

[root@localhost /] # dump-0f / bak/1.bak / weijie/ backup to 1.bak

DUMP: Date of this level 0 dump: Fri Sep 7 09:26:15 2018

DUMP: Dumping / dev/mapper/VolGroup-lv_root (/ (dir weijie)) to / bak/1.bak

DUMP: Label: none

DUMP: Writing 10 Kilobyte records

DUMP: mapping (Pass I) [regular files]

DUMP: mapping (Pass II) [directories]

DUMP: estimated 418 blocks.

DUMP: Volume 1 started with block 1 at: Fri Sep 7 09:26:15 2018

DUMP: dumping (Pass III) [directories]

DUMP: dumping (Pass IV) [regular files]

DUMP: Closing / bak/1.bak

DUMP: Volume 1 completed at: Fri Sep 7 09:26:15 2018

DUMP: Volume 1 410 blocks (0.40MB)

DUMP: 410 blocks (0.40MB) on 1 volume (s)

DUMP: finished in less than a second

DUMP: Date of this level 0 dump: Fri Sep 7 09:26:15 2018

DUMP: Date this dump completed: Fri Sep 7 09:26:15 2018

DUMP: Average transfer rate: 0 kB/s

DUMP: DUMP IS DONE

You have new mail in / var/spool/mail/root

[root@localhost weijie] # file / bak/1.bak / / View backup files

/ bak/1.bak: new-fs dump file (little endian), This dump Fri Sep 7 09:26:15 2018, Previous dump Thu Jan 1 08:00:00 1970, Volume 1, Level zero, type: tape header, Label none, Filesystem / (dir weijie), Device / dev/mapper/VolGroup-lv_root, Host localhost.localdomain, Flags 3

Thank you for reading, the above is the content of "the usage of dump command in Linux system". After the study of this article, I believe you have a deeper understanding of the usage of dump command in Linux system, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report