Sample Header Ad - 728x90

Restore a BTRFS drive's root tree that was erroneously overwritten with 100MB FAT storage

0 votes
1 answer
320 views
I have a 4TB drive with a BTRFS filesystem on it (no partition) that was erroneously overwritten by Windows' installer which determined that the space was unused and that it would use it for some other purpose (Recovery?) and put a 100MB FAT partition on top of it. Short of it is that all of the content of the drive is currently inaccessible. For the most part, a lot of my really critical files have backups on my home server so the damage isn't extraordinarily overwhelming, but there are always a few rogue files that are missed in the backup that you only figure out when you look to back up. As a result, I've been looking for some way to either restore the file system or perhaps browse whatever contents are still sitting around on the disk. So far, I've done the following: I've run btrfs rescue super-recover which outputs the following: $ sudo btrfs rescue super-recover -v /dev/sda All Devices: Device: id = 1, name = /dev/sda Before Recovering: superblock bytenr = 65536 device name = /dev/sda superblock bytenr = 274877906944 superblock bytenr = 67108864 Make sure this is a btrfs disk otherwise the tool will destroy other fs, Are you sure? [y/N]: y checksum verify failed on 25001984 wanted 0x00000000 found 0xb6bde3e4 checksum verify failed on 25001984 wanted 0x00000000 found 0xb6bde3e4 ERROR: cannot read chunk root Failed to recover bad superblocks I also attempted to run sudo btrfs rescue chunk-recover but the result was also similar: It couldn't find a valid tree root. Next, using the IDs above, I tried to restore the disk to a file location: $ sudo btrfs restore -t 78515 -u 1 /dev/sda /tmp/a No valid Btrfs found on /dev/sda Could not open root, trying backup super checksum verify failed on 25001984 wanted 0x00000000 found 0xb6bde3e4 checksum verify failed on 25001984 wanted 0x00000000 found 0xb6bde3e4 checksum verify failed on 25001984 wanted 0x00000000 found 0xb6bde3e4 bad tree block 25001984, bytenr mismatch, want=25001984, have=0 ERROR: cannot read chunk root Could not open root, trying backup super Similar problem: There's no longer a valid root due to that 100MB FAT! Lastly, I know of the option of browsing files with testdisk but it doesn't seem like I can browse all remaining files from a BTRFS filesystem: The only option is to clone an image of the disk. Does anyone have any potential solution for browsing individual files on a invalid BTRFS filesystem or perhaps partially recreate the root? I don't need to restore the whole file system really, ideally I'd be able to get as many files from a subvolume (for example @pictures) that are still "valid" enough to be a real file. Is there a way to recreate the root tree of the BTRFS filesystem to try to recover as many files on the disk? I can see a table of file names when I do sudo strings /dev/sda | less which seems to imply that I might be able to find some data associated with those files further down the disk, but I have no clue how to check that.
Asked by TheYokai (143 rep)
Nov 10, 2024, 12:09 AM
Last activity: Nov 10, 2024, 12:47 AM