User:Massimo B./Btrfs-repairing-01
From Gentoo Wiki
Jump to:navigation
Jump to:search
btrfs on LUKS on a NVMe disk inside USB enclosure. This btrfs contains all different snapshots from different machines, via btrbk and a lot of bees deduplication. Now it's damaged due to memory corruption on any of the working machines, or weak USB links... Chances are that only free space tree is corrupted and mounting ro could still restore all data.
Kernel: 6.12.16-gentoo-dist
root #
btrfs check /dev/mapper/mobiledata_crypt
Opening filesystem to check... Checking filesystem on /dev/mapper/mobiledata_crypt UUID: 8fefabb7-11a7-4e12-8ee6-dc8f1529f8e5 [1/8] checking log skipped (none written) [2/8] checking root items [3/8] checking extents checksum verify failed on 2564600332288 wanted 0x98e25cd6 found 0xbab4624d checksum verify failed on 2564600332288 wanted 0xc04b5087 found 0xc3757de0 checksum verify failed on 2564600332288 wanted 0x98e25cd6 found 0xbab4624d bad tree block 2564600332288, bytenr mismatch, want=2564600332288, have=4363494421962462810 owner ref check failed [2564600332288 16384] ERROR: errors found in extent allocation tree or chunk allocation [4/8] checking free space tree checksum verify failed on 2564600332288 wanted 0x98e25cd6 found 0xbab4624d checksum verify failed on 2564600332288 wanted 0xc04b5087 found 0xc3757de0 checksum verify failed on 2564600332288 wanted 0x98e25cd6 found 0xbab4624d bad tree block 2564600332288, bytenr mismatch, want=2564600332288, have=4363494421962462810 could not load free space tree: Input/output error checksum verify failed on 2564600332288 wanted 0x98e25cd6 found 0xbab4624d checksum verify failed on 2564600332288 wanted 0xc04b5087 found 0xc3757de0 checksum verify failed on 2564600332288 wanted 0x98e25cd6 found 0xbab4624d bad tree block 2564600332288, bytenr mismatch, want=2564600332288, have=4363494421962462810 could not load free space tree: Input/output error [5/8] checking fs roots [6/8] checking only csums items (without verifying data) [7/8] checking root refs [8/8] checking quota groups skipped (not enabled on this FS) found 1978635726935 bytes used, error(s) found total csum bytes: 1785865480 total tree bytes: 157852188672 total fs tree bytes: 136425439232 total extent tree bytes: 19102629888 btree space waste bytes: 29931988767 file data blocks allocated: 96097451388928 referenced 29948246061056
This rescue mode would be preferred for not ignoring csums:
root #
mount -v -o ro,rescue=nologreplay,rescue=ignorebadroots,rescue=ignoresuperflags,subvol=/ /dev/mapper/mobiledata_crypt /mnt/usb/mobiledata/
Going on restoring data to a new btrfs: User:Massimo_B./NewBtrbkDevice