Installation guide
Chapter 9. The XFS File System
54
Note
You can also use the xfs_freeze utility to freeze/unfreeze an ext3, ext4, GFS2, XFS, and
BTRFS, file system. The syntax for doing so is also the same.
For more information about freezing and unfreezing an XFS file system, refer to man xfs_freeze.
9.7. Backup and Restoration of XFS File Systems
XFS file system backup and restoration involves two utilities: xfsdump and xfsrestore.
To backup or dump an XFS file system, use the xfsdump utility. Red Hat Enterprise Linux 6 supports
backups to tape drives or regular file images, and also allows multiple dumps to be written to the same
tape. The xfsdump utility also allows a dump to span multiple tapes, although only one dump can be
written to a regular file. In addition, xfsdump supports incremental backups, and can exclude files
from a backup using size, subtree, or inode flags to filter them.
In order to support incremental backups, xfsdump uses dump levels to determine a base dump to
which a specific dump is relative. The -l option specifies a dump level (0-9). To perform a full backup,
perform a level 0 dump on the file system (i.e. /path/to/filesystem), as in:
xfsdump -l 0 -f /dev/device /path/to/filesystem
Note
The -f option specifies a destination for a backup. For example, the /dev/st0 destination is
normally used for tape drives. An xfsdump destination can be a tape drive, regular file, or remote
tape device.
In contrast, an incremental backup will only dump files that changed since the last level 0 dump. A
level 1 dump is the first incremental dump after a full dump; the next incremental dump would be level
2, and so on, to a maximum of level 9. So, to perform a level 1 dump to a tape drive:
xfsdump -l 1 -f /dev/st0 /path/to/filesystem
Conversely, the xfsrestore utility restores file systems from dumps produced by xfsdump. The
xfsrestore utility has two modes: a default simple mode, and a cumulative mode. Specific dumps
are identified by session ID or session label. As such, restoring a dump requires its corresponding
session ID or label. To display the session ID and labels of all dumps (both full and incremental), use
the -I option, as in:
xfsrestore -I
This will provide output similar to the following:
file system 0:
fs id: 45e9af35-efd2-4244-87bc-4762e476cbab
session 0:
mount point: bear-05:/mnt/test
device: bear-05:/dev/sdb2
time: Fri Feb 26 16:55:21 2010
session label: "my_dump_session_label"
session id: b74a3586-e52e-4a4a-8775-c3334fa8ea2c
level: 0