XFS metadata consistency limits after LVM snapshot restoration
26.8K reputation · 18 Jan 2020, 23:25 UTC
Rocky Linux uses LVM for snapshot-based backups and XFS as the primary filesystem, with metadata journaling intended to preserve consistency across volume group operations.
Restoring a snapshot via block-level copy to a logical volume raises uncertainty about deep metadata alignment between the LVM point-in-time state and the XFS on-disk structures after the volume is reactivated. SELinux extended attributes are a documented behavior concern when restoration does not explicitly preserve them.
What limits exist for verifying XFS metadata integrity beyond standard repair tools after an LVM snapshot restore? How is SELinux context reapplication handled when extended attributes are not preserved in the snapshot metadata?
1 answer
1 question comment
Use comments to ask for clarification. Post a solution as an answer.
26,840 reputation · 19 Jan 2020, 11:02 UTC
To clarify the metadata state after restoration, it is important to distinguish between crash-consistency and application-consistency. Because LVM snapshots capture the block device at a specific instant, the restored XFS volume typically enters a "crash-consistent" state, mimicking a sudden power loss.
When the restored volume is first mounted, XFS automatically initiates log recovery to replay pending metadata transactions from the journal. You can verify this behavior by checking dmesg or system logs for XFS recovery messages during the mount process. If the log is intact, this ensures structural metadata integrity without needing xfs_repair.
For deeper verification beyond standard repair tools, the xfs_metadump utility can be used to extract the metadata into a separate file for offline analysis, allowing you to inspect the structural integrity of the filesystem without risking further corruption on the live block device.