Creating a Backup of an XFS File System

Use the xfsdump command to create a backup of an XFS file system on a device such as a tape drive or in a backup file on a different file system.

A backup can span several physical media that are written on the same device. Also, you can write several backups to the same medium. Note that you can write only a single backup to a file. The command doesn't overwrite existing XFS backups that are found on physical media. If you need to overwrite any existing backups, you must use the appropriate command to erase a physical medium.

For more information, see the xfsdump(8) manual page.

  • To create a full backup of an XFS file system, use the xfsdump -l 0 command.

    For example, the following command writes a level 0 (base) backup of the XFS file system (/boot) to the device, /dev/st0, and assigns a session label to the backup:

    sudo xfsdump -l 0 -L "Backup level 0 of /boot $(date)" -f /dev/st0 /boot

    Note that the dump destination needn't be a device, as in the example. You can alternatively specify a file path to store dump files in a directory on a file system. For example, to create an XFS dump file at /backups/boot.0.xfsdump, run:

    sudo xfsdump -l 0 -L "Backup level 0 of /boot $(date)" -f /backups/boot.0.xfsdump /boot
  • Make incremental backups using the xfsdump -l command, but specify the increment level that you require.

    Make incremental dumps that are relative to an existing backup by using the same command but change the level to indicate the increment level. For example, to create an incremental backup with all the changes after the base (level 0) backup, set the level to 1:

    sudo xfsdump -l 1 -L "Backup level 1 of /boot $(date)" -f /dev/st0 /boot
    A level 1 backup records only file system changes after the level 0 backup, a level 2 backup records only the changes after the latest level 1 backup, and so on up to level 9. Note that the previous level backup must exist to perform an incremental backup.
  • Resume an interrupted backup by using the xfsdump -R command.

    If you interrupt a backup by typing Ctrl-C and you didn't specify the -J option (suppress the dump inventory) to xfsdump , you can resume the dump later by specifying the -R option, for example:

    sudo xfsdump -R -l 1 -L "Backup level 1 of /boot $(date)" -f /dev/st0 /boot

    The backup session label from the earlier interrupted session is overridden.