koverstreet / bcachefs

Other
632 stars 69 forks source link

Data Recovery Questions #676

Open Ironlenny opened 1 month ago

Ironlenny commented 1 month ago

So I was a dumbass and intentionally overwrote my Bcachefs caching device during a system upgrade, thinking I could just mount the backing device. I honestly don't know what I was thinking.

What options do I have to recover my data? Is it possible to attach the backing device to a bcache device? To a new bcachefs filesystem? Will a utility like TestDisk help? Am I just hosed?

Edit: I do have backups, but I don't know how recent they are.

raldone01 commented 1 month ago

What was the setup of your bcachefs? (Format command)

If you plug in all the remaining drives and try to mount one of them what is the error output in your terminal and dmesg?

You may be able to recover some data by mounting with fsck,fix_errors mount options. You should create a backup copy (dd or pv) of all bcache drives before doing so. Also unplug the backups and verify them on another machine to avoid further human error.

notcancername commented 1 month ago

Out of curiosity: since cache devices have durability=0, shouldn't mounting the backing device be perfectly fine?

raldone01 commented 1 month ago

Well it depends on the type of cache that was used. A writeback cache would be problematic. A writethrough cache should be no problem. That's why I asked for the format command. Bcachefs is very flexible when it comes to the specific cache type used.