LinuxCommandLibrary

xfs_mdrestore

Restore XFS filesystem metadata from a dump

SYNOPSIS

xfs_mdrestore [ options ] source_file target_device

PARAMETERS

source_file
    Path to the XFS metadata dump file, typically created by xfs_metadump.

target_device
    The target block device (e.g., /dev/sdb1) where the metadata will be restored. Caution: This device will be overwritten.

-s size
    Specifies the size of the target filesystem in blocks. This is particularly useful if the original filesystem was sparse or if the target device is smaller than the original but still large enough for the metadata.

-p progname
    Specify an external program to display a progress bar during the restore operation.

-c chunk_size
    Set the chunk size in bytes for progress bar updates when using the -p option.

-f
    Force overwrite of any existing filesystem on the target_device. Use with extreme caution as this will destroy all data on the target device.

-g
    Skip geometry detection. Useful in certain virtualized or non-standard environments.

-L label
    Set the XFS filesystem label for the restored filesystem.

-U uuid
    Set the XFS filesystem universally unique identifier (UUID) for the restored filesystem.

-o, --oem
    OEM mode. Suppress vendor-specific strings in output.

-r
    Read-only mode. Perform a dry run without actually writing to the target device. Useful for verifying command syntax and potential outcomes.

-v
    Verbose output. Display more information about the restore process.

-q
    Quiet output. Suppress most messages, showing only errors.

-V
    Print version information and exit.

DESCRIPTION

xfs_mdrestore is a critical XFS utility used for disaster recovery and forensic analysis. It takes a metadata image created by xfs_metadump and reconstructs the XFS filesystem's metadata structure onto a specified target device. This process recreates the filesystem's inodes, directories, allocation groups, and other structural components, but does not restore user data. User data blocks on the target device will typically be zeroed out or left as-is, depending on the dump's specifics.

The primary use cases include recreating a filesystem's structure for debugging without needing the original data, or as a step in a disaster recovery process where metadata was lost but user data might be recoverable by other means. The target device must be large enough to accommodate the restored metadata.

CAVEATS

  • Data Loss Risk: Using the -f option will irrevocably destroy all data on the target_device. Always double-check the target device before proceeding.
  • Metadata Only: xfs_mdrestore only restores the filesystem's metadata. User data blocks are not restored and will be zeroed out or contain arbitrary data on the target device. This tool is not for full data recovery.
  • Target Device Size: The target_device must be large enough to contain the restored metadata structures.
  • Source Consistency: The restored filesystem reflects the state of the original filesystem exactly as it was at the time the xfs_metadump was created.

HISTORY

xfs_mdrestore is part of the XFS filesystem utilities, which originated from Silicon Graphics (SGI) as a high-performance journaling filesystem for their IRIX operating system. XFS was open-sourced and integrated into the Linux kernel in the early 2000s, becoming a popular choice for large, high-performance filesystems. The xfs_mdrestore and xfs_metadump tools have been integral to XFS's resilience and debugging capabilities since their early development, providing a robust mechanism for metadata backup and recovery.

SEE ALSO

xfs_metadump(8), xfs_check(8), xfs_repair(8), mkfs.xfs(8), xfs(5)

Copied to clipboard