As you can tell from the commands name:
xfs_metadump is a utility to copy XFS filesystem metadata to a file
xfs_mdrestore is an utility to restore XFS metadata from file to XFS filesystem
What are they for
xfs_metadump and xfs_mdrestore are to copy and restore XFS filesystem metadata, xfs_metadump doesn't alter the source. The target image is a contiguous (non-sparse) file containing all the filesystem’s metadata and indexes to where the blocks were copied from.
Note: They are mainly designed for debugging and reporting filesystem problems. The most common usage scenario for this tool is when xfs_repair fails to repair a filesystem and a metadump image can be sent for analysis. Or use the metadump file as a duplicated XFS metadata copy for xfs_repair to debug.
Which content are backed up and restored
xfs_metadump and xfs_restore backup and restore file,directory and symbolic link names, and their extended attribute names, however most names are obfuscated(randomly changed for confidential purpose), so don't worry when someone ask you to send him a XFS metadata dump.
Extended attribute values are zeroed and no data is copied.
Note: file or attribute names that are 4 or less characters in length are not obfuscated. Also file names that span extents (this can only occur with the mkfs.xfs(8) options where -n size > -b size) are not obfuscated. Names between 5 and 8 characters in length inclusively are partially obfuscated.
xfs_metadump and xfs_mdrestore command examples
Note: xfs_metadump should only be used to copy unmounted filesystems, read-only mounted filesystems, or frozen filesystem. Otherwise, the generated dump could be inconsistent or corrupt.
Run xfs_metadump to create a copy of the partition/block device metadata to an image, In this case, I had a corrupted XFS filesystem located at /dev/mapper/vg0-home:
xfs_metadump /dev/mapper/vg0-data /home/vg0-data.metadump
Next, you'll want to restore the metadata in to an image or a filesystem, so that we can perform a repair and measure the damage. In this case, we restore the metadump to a xfs image filesystem
xfs_mdrestore /home/vg0-data.metadump /home/vg0-data.img
-a Copies entire metadata blocks. Normally, xfs_metadump will zero any stale bytes interspersed with in-use metadata. Use this option to copy full metadata blocks, to provide more debugging information for a corrupted filesystem. Note that the extra data will be unobfuscated.
-e Stops the dump on a read error. Normally, it will ignore read errors and copy all the metadata that is accessible.
-f Specifies that the filesystem image to be processed is stored in a regular file (see the mkfs.xfs -d file option). This can also happen if an image copy of a filesystem has been made into an ordinary file with xfs_copy(8).
-F Specifies that we want to continue even if the superblock magic is not correct. If the source is truly not an XFS filesystem, the resulting image will be useless, and xfs_metadump may crash.
-g Shows dump progress. This is sent to stdout if the target is a file or to stderr if the target is stdout.
-l logdev For filesystems which use an external log, this specifies the device where the external log resides. The external log is not copied, only internal logs are copied.
-m Set the maximum size of an allowed metadata extent. Extremely large metadata extents are likely to be corrupt, and will be skipped if they exceed this value. The default size is 1000 blocks.
-o Disables obfuscation of file names and extended attributes.
-w Prints warnings of inconsistent metadata encountered to stderr. Bad metadata is still copied.
-V Prints the version number and exits.