Question Regarding Mirrored Pools + Block Repair (maybe wrong words for it)

Status
Not open for further replies.

xCatalystx

Contributor
Joined
Dec 3, 2014
Messages
117
Quick Question,

Can someone explain how when HDD's are in mirror pair (or multiple mirrors) how it determines which block is the correct non-corrupt block if damage occurs / change is detected / invalid or different checksum? I couldn't find anything on the forum explaining it in detail or i might just be using the wrong keywords.

I did find details explanations on raidz1-3 but not mirrors.
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
Every block of data written, on any device, has a checksum attached to it. If ZFS reads the data from one disk in a mirrored pair, and the data doesn't match its checksum, it reads the same data from the other disk. If that data matches its checksum, well and good, and ZFS fixes the bad data. If both disks come up with bad data, then you have a problem.
 

xCatalystx

Contributor
Joined
Dec 3, 2014
Messages
117
Ok, how does it know which checksum is right though? I assume the checksum is kept on both mirrors, so in a pair setup how does it determine which checksum is right? In a 3 way mirror I guess it could be worked out, I'm just wondering in 2way.
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
If the checksum matches the data, it's "right". If the data and the checksum are both incorrect in such a way that they match, you have a hash collision, which is (by design) astronomically unlikely.
 

Stux

MVP
Joined
Jun 2, 2016
Messages
4,419
The checksums are checksummed all the way back to the uber block, which has many copies.
 

Ericloewe

Server Wrangler
Moderator
Joined
Feb 15, 2014
Messages
20,194
If the checksum matches the data, it's "right". If the data and the checksum are both incorrect in such a way that they match, you have a hash collision, which is (by design) astronomically unlikely.
Not astronomically unlikely with the default fletcher checksum, but unlikely enough for most uses. If it's not high enough (encryption, dedup, ...), there's always SHA512 and skein.
 
Status
Not open for further replies.
Top