Cloning an XFS File System

Combine the xfsdump and xfsrestore commands to copy the contents of one XFS file system to another.

This approach to cloning the file system can be performed on a live and mounted file system and is quicker than a block copy of the device. Furthermore, by using piped commands, you can extend this approach to use SSH to restore to a remote system.

  • Combine the xfsdump and xfsrestore commands by using the -J option to copy the entire contents of on XFS file system to another.

    The -J option suppresses the usual dump inventory housekeeping that the commands perform. for example:

    sudo xfsdump -J - /mnt | xfsrestore -J - /mnt_clone
  • Use SSH to perform the cloning operation to a remote system.

    For example, you could run a command similar to:

    sudo xfsdump -J - /home | ssh backup_user@standby.example.com "sudo xfsrestore -J - /home"