Data integrity in ZFS

ronclark

Dabbler
Joined
Dec 5, 2017
Messages
40
I have a question i can't seem to find the answer too, my guess i am using the wrong search keywords.

So as far as data integrity / bit rot in ZFS is there any differance between Mirrors and RAIDZn?
 

garm

Wizard
Joined
Aug 19, 2017
Messages
1,556
Of course there are differences, what did you have in mind?
 
Joined
Jan 4, 2014
Messages
1,644

ronclark

Dabbler
Joined
Dec 5, 2017
Messages
40
Of course there are differences, what did you have in mind?

so can ZFS deal with bit rot in a mirror as well as it can with RAIDZn? I know parity is there to rebuild the array in a RAIDZn, in a MIRROR is that just a copy of that drive. I trying to figure out the error detection part of ZFS
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,700
so can ZFS deal with bit rot in a mirror as well as it can with RAIDZn? I know parity is there to rebuild the array in a RAIDZn, in a MIRROR is that just a copy of that drive.
I'm sure you can find some good material out there from @Allan Jude which will cover the topic to more than your required level of detail.

Basically, a mirror is an entire second copy on a physically separate disk, so it can indeed serve as (some) protection from bit-rot when doing a scrub (and associated repair operation if needed).

RAIDZx also has additional copies (or in this case information good enough to reconstruct the original - data and parity) of the original data stored in striped across multiple physical disks (at least 3).

As far as my understanding goes, I don't think a 2-way mirror is any better or worse than RAIDZx for that.

A 3, 4 or more-way mirror on the other hand would be multiple full copies, so your chances of correcting bit-rot go up (although we're already talking small percentages that both copies are rotten in the same bits, so I don't think a 30-way mirror is 30 times as likely as a 2-way mirror to be able to recover, it's probably 1.1 times as likely or something like that).

I think ZFS also stores some level of checksum even on a single disk/stripe, so you would know if your data are rotten, but would have nothing to recover from without some kind of redundancy in your data storage.

Bit-rot aside, an x-way mirror gives you a better chance of resilvering without a total loss of data, so there's that.
 

Chris Moore

Hall of Famer
Joined
May 2, 2015
Messages
10,079
The protection is, everything written to disk in ZFS is checksummed even the checksum gets a checksum. That's what allows ZFS to determine the data is correct or not. If the data from disk don't match up with the checksum, then ZFS attempts a recovery from parity data. It doesn't matter to ZFS why the checksum failure happens. To test it is working, you can write some junk into a data space to create a corrupt block. The process of monitoring disks for health is separate from the pool integrity.
What do you really need to know?
 

ronclark

Dabbler
Joined
Dec 5, 2017
Messages
40
I'm sure you can find some good material out there from @Allan Jude which will cover the topic to more than your required level of detail.

Basically, a mirror is an entire second copy on a physically separate disk, so it can indeed serve as (some) protection from bit-rot when doing a scrub (and associated repair operation if needed).

RAIDZx also has additional copies (or in this case information good enough to reconstruct the original - data and parity) of the original data stored in striped across multiple physical disks (at least 3).

As far as my understanding goes, I don't think a 2-way mirror is any better or worse than RAIDZx for that.

A 3, 4 or more-way mirror on the other hand would be multiple full copies, so your chances of correcting bit-rot go up (although we're already talking small percentages that both copies are rotten in the same bits, so I don't think a 30-way mirror is 30 times as likely as a 2-way mirror to be able to recover, it's probably 1.1 times as likely or something like that).

I think ZFS also stores some level of checksum even on a single disk/stripe, so you would know if your data are rotten, but would have nothing to recover from without some kind of redundancy in your data storage.

Bit-rot aside, an x-way mirror gives you a better chance of resilvering without a total loss of data, so there's that.

Thanks, I was thinking something like that might be happening.
so the metadata/checksum is not tied to the parity data unlike some systems that need that parity data to know something went wrong like unRaid, Snapraid does if i am understanding this right.
 

pschatz100

Guru
Joined
Mar 30, 2014
Messages
1,184
Thanks, I was thinking something like that might be happening.
so the metadata/checksum is not tied to the parity data unlike some systems that need that parity data to know something went wrong like unRaid, Snapraid does if i am understanding this right.
Correct. There is no parity disk in ZFS. It is one of the reasons why ZFS is more fault tolerant than something like unRaid. Any disk can fail when you have redundancy, and you will still be able to use the pool and recover your data.

Mirrors, RaidZ1, Raid Z2, etc. define how many disks can fail before you lose the pool.
 

ronclark

Dabbler
Joined
Dec 5, 2017
Messages
40
Thanks for the input, I was trying wrap my head around this. did some google searching and was coming up with just do mirrors its better. not really helpfully when tryting to get a better uderstanding what under the hood
 

Apollo

Wizard
Joined
Jun 13, 2013
Messages
1,458

garm

Wizard
Joined
Aug 19, 2017
Messages
1,556
I really don’t like the RAID analogy because it’s always leading to confusion..
A pool of N mirror vdevs is not equivalent to RAID1 or 0. It’s a striped (RAID0) array of N-way mirrors (RAID1), hens it’s equivalent to RAID10. Or less confusingly put, a ZFS pool of mirror vdevs...
 
Joined
Jan 4, 2014
Messages
1,644
RAID 1 is equivalent to a mirror as it implements redundancy.
RAID 0 is just stripping the data in half.
You're absolutely right. Brain fart on my part. It's now clear to me why a mirror doesn't have a ZFS equivalent.
 

Apollo

Wizard
Joined
Jun 13, 2013
Messages
1,458
You're absolutely right. Brain fart on my part. It's now clear to me why a mirror doesn't have a ZFS equivalent.
ZFS has its equivalency and is referred as "Mirror" as well, except it allows more than 2 drives to be part of the mirror for greater redundancy, but the reason behind is also to achieve higher IO per seconds.
 
Top