Hello,
I feel like the topic was discussed quite a bit in other forum threads, but still, in my opinion it was not a clearly answered to some of mine questions. Thats why I decide to investigate on my own.
I do not agree that when Bitrot is detected on array we are screwed up our Bitrot affected data without any backup.
This is how I tested it:
- I add rather small pendrive (32gb) formatted in ZFS (uncompressed and not encrypted) to array (I suppose that brtfs will work as well):
- I created text file :
root@home:/mnt/disk2# cat 123.txt
abcdefgh_123_elo
- I intentionally broke one bit in this file. How? You cannot simply modify an file since it will end up modified and not corrupted. I used here operation on raw disk data.
I created a bunch of raw sectors out of /dev/sdX using linux dd command - in my case - sda is my pendrive:
dd if=/dev/sda of=/mnt/user/test/sector bs=512 count=2000000
2000000 * 512 gives us 1 GB of raw disk data stored as file named sector . For the next sectors I used -skip=already readed sectors option.
and I used Hex editor to locate my file and its content stored as raw data (I used Vim here but other might work as well).
at around 9GB I spot:
I changed manually only one bit (from 63 to 62) in those found sequence so in ASCII hex representation it was abbdefgh_123_elo.
Then I used scrub.
root@home:~# zpool status -v
...
pool: disk2
state: ONLINE
status: One or more devices has experienced an error resulting in data
corruption. Applications may be affected.
action: Restore the file in question if possible. Otherwise restore the
entire pool from backup.
see: https://openzfs.github.io/openzfs-docs/msg/ZFS-8000-8A
scan: scrub repaired 0B in 00:00:01 with 1 errors on Tue Mar 12 14:49:47 2024
config:
NAME STATE READ WRITE CKSUM
disk2 ONLINE 0 0 0
md2p1 ONLINE 0 0 2
errors: Permanent errors have been detected in the following files:
/mnt/disk2/123.txt
So basically I achieved the detected corruption of 123.txt file.
just for confirmation:
- I ran Unraid parity check with UNCHECKED Write corrections to parity which gives me 1 error during check.
- I stopped Array, removed disk from array, start array, and emulated 123.txt file worked well:
- I added once again the same pendrive to the array to rebuild it and everything worked as suspected.
So conclusion?
- Run ZFS Scrub (or Btrfs equivalent) first to detect any possible errors
- if errors is detect you can check Unraid parity check but WITHOUT Write corrections ! ! ! -
if you enable it you update the parity drive with corrupted data
- rebuild the corrupted drive to possibly a new one
Hope this helps some of you.
Regards