fmoledina / snapraid-btrfs-runner

MIT License
31 stars 11 forks source link

btrfs scrub pre snapraid sync #8

Open o010b opened 2 years ago

o010b commented 2 years ago

I would like to suggest checking data volumes for bit rot or otherwise corruption using btrfs scrub before updating the snapraid parity. Cheers.

einsteinx2 commented 2 years ago

Since btrfs automatically verifies checksums on read, running a full scrub should not be necessary (not to mention it would take an incredibly long time to scrub all volumes if you have large drives). If the checksum of the file fails to verify, it should result in a read error of the file, which presumably snapraid would detect as it would any other read error like a bad sector.

Check out this SO answer for some more detailed info and an example script to confirm it works this way: https://superuser.com/a/1285549/66111

Nosirus commented 1 month ago

Hi, I'm coming back to this to understand, btrfs already checks the files in reading but only if they are read, so if the file is not used for 2 years, an error can be created? I use NixOS I have a service that launches a scrub of the mount points every month do you think that's enough?