Questions about BTRFS data corruption and snapshots

btrfs

I am curious what happens when we have a corrupted uncorrectable file in a file system with snapshots—such as BTRFS—and we try to replace the file from backup? I suspect, that the snapshots will still contain the corrupted version of the file. Is there a way to fix these errors in snapshots too?

Another related question what happens if the snapshot itself is damaged? Will we lose it?

Best Answer

The snapshots will still contain corrupted versions, because the idea of them is that they are Point-In-Time. At the point in time in question they happened to be corrupt.

After Googling BTRFS sbnapshots it looks like you should be able to mount the snapshots, make changes to that file on the snapshot and that will work.

If its just the file thats damaged, and you have a backup, it should not be to big a deal. If the filesystem is damaged, that could be a lot worse.

With respect of "what happens if the snapshot itself is damaged" - this should be unlikely under BTRFS, but I expect the logic would be to copy it to another block device, and then attempt recovery on that block device as if it were the original FS.

(Disclaimer - I've never used BTRFS. I'm little more then a novice when it comes to ZFS, but I've got a fairly good grasp of the concepts)

Related Question