Next | Prev | Up | Top | Contents | Index

Saving Data With xfsdump

This section discusses how to use the xfsdump command to back up data to local and remote devices. You can get a summary of xfsdump syntax with the -h option:

# xfsdump -h
xfsdump: version X.X
xfsdump: usage: xfsdump [ -f <destination> ... ]
               [ -h (help) ]
               [ -l <level> ]
               [ -p <seconds between progress reports> ]
               [ -s <subtree> ... ]
               [ -v <verbosity {silent, verbose, trace}> ]
               [ -A (don't dump extended file attributes) ]
               [ -B <base dump session id> ]
               [ -E (pre-erase media) ]
               [ -F (don't prompt) ]
               [ -I (display dump inventory) ]
               [ -J (inhibit inventory update) ]
               [ -L <session label> ]
               [ -M <media label> ... ]
               [ -O <options file> ]
               [ -R (resume) ]
               [ -T (don't timeout dialogs) ]
               [ -Y <I/O buffer ring length> ]
               [ - (stdout) ]
               [ <source (mntpnt|device)> ]
You must be the superuser to use xfsdump. Refer to the xfsdump(1M) reference page for details.


Specifying Local Media

You can use xfsdump to back up data to various media. For example, you can dump data to a tape or hard disk. The drive containing the media object may be connected to the local system or accessible over the network.

Following is an example of a level 0 dump to a local tape drive. Note that dump level does not need to be specified for a level 0 dump. (Refer to "Incremental Backups With dump" for a discussion of dump levels.)

# xfsdump -f /dev/tape -L testers_11_21_94 -M test_1 /disk2
xfsdump: version 2.0 - type ^C for status and control
xfsdump: level 0 dump of cumulus:/disk2
xfsdump: dump date: Wed Oct 25 16:19:13 1995
xfsdump: session id: d2a6123b-b21d-1001-8938-08006906dc5c
xfsdump: session label: "testers_11_21_94"
xfsdump: ino map phase 1: skipping (no subtrees specified)
xfsdump: ino map phase 2: constructing initial dump list
xfsdump: ino map phase 3: skipping (no pruning necessary)
xfsdump: ino map phase 4: skipping (size estimated in phase 2)
xfsdump: ino map phase 5: skipping (only one dump stream)
xfsdump: ino map construction complete
xfsdump: preparing drive
xfsdump: creating dump session media file 0 (media 0, file 0)
xfsdump: dumping ino map
xfsdump: dumping directories
xfsdump: dumping non-directory files
xfsdump: ending media file
xfsdump: media file size 16777216 bytes
xfsdump: dumping session inventory
xfsdump: beginning inventory media file
xfsdump: media file 1 (media 0, file 1)
xfsdump: ending inventory media file
xfsdump: inventory media file size 4194304 bytes
xfsdump: writing stream terminator
xfsdump: beginning media stream terminator
xfsdump: media file 2 (media 0, file 2)
xfsdump: ending media stream terminator
xfsdump: media stream terminator size 2097152 bytes
xfsdump: I/O metrics: 3 by 2MB ring; 14/22 (64%) records streamed; 145889B/s
xfsdump: dump complete: 141 seconds elapsed
In this case, a session label (-L option) and a media label (-M option) are supplied, and the entire filesystem is dumped. Since no verbosity option is supplied, the default of verbose is used, resulting in the detailed screen output. The dump inventory is updated with the record of this backup because the -J option is not specified.

Following is an example of a backup of a subdirectory of a filesystem. In this example, the verbosity is set to silent, and the dump inventory is not updated (-J option):

# xfsdump -f /dev/tape -v silent -J -s people/fred /usr
Note that the subdirectory backed up (/usr/people/fred) was specified relative to the filesystem, so the specification did not include the name of the filesystem (in this case, /usr). Since /usr may be a very large filesystem and the -v silent option was used, this could take a long time during which there would be no screen output.


Specifying a Remote Tape Drive

To back up data to a remote tape drive, use the standard remote system syntax, specifying the system (by hostname if supported by a name server or IP address if not) followed by a colon (:), then the pathname of the special file.

Note: For remote backups, use the variable block size tape device if the device supports variable block size operation; otherwise, use the fixed block size device (see intro(7)). The following example shows a subtree backup to a remote tape device:

# xfsdump -f magnolia:/dev/tape -L mag_10-95 -s engr /disk2
xfsdump: version 2.0 - type ^C for status and control
xfsdump: level 0 dump of cumulus:/disk2
xfsdump: dump date: Wed Oct 25 16:27:39 1995
xfsdump: session id: d2a6124b-b21d-1001-8938-08006906dc5c
xfsdump: session label: "mag_10-95"
xfsdump: ino map phase 1: parsing subtree selections
xfsdump: ino map phase 2: constructing initial dump list
xfsdump: ino map phase 3: pruning unneeded subtrees
xfsdump: ino map phase 4: estimating dump size
xfsdump: ino map phase 5: skipping (only one dump stream)
xfsdump: ino map construction complete
xfsdump: preparing drive
xfsdump: positioned at media file 0: dump 0, stream 0
xfsdump: positioned at media file 1: dump 0, stream 0
xfsdump: positioned at media file 2: dump 0, stream 0
xfsdump: stream terminator found
xfsdump: creating dump session media file 0 (media 0, file 2)
xfsdump: dumping ino map
xfsdump: dumping directories
xfsdump: dumping non-directory files
xfsdump: ending media file
xfsdump: media file size 6291456 bytes
xfsdump: dumping session inventory
xfsdump: beginning inventory media file
xfsdump: media file 1 (media 0, file 3)
xfsdump: ending inventory media file
xfsdump: inventory media file size 4194304 bytes
xfsdump: writing stream terminator
xfsdump: beginning media stream terminator
xfsdump: media file 2 (media 0, file 4)
xfsdump: ending media stream terminator
xfsdump: media stream terminator size 2097152 bytes
xfsdump: I/O metrics: 3 by 2MB ring; 12/22 (55%) records streamed; 99864B/s
xfsdump: dump complete: 149 seconds elapsed
In this case, /disk2/engr is backed up to the variable block size tape device on the remote system magnolia. Existing dumps on the tape mounted on magnolia were skipped before recording the new data.

Note: The superuser account on the local system must be able to rsh to the remote system without a password. For more information, see hosts.equiv(4).


Backing Up to a File

You can back up data to a file instead of a device. In the following example, a file (Makefile) and a directory (Source) are backed up to a dump file (monday_backup) in /usr/tmp on the local system:

# xfsdump -f /usr/tmp/monday_backup -v silent -J -s \
people/fred/Makefile -s people/fred/Source /usr
You may also dump to a file on a remote system, but note that the file must be in the remote system's /dev directory. For example, the following command backs up the /usr/people/fred subdirectory on the local system to the regular file /dev/fred_mon_12-2 on the remote system theduke:

# xfsdump -f theduke:/dev/fred_mon_12-2 -s people/fred /usr
Alternatively, you could dump to any remote file if that file is on an NFS-mounted filesystem. In any case, permission settings on the remote system must allow you to write to the file.

Refer to the section "Using xfsdump and xfsrestore to Copy Filesystems" for information on using the standard input and standard output capabilities of xfsdump and xfsrestore to pipe data between filesystems or across the network.


Reusing Tapes

When you use a new tape as the media object of a dump session, xfsdump begins writing dump data at the beginning of the tape without prompting. If the tape already has dump data on it, xfsdump begins writing data after the last dump stream, again without prompting.

If, however, the tape contains data that is not from a dump session, xfsdump prompts you before continuing:

# xfsdump -f /dev/tape /test 
xfsdump: version X.X - type ^C for status and control
xfsdump: dump date: Fri Dec 2 11:25:19 1994
xfsdump: level 0 dump
xfsdump: session id: d23cc072-b21d-1001-8f97-080069068eeb
xfsdump: preparing tape drive
xfsdump: this tape contains data that is not part of an XFS dump
xfsdump: do you want to overwrite this tape?
type y to overwrite, n to change tapes or abort (y/n):
You must answer y if you want to continue with the dump session, or n to quit. If you answer y, the dump session resumes and the tape is overwritten. If you do not respond to the prompt, the session eventually times out. Note that this means that an automatic backup, for example one initiated by a crontab entry, will not succeed--unless you specified the -F option with the xfsdump command, which forces it to overwrite the tape rather than prompt for approval.


Erasing Used Tapes

Erase preexisting data on tapes with the mt erase command. Make sure the tape is not write-protected.

For example, to prepare a used tape in the local default tape drive, enter:

# mt -f /dev/tape erase

Caution: This erases all data on the tape, including any dump sessions. The tape can now be used by xfsdump without prompting for approval.


Incremental and Resumed Dumps

Incremental dumps are a way of backing up less data at a time but still preserving current versions of all your backed-up files, directories, and so on. Incremental backups are organized numerically by levels from 0 through 9. A level 0 dump always backs up the complete filesystem. A dump level of any other number backs up all files that have changed since a dump with a lower dump level number.

For example, if you perform a level 2 backup on a filesystem one day and your next dump is a level 3 backup, only those files that have changed since the level 2 backup are dumped with the level 3 backup. In this case, the level 2 backup is called the base dump for the level 3 backup. The base dump is the most recent backup of that filesystem with a lower dump level number.

Resumed dumps work in much the same way. When a dump is resumed after it has been interrupted, the remaining files that had been scheduled to be backed up during the interrupted dump session are backed up, and any files that changed during the interruption are also backed up. Note that you must restore an interrupted dump as if it is an incremental dump (see "Cumulative Restores With xfsrestore").

In the following example, a new tape is used and the level 0 dump is the first dump written to it:

# xfsdump -f /dev/tape -l 0 -M Jun_94 -L week_1 -v silent /usr
A week later, a level 1 dump of the filesystem is performed on the same tape:

# xfsdump -f /dev/tape -l 1 -L week_2 /usr
The tape is forwarded past the existing dump data and the new data from the level 1 dump is written after it. (Note that it is not necessary to specify the media label for each successive dump on a media object.)

A week later, a level 2 dump is taken:

# xfsdump -f /dev/tape -l 2 -L week_3 /usr
and so on, for the four weeks of a month in this example, the fourth week being a level 3 dump (up to nine dump levels are supported). Refer to "Cumulative Restores With xfsrestore" for information on the proper procedure for restoring incremental dumps.

You can interrupt a dump session and resume it later. To interrupt a dump session, type the interrupt character (typically <CTRL-C>). You receive a list of options which allow you to interrupt the session, change verbosity level, or resume the session.

In the following example, xfsdump is interrupted after dumping approximately 37% of a filesystem:

# xfsdump -f /dev/tape -M march95 -L week_1 -v silent /disk2

 ========================= status and control dialog ==========================

status at 16:49:16: 378/910 files dumped, 37.8% complete, 32 seconds elapsed

please select one of the following operations
1: interrupt this session
2: change verbosity
3: display metrics
4: other controls
5: continue (default) (timeout in 60 sec)
 -> 1

please confirm
1: interrupt this session
2: continue (default) (timeout in 60 sec)
 -> 1
interrupt request accepted

 --------------------------------- end dialog ---------------------------------

xfsdump: initiating session interrupt
xfsdump: dump interrupted prior to ino 1053172 offset 0
You can later continue the dump by including the -R option and a different session label:

# xfsdum -f /dev/tape -R -L week_1.contd -v silent /disk2p
Any files that were not backed up before the interruption, and any file changes that were made during the interruption, are backed up after the dump is resumed.

Note: Use of the -R option requires that the dump was made with a dump inventory taken, that is, the -J option was not used with xfsdump.


Next | Prev | Up | Top | Contents | Index