xfsdump(8)
๐พ xfsdump โ the XFS filesystem incremental dump utility (from the System Manager's Manual, section 8) โจ
okay bestie, sit down, hydrate, because this is the one that saves your whole entire filesystem when everything goes sideways ๐ซถ
๐ธ NAME ๐ธ
xfsdump โ XFS filesystem incremental dump utility ๐
โจ SYNOPSIS โจ
xfsdump -h
xfsdump [ options ] -f dest [ -f dest ... ] filesystem
xfsdump [ options ] - filesystem
xfsdump -I [ subopt=value ... ]
๐ฆ DESCRIPTION ๐ฆ
okay so xfsdump backs up files and their attributes in a filesystem. like, the whole vibe, not just the bytes. the files get dumped to storage media, a regular file, or standard output โ dealer's choice ๐
the options let the operator decide: all files dumped, just the files that changed since a previous dump, or just files that live inside a list of pathnames. very choose-your-own-adventure.
and then xfsrestore(8) is the reverse queen โ she re-populates a filesystem with the contents of the dump. they're a package deal, fr fr.
every single invocation of xfsdump dumps just one filesystem. one invocation = one dump session. iconic. a dump session splits the filesystem into one or more dump streams, one per destination. the split happens in filesystem inode number (ino) order, at boundaries picked so that each stream ends up roughly the same size. and listen โ the breakpoints between streams can land in the middle of very large files (at extent boundaries) if that's what it takes to equalize the stream sizes. it's giving "we'll cut wherever we need to."
each dump stream can span several media objects, and a single media object can contain several dump streams. the typical media object is a tape cartridge ๐ผ. the media object records the dump stream as one or more media files. a media file is a self-contained partial dump, and the whole point of it is to minimize the impact of media dropouts on the entire dump stream โ at the cost of increasing the time required to complete the dump. by default only one media file is written, unless a media file size is specified using the -d option. and ngl, other techniques (like making a second copy of the dump image) give you more protection against media failures than multiple media files ever will. just saying ๐
xfsdump maintains an online dump inventory in /var/lib/xfsdump/inventory. the -I option displays the inventory contents hierarchically. the levels of that hierarchy are: filesystem, dump session, stream, and media file. very organized, very demure.
๐ OPTIONS ๐
the options to xfsdump are:
-aโ Specifies that files for which the Data Migration Facility (DMF) has complete offline copies (dual-state files) be treated as if they were offline (OFL). This means the file data will not be dumped byxfsdump, which results in a smaller dump file. If the file is later restored, the file data is still accessible through DMF. If both'-a option'and'-z option'are specified, the'-a option'takes precedence (see'-z option'below). ๐-bblocksize โ Specifies the blocksize, in bytes, to be used for the dump. The same blocksize must be specified to restore the tape. If the-moption is not used, then-bdoes not need to be specified. Instead, a default blocksize of1Mbwill be used.-cprogname โ Use the specified program to alert the operator when a media change is required. The alert program is typically a script to send a mail or flash a window to draw the operator's attention. ๐จ bestie, pay attention-dfilesize โ Specifies the size, in megabytes, of dump media files. If not specified,xfsdumpwill dump data to tape using a single media file per media object. The specified media file size may need to be adjusted if, for example,xfsdumpcannot fit a media file onto a single tape.-eโ Allow files to be excluded from the dump. This will causexfsdumpto skip files which have the"no dump"file attribute set. See the "Excluding individual files" section below for details on setting this file attribute. ๐-fdest[ -f dest ... ]โ Specifies a dump destination. A dump destination can be the pathname of a device (such as a tape drive), a regular file or a remote tape drive (seermt(8)). This option must be omitted if the standard output option (a lone-preceding the source filesystem specification) is specified.-llevel โ Specifies a dump level of0to9. The dump level determines the base dump to which this dump is relative. The base dump is the most recent dump at a lesser level. A level0dump is absolute โ all files are dumped. A dump level where1 <= level <= 9is referred to as an incremental dump. Only files that have been changed since the base dump are dumped. Subtree dumps (see the-soption below) cannot be used as the base for incremental dumps. periodt.-mโ Use the minimal tape protocol for non-scsi tape destinations or remote tape destinations which are not scsi Linux tape drives nor IRIX tape drives. This option cannot be used without specifying a blocksize to be used (see-boption above). no blocksize, no service ๐ค-oโ Overwrite the tape. With this option,xfsdumpdoes not read the tape first to check the contents. This option may be used ifxfsdumpis unable to determine the block size of a tape.-pinterval โ Causes progress reports to be printed at the specified interval. interval is given in seconds. The progress report indicates how many files have been dumped, the total number of files to dump, the percentage of data dumped, and the elapsed time. ๐ we love a progress bar moment-qโ Destination tape drive is a QIC tape. QIC tapes only use a512byte blocksize, for whichxfsdumpmust make special allowances.-spathname[ -s pathname ... ]โ Restricts the dump to files contained in the specified pathnames (subtrees). A pathname must be relative to the mount point of the filesystem. For example, if a filesystem is mounted at/d2, the pathname argument for the directory/d2/usersisusers. A pathname can be a file or a directory; if it is a directory, the entire hierarchy of files and subdirectories rooted at that directory is dumped. Subtree dumps cannot be used as the base for incremental dumps (see the-loption above).-tfile โ Sets the dump time to the modification time of file rather than using the current time.xfsdumpuses the dump time to determine what files need to be backed up during an incremental dump. This option should be used when dumping snapshots so that the dump time matches the time the snapshot was taken. Otherwise files modified after a snapshot is taken may be skipped in the next incremental dump. โฐ lowkey important, don't skip this one-vverbosity-vsubsys=verbosity[,subsys=verbosity,...] โ Specifies the level of detail used for messages displayed during the course of the dump. The verbosity argument can be passed as either a string or an integer. If passed as a string the following values may be used:silent,verbose,trace,debug, ornitty. If passed as an integer, values from0-5may be used. The values0-4correspond to the strings already listed. The value5can be used to produce even more verbose debug output.
The first form of this option activates message logging across all dump subsystems. The second form allows the message logging level to be controlled on a per-subsystem basis. The two forms can be combined (see the example below). The argument subsys can take one of the following values: general, proc, drive, media, inventory, inomap and excluded_files.
For example, to dump the root filesystem with tracing activated for all subsystems:
# xfsdump -v trace -f /dev/tape /
To enable debug-level tracing for drive and media operations:
# xfsdump -v drive=debug,media=debug -f /dev/tape /
To enable tracing for all subsystems, and debug level tracing for drive operations only:
# xfsdump -v trace,drive=debug -f /dev/tape /
To list files that will be excluded from the dump:
# xfsdump -e -v excluded_files=debug -f /dev/tape /
-zsize โ Specifies the maximum size, in kilobytes, of files to be included in the dump. Files over this size will be excluded from the dump, except for DMF dual-state files when'-a option'is specified (see'-a option'above). When specified,'-a option'takes precedence over'-z option'. The size is an estimate based on the number of disk blocks actually used by the file, and so does not include holes. In other words, size refers to the amount of space the file would take in the resulting dump. On an interactive restore, the skipped file is visible withxfsrestore's'ls'and while you can use the'add'and'extract'commands, nothing will be restored. ๐ the file's there but it's giving ghost-Aโ Do not dump extended file attributes. When dumping a filesystem managed within a DMF environment this option should not be used. DMF stores file migration status within extended attributes associated with each file. If these attributes are not preserved when the filesystem is restored, files that had been in migrated state will not be recallable by DMF. Note that dumps containing extended file attributes cannot be restored with older versions ofxfsrestore(8). โ ๏ธ careful bestie-Bsession_id โ Specifies the ID of the dump session upon which this dump session is to be based. If this option is specified, the-l(level) and-R(resume) options are not allowed. Instead,xfsdumpdetermines if the current dump session should be incremental and/or resumed, by looking at the base session's level and interrupted attributes. If the base session was interrupted, the current dump session is a resumption of that base at the same level. Otherwise, the current dump session is an incremental dump with a level one greater than that of the base session. This option allows incremental and resumed dumps to be based on any previous dump, rather than just the most recent. ๐-Dโ Controls which directories are backed up during an incremental dump. By default unchanged directories are dumped if files or directories beneath them have changed. This results in a self-contained dump โ if a base dump is lost, or you know the file(s) you wish to restore is in an incremental dump, you can restore just that dump without loading the base dump(s) first. However, this method requires a potentially expensive traversal through the filesystem.
When -D is specified, unchanged directories are not dumped. This results in a faster dump, but files will end up in the xfsrestore(8) orphanage directory unless the base dump(s) is loaded first. ๐๏ธ orphanage arc, not the vibe you want
-Eโ Pre-erase media. If this option is specified, media is erased prior to use. The operator is prompted for confirmation, unless the-Foption is also specified. ๐งผ-Fโ bestie, this one says don't prompt the operator, like, at all. Normally whenxfsdumpbumps into a media object that's got non-xfsdumpdata on it, it's gonna politely ask you for permission to overwrite. With-F? It just does it, no questions asked ๐ . Same energy for end-of-media: normallyxfsdumpasks the operator if another media object is coming. With this flag, nope โ the dump is instead interrupted. Not a vibe for the faint of heart.-Iโ shows you thexfsdumpinventory and performs no dump at all. Because here's the tea:xfsdumprecords every single dump session in an online inventory over in/var/lib/xfsdump/inventory, and it uses that inventory to figure out the base for incremental dumps. It's also lowkey perfect for manually identifying a dump session you wanna restore. Suboptions to filter the inventory display? Those show up later, iykyk. โจ-Jโ inhibits the normal update of the inventory. Super handy when the media you're dumping to is gonna get discarded or overwritten anyway. No point updating the receipts for a tape that's headed to the bin ๐๏ธ.-Kโ generates a format 2 dump instead of the current format. This is the move if your dump is gonna be restored on a system running an olderxfsrestorethat doesn't understand the current dump format. > Heads up bestie: use of this option is otherwise not recommended. It's giving "only if you absolutely have to" ๐ซถ-Lsession_label โ sets a label for the dump session. It can be any arbitrary string up to 255 characters long. Name it something cute, go wild ๐-Mlabel [-Mlabel ... ] โ labels the first media object written on the corresponding destination during the session (think: a tape cartridge, bestie). Any arbitrary string up to 255 characters long. And you can specify multiple media object labels โ one for each destination ๐-Ooptions_file โ inserts the options sitting inside options_file right at the beginning of the command line. The options are specified just as they would appear if you typed them into the command line. Bonus: newline characters (\n) can be used as whitespace ๐ธ. Where do they land? Before all the options actually given on the command line, just after the command name. Rules though: only one-Ooption can be used, recursive use is ignored, and the source filesystem cannot be specified in options_file.-Rโ resumes a previously interrupted dump session. So if the most recent dump at this dump's level (that's the-loption) got interrupted, this dump contains only the files that weren't in the interrupted dump and are consistent with the incremental level. But โ and this is important โ files that were in the interrupted dump and have since been modified get re-dumped. Consistency, periodt ๐-Tโ inhibits interactive dialogue timeouts. Here's the setup: when-Fis not specified,xfsdumpprompts the operator for labels and media changes, and each dialogue normally times out if nobody responds. This option stops the timeout from happening at all. Take your sweet time, no pressure ๐-Ylength โ specify the I/O buffer ring length.xfsdumpuses a ring of output buffers to achieve maximum throughput when dumping to tape drives, and the default ring length is3. > But fr fr: this is not currently enabled on Linux yet, making this option benign. So it's basically decorative on your machine ๐-โ a lone-causes the dump stream to be sent to standard output, where you can pipe it to another utility likexfsrestore(8)or redirect it to a file. It's giving main character energy for pipelines ๐. But rules are rules: this option cannot be used with the-foption, and the-must follow all other options and precede the filesystem specification. Order matters, bestie โญ
The filesystem โ filesystem โ can be specified either as a mount point or as a special device file (for example, /dev/dsk/dks0d1s0). And ngl, the filesystem must be mounted to be dumped. No mount, no dump, no exceptions ๐
โจ NOTES โจ
๐ Dump Interruption
okay so bestie, you can literally interrupt a dump whenever and pick it back up later ๐ . Just hit control-C (or whatever your terminal's current interrupt character is). Then you get prompted to pick from a bunch of operations, and one of them is interrupting the dump. Once you choose that, the dump keeps going until it hits a convenient break point โ usually the end of the current file. And don't stress about waiting forever, because very large files get broken into smaller subfiles, so that wait is short. ๐ซถ
โถ๏ธ Dump Resumption
Got a dump that got interrupted? You can resume it by passing the -R option. Here's the tea: if the most recent dump at the level you specified was interrupted, the new dump skips files that were already dumped โ unless they've changed since that interrupted dump. ๐
๐ผ Media Management
One media object can hold a bunch of dump streams. And plot twist, one dump stream can span multiple media objects. If you send a dump stream to a media object that already has one or more dumps on it, xfsdump appends the new stream after the last one. Media files are never overwritten, periodt. If you hit end-of-media mid-dump, the operator gets prompted to stick a new media object in the drive, and the stream continuation gets appended after the last media file on that new media object. โจ
๐๏ธ Inventory
Every dump session updates an inventory database living in /var/lib/xfsdump/inventory. xfsdump uses this inventory to figure out the base of incremental and resumed dumps. Fr fr, it's the backbone.
You can display this database by running xfsdump with the -I option. The display uses tabbed indentation to show the inventory hierarchically:
- First level = filesystem
- Second level = session
- Third level = media stream (currently only one stream is supported)
- Fourth level = the media files sequentially composing the stream
And there are these suboptions to filter what you see:
-I depth=nโ where n is1,2, or3, limits how deep the hierarchy goes.nis1: only filesystem info shows.nis2: only filesystem and session info.nis3: only filesystem, session and stream info.-I level=nโ where n is the dump level, limits the display to dumps at that particular dump level.-I mobjid=valueโ where value is a media ID, specifies the media object by its media ID.-I mobjlabel=valueโ where value is a media label, specifies the media object by its media label.-I mnt=mount_pointโ that is,[hostname:]pathname, identifies the filesystem by mountpoint. The hostname is optional but lowkey useful in a clustered environment where more than one host can be responsible for dumping a filesystem.-I fsid=filesystem_idโ identifies the filesystem by filesystem ID.-I dev=device_pathnameโ that is,[hostname:]device_pathname, identifies the filesystem by device. Same as themntfilter, the hostname is optional.
You can stack more than one of these suboptions at the same time, separated by commas, to narrow the display to just the dumps you care about. But heads up: at most four suboptions at once โ one to constrain the display hierarchy depth, one for the dump level, one for the media object, and one for the filesystem. No more than that. ๐
For example, -I depth=1,mobjlabel="tape 1",mnt=host1:/test_mnt would show only the filesystem info (depth=1) for those filesystems mounted on host1:/test_mnt at the time of the dump, and only the ones dumped to the media object labeled "tape 1".
Dump records can be removed (pruned) from the inventory using the xfsinvutil program. ๐งน
Also, an extra media file gets placed at the end of each dump stream. That media file holds the inventory information for the current dump session, and you can merge its contents back into the online inventory database later using xfsrestore(1M).
The inventory files stored in /var/lib/xfsdump are not included in the dump, even if that directory is inside the filesystem being dumped. Why? Because including the inventory in the dump could lead to loss or corruption of data if an older version gets restored and overwrites the current version. ๐ญ
To back up the xfsdump inventory, copy the contents of /var/lib/xfsdump to another location, which you can then safely dump. On restoration, copy those files back into /var/lib/xfsdump, overwriting whatever's there โ or use xfsinvutil(1M) to selectively merge parts of the restored inventory back into the current one.
๐ข History lesson: prior to version 1.1.8,xfsdumpwould include the/var/lib/xfsdumpdirectory in the dump. So be careful not to overwrite/var/lib/xfsdumpwhen restoring an old dump โ either restore the filesystem to another location, or copy the current contents of/var/lib/xfsdumpsomewhere safe before runningxfsrestore(1M).
๐ท๏ธ Labels
The operator can specify a label to identify the dump session, plus a label to identify a media object. The session label goes into every media file produced during the dump, and it's recorded in the inventory.
The media label identifies media objects, and it's totally independent of the session label. Each media file on the media object carries a copy of the media label. If you specify a media label that doesn't match the media label on a media object containing valid media files, you get an error. ๐จ Media labels are also recorded in the inventory.
๐ UUIDs
UUIDs (Universally Unique Identifiers) get used in three places: to identify the filesystem being dumped (via the filesystem UUID โ peep xfs(5) for more deets), to identify the dump session, and to identify each media object. The inventory display (-I) shows all of these. ๐
๐ Dump Level Usage
The dump level mechanism gives you a structured form of incremental dumps. A dump of level level includes only files that have changed since the most recent dump at a level less than level. For example, you could set up a schedule with a full dump every Friday and a daily incremental containing only files changed since the previous dump. Friday's dump = level 0, Saturday's = level 1, Sunday's = level 2, and so on up to the Thursday dump at level 6.
Now, that schedule makes for a very tedious restore if you want to fully reconstruct the Thursday version of the filesystem โ xfsrestore would need to be fed all 7 dumps in sequence. ๐ฎโ๐จ A compromise schedule: use level 1 on Saturday, Monday, and Wednesday, and level 2 on Sunday, Tuesday, and Thursday. The Monday and Wednesday dumps take longer, but worst case restore only needs three dumps accumulated โ one each at level 0, level 1, and level 2. Slay. ๐
๐ฐ Quotas
If the filesystem you're dumping has user quotas, xfsdump will use xfs_quota(8) to store the quotas in a file called xfsdump_quotas in the root of the filesystem being dumped. That file then gets included in the dump. On restoration, xfs_quota (8) can reactivate the quotas for the filesystem. But note: the xfsdump_quotas file will probably need modification to change the filesystem or UIDs if the filesystem was restored to a different partition or system. Group and project quotas get handled similarly, saved in files called xfsdump_quotas_group and xfsdump_quotas_proj , respectively.
๐ซ Excluding individual files
Sometimes you wanna exclude particular files or directories from the dump, and that's valid. The -s option limits the dump to a specified directory, and the -z option excludes files over a particular size. Also, when xfsdump runs with the -e option, files tagged with the "no dump" file attribute won't be included. The chattr(1) command sets that attribute on individual files or entire subtrees. ๐
To tag an individual file for exclusion from the dump:
$ chattr +d file
To tag all files in a subtree for exclusion from the dump:
$ chattr -R +d directory
Heads up: any new files or directories created in a directory that has the "no dump" attribute set will automatically inherit that attribute. And also note that xfsdump does not check directories for the "no dump" attribute. ๐
Care should be taken to note which files you've tagged. Under normal operation, xfsdump will only report the number of files it will skip. But the -v excluded_files=debug option makes xfsdump list the inode numbers of the individual files affected. ๐
๐ธ EXAMPLES ๐ธ
To perform a level 0, single stream dump of the root filesystem to a locally mounted tape drive, prompting for session and media labels when required:
# xfsdump -f /dev/tape /
To specify session and media labels explicitly:
# xfsdump -L session_1 -M tape_0 -f /dev/tape /
To perform a dump to a remote tape using the minimal rmt protocol and a set blocksize of 64k:
# xfsdump -m -b 65536 -f otherhost:/dev/tape /
To perform a level 0, multi-stream dump to two locally mounted tape drives:
# xfsdump -L session_2 -f /dev/rmt/tps4d6v -M tape_1 \
-f /dev/rmt/tps5d6v -M tape_2 /
To perform a level 1 dump relative to the last level 0 dump recorded in the inventory:
# xfsdump -l 1 -f /dev/tape /
To copy the contents of a filesystem to another directory (see xfsrestore(8)):
# xfsdump -J - / | xfsrestore -J - /new
๐ FILES ๐
/var/lib/xfsdump/inventoryโ dump inventory database
๐ SEE ALSO ๐
attr(1), rmt(8), xfsrestore(8), xfsinvutil(8), xfs_quota(8), attr_get(2).
๐ DIAGNOSTICS ๐
Okay bestie, let's talk exit codes, because they're literally the vibe check for whether your dump ate or flopped. ๐
The exit code is 0 on normal completion, and non-zero if an error occurs or the dump is terminated by the operator. Periodt.
For all verbosity levels greater than 0 (that's the silent one), the final line of the output shows the exit status of the dump. It's giving:
xfsdump: Dump Status: code
Where code takes one of these iconic values:
SUCCESSโ normal completion, we love a clean finish โจINTERRUPTโ interrupted, rude tbh ๐ญQUITโ media no longer usable, the tape said bye ๐INCOMPLETEโ dump incomplete, not the full slay ๐FAULTโ software error, big yikes ๐ซERRORโ resource error, the vibes are off ๐ฅ
Every attempt will be made to keep both the syntax and the semantics of this log message unchanged in future versions of xfsdump. However, it may be necessary to refine or expand the set of exit codes, or their interpretation at some point in the future. So like, don't @ me if the code list grows. ๐
Also, heads up: the messagexfsdump: WARNING: unable to open directory: ino N: Invalid argumentcan occur with filesystems which are actively being modified whilexfsdumpis running. This can happen to either directory or regular file inodes โ affected files will not end up in the dump, and files below affected directories will be placed in the orphanage directory byxfsrestore. Not the cutest, but now you know. ๐
๐ญ BUGS ๐ญ
Okay so not everything is slay, here's the tea:
xfsdumpdoes not dump unmounted filesystems. Unmounted? Not happening. ๐ซถ- The dump frequency field of
/etc/fstabis not supported. It's giving unsupported, sorry. ๐ xfsdumpuses the alert program only when a media change is required. Just so you know. โญxfsdumprequires root privilege (except for inventory display). So like, root or bust. ๐xfsdumpcan only dump XFS filesystems. No XFS, no dump, no cap. ๐ฆ- The media format used by
xfsdumpcan only be understood byxfsrestore. They're exclusive, iykyk. ๐ xfsdumpdoes not know how to manage CD-ROM or other removable disk drives. It's not that girl for those. ๐xfsdumpcan become confused when doing incremental or resumed dumps if on the same machine you dump two XFS filesystems and both filesystems have the same filesystem identifier (UUID). Sincexfsdumpuses the filesystem identifier to identify filesystems,xfsdumpmaintains one combined set of dump inventories for both filesystems instead of two sets of dump inventories. This scenario can happen only ifddor some other block-by-block copy program was used to make a copy of an XFS filesystem. Seexfs_copy(8)andxfs(5)for more details. So like, don't clone your UUIDs and then act surprised. ๐
And that's the xfsdump(8) page, bestie! Source/version: xfsdump(8). Date: the one in the footer, but the vibe is eternal. Stay slay, stay backed up. ๐โจ๐
๐ฆ where this page comes from
- arch rolling: xfsdump 3.3.0-1 ยท GPL-2.0-only
- centos-stream 10: xfsdump 3.2.0-2.el10 ยท GPL-1.0-or-later
- centos-stream 9: xfsdump 3.1.12-4.el9 ยท GPL+
- debian bookworm: xfsdump 3.1.11-0.1 ยท GPL
- debian trixie: xfsdump 3.2.0-2 ยท GPL
- fedora 43: xfsdump 3.2.0-3.fc43 ยท GPL-1.0-or-later
- fedora 44: xfsdump 3.2.0-4.fc44 ยท GPL-1.0-or-later
- nixos 26.05: xfsdump 3.3.0
- nixpkgs unstable: xfsdump 3.3.0
- opensuse-leap 16.0: xfsdump 3.1.12-160000.2.2 ยท GPL-2.0-or-later
- opensuse-leap 16.0: xfsdump 3.1.12-160000.2.2 ยท GPL-2.0-or-later
- opensuse-leap 16.0: xfsdump 3.1.12-160000.2.2 ยท GPL-2.0-or-later
- opensuse-leap 16.0: xfsdump 3.1.12-160000.2.2 ยท GPL-2.0-or-later
- ubuntu jammy: xfsdump 3.1.9+0+nmu2
- ubuntu noble: xfsdump 3.1.11-0.1build1 ยท GPL
- ubuntu questing: xfsdump 3.2.0-2
- ubuntu resolute: xfsdump 3.2.0-2build1 ยท GPL
- ubuntu stonking: xfsdump 3.2.0-2build1 ยท GPL
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms