Checking some consequences of xfs_repair safely
This document (7018603) is provided subject to the disclaimer at the end of this document.
Environment
SUSE Linux Enterprise Server 12
Situation
# mount /dev/sdb /mnt/
mount: mount /dev/sdb on /mnt failed: Structure needs cleaning
and assuming that sdb contains a XFS Filesystem.
Resolution
To get the metadata, assuming /dev/sdb contains a XFS Filesystem, as root run the following command:
# /usr/sbin/xfs_metadump -aowg /dev/sdb /tmp/dump_xfs_meta
would be invoked. This results in a file /tmp/dump_xfs_meta containing the metadata and no Data Obfuscation.
This file cannot be used yet, but would have to be changed into a restore file with
# /usr/sbin/xfs_mdrestore /tmp/dump_xfs_meta /tmp/workable_xfs_dump
this new file, /tmp/workable_xfs_dump can be used safely for experiments and test and even be mounted and should exhibit the original error during a mount attempt.
# mount /tmp/workable_xfs_dump /mnt/
mount: mount /dev/loop0 on /mnt failed: Structure needs cleaning
but after a
# xfs_repair /tmp/workable_xfs_dump
in this example it can be mounted. And subsequent checked whether files and directories are still in place.
Additional Information
xfs_db -fx /tmp/workable_xfs_dump
then in the shell do
xfs_db> sb
xfs_db> p
and for example change the uuid with
xfs_db> write uuid 12345678
uuid = 20000000-0000-0000-0000-000000bc614e
xfs_db> q
which would then result in an error during mount
# mount /tmp/workable_xfs_dump /mnt/
mount: mount /dev/loop0 on /mnt failed: Structure needs cleaning
Disclaimer
This Support Knowledgebase provides a valuable tool for SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented "AS IS" WITHOUT WARRANTY OF ANY KIND.
- Document ID:7018603
- Creation Date: 09-Feb-2017
- Modified Date:03-Mar-2020
-
- SUSE Linux Enterprise Server
For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback[at]suse.com