Questo contenuto non è disponibile nella lingua selezionata.
8.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 (that is, /path/to/filesystem
), as in:
xfsdump -l 0 -f /dev/device /path/to/filesystem
# xfsdump -l 0 -f /dev/device /path/to/filesystemxfsdump -l 0 -f /dev/device /path/to/filesystemxfsdump -l 0 -f /dev/device /path/to/filesystemxfsdump -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
# xfsdump -l 1 -f /dev/st0 /path/to/filesystemxfsdump -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:
xfsrestore -I
# xfsrestore -I
This will provide output similar to the following:
Example 8.4. Session ID and labels of all dumps
Simple Mode for xfsrestore Copia collegamentoCollegamento copiato negli appunti!
Copia collegamentoCollegamento copiato negli appunti!
The simple mode allows users to restore an entire file system from a level 0 dump. After identifying a level 0 dump's session ID (that is,
session-ID
), restore it fully to /path/to/destination
using:
xfsrestore -f /dev/st0 -S session-ID /path/to/destination
# xfsrestore -f /dev/st0 -S session-ID /path/to/destinationxfsrestore -f /dev/st0 -S session-ID /path/to/destinationxfsrestore -f /dev/st0 -S session-ID /path/to/destinationxfsrestore -f /dev/st0 -S session-ID /path/to/destination
Note
The
-f
option specifies the location of the dump, while the -S
or -L
option specifies which specific dump to restore. The -S
option is used to specify a session ID, while the -L
option is used for session labels. The -I
option displays both session labels and IDs for each dump.
Cumulative Mode for xfsrestore Copia collegamentoCollegamento copiato negli appunti!
Copia collegamentoCollegamento copiato negli appunti!
The cumulative mode of
xfsrestore
allows file system restoration from a specific incremental backup, for example, level 1 to level 9. To restore a file system from an incremental backup, simply add the -r
option:
xfsrestore -f /dev/st0 -S session-ID -r /path/to/destination
# xfsrestore -f /dev/st0 -S session-ID -r /path/to/destinationxfsrestore -f /dev/st0 -S session-ID -r /path/to/destinationxfsrestore -f /dev/st0 -S session-ID -r /path/to/destinationxfsrestore -f /dev/st0 -S session-ID -r /path/to/destination
Interactive Operation Copia collegamentoCollegamento copiato negli appunti!
Copia collegamentoCollegamento copiato negli appunti!
The
xfsrestore
utility also allows specific files from a dump to be extracted, added, or deleted. To use xfsrestore
interactively, use the -i
option, as in:
xfsrestore -f /dev/st0 -i
The interactive dialogue will begin after
xfsrestore
finishes reading the specified device. Available commands in this dialogue include cd
, ls
, add
, delete
, and extract
; for a complete list of commands, use help
.
For more information about dumping and restoring XFS file systems, refer to
man xfsdump
and man xfsrestore
.