Return to

[SOLVED] BTRFS filesystem corrupted. help needed

my home server’s main SSD runs BTRFS. there was recently a power outage and my system is no longer able to function at all because of it.
i have a debian live session on a USB device i can boot, which is how i got these logs. this is using Linux 4.19.

i can read most of the files on this SSD, but there are some that cause errors when i try to read them. it so happens that at least one of these error-causing files is very important and i would like to avoid losing it by any means necessary.

i have already been ridiculed by my peers for not having a backup ready-to-go. lesson definitely learned. a backup script will be my first priority if/when i get this system back up and running.

my sincerest apologies, but i have no way to properly get a textual copy of my dmesg, the best i can do is upload pictures i have taken with my phone.

Terminal images

1 Like

I would start with ddrescue and image that drive so you can work on the image


i now have an image of the SSD in question. ddrescue reports zero errors. this makes me believe that there is no physical damage on the SSD.

I wouldnt expect there to be. The errors should just be limited to the data itself. Maybe now throw testdisk at the image and see what happens.

1 Like

i cant seem to find any option within testdisk to attempt to recover the data

does it detect the filesystem correctly?

it correctly detects the partition table, but the FAT32 bootloader partition and the main BTRFS partition both show up as “MS DATA”. the swap partition is detected correctly.

pressing “P” to list files yields the message: “Support for this filesystem hasn’t been implemented”

1 Like

Go ahead and set the partition you believe is your btrfs to primary and write it out. Once completed you can attempt to mount it.

It would seem this is a known shortcoming of testdisk and btrfs

1 Like

attempting to loop-mount the BTRFS partition from the image yields an error identical to what happens when i tried to mount it straight from the SSD.

hm, maybe use photorec to see what it yields as far as files?

I’m not much of a data recovery person beyond the simple stuff.

UPDATE: i have used “btrfs restore” to create a copy of every file on the corrupted filesystem. including the ones i had trouble reading.
im not certain every file was copied correctly, but i have no choice but to assume they were. these copies are on my mass storage array.

unsure what to do now, still have a corrupted BTRFS tree on the SSD.

1 Like

well you have the image, so you could copy it for good measure and then begin rebuilding your setup.

i cant write anything to this SSD. BTRFS forces it to read only mode since it errors while mounting

interesting. got any smart data?

smartctl says the SSD is fine. no errors.

unmount it and nuke it then.

id rather not have to recreate my bootloader setup. there must be a way to repair the existing system

can you not just restore it after you’ve reformatted it?