How to clear an inode without the disk mounted? (Help Recovering Data)

First of all, i want to say that i think this is not a hardware issue, the hard drive sounds fine and it didn’t show any signs of slowness, it’s also not very old, got it the 10th of January.

The entire disk is behind luks encryption:

sdc         8:32   0   3.6T  0 disk
└─storage 254:1    0   3.6T  0 crypt

and the file system used is XFS.
Recently i’ve been having some issues where the drive suddenly becomes unreadable (seems to be caused by kited) but all of the times it happened, using xfs_repair with the following syntax sudo xfs_repair /dev/mapper/storage -v; made the drive readable again, but this time i didn’t have this luck, and the drive was unable to be repaired, leading to this error at the end:

Phase 6 - check inode connectivity...
        - resetting contents of realtime bitmap and summary inodes
        - traversing filesystem ...
        - agno = 0
bad hash table for directory inode 128 (no data entry): rebuilding
rebuilding directory inode 128
Invalid inode number 0x0
Metadata corruption detected at 0x56135ef283e8, inode 0x84 data fork

fatal error -- couldn't map inode 132, err = 117

I ran xfs_db to see what was happening on that inode:
sudo xfs_db -x -c 'blockget inode 132' /dev/mapper/storage > xfs_db.log
and this are the outputs:

  • stderr:
Metadata corruption detected at 0x557ecac7bbfd, xfs_bnobt block 0x1b275ab8/0x1000
Metadata corruption detected at 0x557ecac7bbfd, xfs_bnobt block 0x1b2d32e0/0x1000
Metadata corruption detected at 0x557ecac7bbfd, xfs_bnobt block 0x1b338de0/0x1000
Metadata corruption detected at 0x557ecac7bbfd, xfs_bnobt block 0x1b38ead0/0x1000
Metadata corruption detected at 0x557ecac7bbfd, xfs_bnobt block 0x1b3e9750/0x1000
Metadata corruption detected at 0x557ecac7bbfd, xfs_bnobt block 0x1b4383b0/0x1000
Metadata corruption detected at 0x557ecac7bbfd, xfs_bnobt block 0x1b47c868/0x1000
Metadata corruption detected at 0x557ecac7bbfd, xfs_bnobt block 0x1b547748/0x1000
Metadata corruption detected at 0x557ecac7bbfd, xfs_bnobt block 0x1b619828/0x1000
Metadata corruption detected at 0x557ecac7bbfd, xfs_bnobt block 0x1b63b9d8/0x1000
Metadata corruption detected at 0x557ecac7bbfd, xfs_bnobt block 0x1b687f38/0x1000
Metadata CRC error detected at 0x557ecac7bc85, xfs_cntbt block 0x1b8d1230/0x1000
Metadata CRC error detected at 0x557ecac7bc85, xfs_cntbt block 0x1b8d1290/0x1000
Metadata corruption detected at 0x557ecacb369b, xfs_refcountbt block 0x1b227dd8/0x1000
Metadata corruption detected at 0x557ecacb0600, xfs_inobt block 0x1afb5e68/0x1000
Metadata corruption detected at 0x557ecacb0600, xfs_finobt block 0x1afe9ef0/0x1000
Metadata corruption detected at 0x557ecac7bbfd, xfs_bnobt block 0x8b928790/0x1000
Metadata corruption detected at 0x557ecacb369b, xfs_refcountbt block 0x8b928780/0x1000
Metadata corruption detected at 0x557ecacb0600, xfs_inobt block 0x8b928310/0x1000
Metadata corruption detected at 0x557ecacb0600, xfs_finobt block 0x8b928468/0x1000
Metadata corruption detected at 0x557ecac7bbfd, xfs_bnobt block 0x11660d9e8/0x1000
Metadata corruption detected at 0x557ecacb369b, xfs_refcountbt block 0x1166000a0/0x1000
Metadata corruption detected at 0x557ecacb0600, xfs_inobt block 0x116531ea8/0x1000
Metadata corruption detected at 0x557ecacb0600, xfs_finobt block 0x116531ed0/0x1000
Metadata corruption detected at 0x557ecac7bbfd, xfs_bnobt block 0x176489440/0x1000
Metadata corruption detected at 0x557ecacb369b, xfs_refcountbt block 0x17603e178/0x1000
Metadata corruption detected at 0x557ecacb0600, xfs_inobt block 0x1760313d0/0x1000
Metadata corruption detected at 0x557ecacb0600, xfs_finobt block 0x176031920/0x1000
  • stdout:
    It’s a 13.9GB file, i will not send it.

Help trying to recover the data (move it to another drive) would be great.
ideally i would fix the error, and i would move the data to another drive, shrink the partition, make a new partition with EXT4 instead of XFS, and move the data to the new partition, shrink, expand, and keep doing that until everything is moved to EXT4; i think this issues are occurring because using luks on XFS is not a common thing, so it’s probably untested and unstable.

The best thing to do, IMO, is to mount a physical drive of at least equal size to the failed one and use dd (via a Live CD) to make a 1:1 copy. Then try fixing the new disk with the xfs tools. If that works, reformat the encrypted original drive with a different FS (like ext4, btrfs or jfs) and copy the data back.

HTH!

i do not own nor can afford a drive of the same size right now sadly.

http://xfs.9218.n7.nabble.com/Assert-in-xfs-repair-Phase-7-and-other-xfs-restore-problems-td33368.html

I have found a possible solution for this problem in this mailing list.
The solution looks to be to clear the corrupted inode (132)
but i’m unable to find a way to do this while the drive is unmounted. Does anyone know?

XFS supports online fscheck. I would imagine, you would use the same method but not mount the partition. If you are using disk encryption though, I can’t tell you how. But use the ArchWiki
https://wiki.archlinux.org/index.php/XFS#Data_corruption

This is not a possible option, as afaik xfs_scrub requires a mounted disk, which is something i can’t do.

1 Like

This topic was automatically closed 273 days after the last reply. New replies are no longer allowed.