Same like other File Systems, XFS file system has backup and restoration features, which involves two utilities: xfsd ump and xfsrestore.

xfsdump with dump levels

To backup or dump an XFS file system, use the xfsdump utility. RHEL 7 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 /d ev/device /path/to/filesystem

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 0 dump to a local file

# xfsdump -l 0 -f ./lun13.dump /lun13
xfsdump: using file dump (drive_simple) strategy
xfsdump: version 3.1.4 (dump format 3.0) - type ^C for status and control

 ============================= dump label dialog ==============================

please enter label for this dump session (timeout in 300 sec)
 -> test
session label entered: "test"

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

xfsdump: saving user quota information for: /lun13
xfsdump: WARNING: overwriting: /lun13/xfsdump_quotas
xfsdump: level 0 dump of <localhost>:/lun13
xfsdump: dump date: Thu Oct 20 21:50:39 2016
xfsdump: session id: dea18035-2ffb-412e-a7c6-eba4ad419716
xfsdump: session label: "test"
xfsdump: ino map phase 1: constructing initial dump list
xfsdump: ino map phase 2: skipping (no pruning necessary)
xfsdump: ino map phase 3: skipping (only one dump stream)
xfsdump: ino map construction complete
xfsdump: estimated dump size: 10822976 bytes
xfsdump: /var/lib/xfsdump/inventory created

 ============================= media label dialog =============================

please enter label for media in drive 0 (timeout in 300 sec)
 -> 0
media label entered: "0"

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

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 10824800 bytes
xfsdump: dump size (non-dir files) : 10798576 bytes
xfsdump: dump complete: 8 seconds elapsed
xfsdump: Dump Summary:
xfsdump:   stream 0 /lun14/lun13.dump OK (success)
xfsdump: Dump Status: SUCCESS

Use xfsrestore to display dumps info

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

This will provide output similar to the following:

# xfsrestore -I
file system 0:
    fs id:        f3b8bc57-b6b4-4a5b-a020-5229d80adcb8
    session 0:
        mount point:    <localhost>:/lun13
        device:        <localhost>:/dev/mapper/LUN13
        time:        Thu Oct 20 21:50:39 2016
        session label:    "test"
        session id:    dea18035-2ffb-412e-a7c6-eba4ad419716
        level:        0
        resumed:    NO
        subtree:    NO
        streams:    1
        stream 0:
            pathname:    /lun14/lun13.dump
            start:        ino 133 offset 0
            end:        ino 148 offset 0
            interrupted:    NO
            media files:    1
            media file 0:
                mfile index:    0
                mfile type:    data
                mfile size:    10824800
                mfile start:    ino 133 offset 0
                mfile end:    ino 148 offset 0
                media label:    "0"
                media id:    4ac00b2a-caa2-48b0-a3a0-a3364939cddd
xfsrestore: Restore Status: SUCCESS

Restore XFS by using xfsrestore, simple mode

Conversely, the xfsrestore utility restores file systems from dumps produced by xfsdump.

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


The -f option specifies the location of the dump
The -S or -L option specifies which specific dump to restore
The -S option is used to specify a session ID
The -L option isused for session labels
The -I option displays both session labels and ID s for each dump

Cumulative Mode for xfsrestore

The cumulative mode of xfsresto re 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

Interactive Operation

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 /destination/directory

The interactive dialogue will begin after xfsrestore finishes reading the specified device. Available commands in this dialogue include cd , l s, add , delete, and extract; for a complete list of commands, use help.

Here is how output looks like:

xfsrestore: using file dump (drive_simple) strategy
xfsrestore: version 3.1.4 (dump format 3.0) - type ^C for status and control
xfsrestore: searching media for dump
xfsrestore: examining media file 0
xfsrestore: dump description:
xfsrestore: hostname: <localhost>
xfsrestore: mount point: /lun13
xfsrestore: volume: /dev/mapper/LUN13
xfsrestore: session time: Thu Oct 20 21:50:39 2016
xfsrestore: level: 0
xfsrestore: session label: "test"
xfsrestore: media label: "0"
xfsrestore: file system id: f3b8bc57-b6b4-4a5b-a020-5229d80adcb8
xfsrestore: session id: dea18035-2ffb-412e-a7c6-eba4ad419716
xfsrestore: media id: 4ac00b2a-caa2-48b0-a3a0-a3364939cddd
xfsrestore: using online session inventory
xfsrestore: searching media for directory dump
xfsrestore: reading directories
xfsrestore: 2 directories and 16 entries processed
xfsrestore: directory post-processing

 ========================== subtree selection dialog ==========================

the following commands are available:
    ls [ <path> ]
    cd [ <path> ]
    add [ <path> ]
    delete [ <path> ]


Comments powered by CComment