Doubt about ZFS

cmacetko

Cadet
Joined
Oct 1, 2022
Messages
1
Hello Guys

I'm building a Nas, and before that I'm studying and testing the forms of redundancy that Truenas provides.
I arrived at the best scenario where I use RaidZ with 3 HDs, each HD being 4 tb, leaving 8 tb available for use.

However, I don't understand how it is possible for a HD to stop working without losing data.

Example:
I filled the 8TB of data, fully occupied.
One of the HDs stopped working.
HOW is it possible for me not to lose data? After all, I have 8 tb busy.
 

jgreco

Resident Grinch
Joined
May 29, 2011
Messages
18,680
It's called parity. There's lots of information on it, it's basic computer science.

You've got 12TB of raw hard disk, 3 x 4TB. Let's call them disks X, Y, and Z.

If you need to write some data, what you do is you use the redundancy available here to protect the data. You take the bytes you write to disk X, add them to the bytes you write to disk Y, and store those on disk Z. Now, if you lose disk Z, there's no problem because there was no unique data on it. If you lose disk Y, you can reconstruct it by subtracting X from Z. If you lose disk X, you can reconstruct it by subtracting Y from Z. The actual implementation is a lot more complicated and a good bit more clever, but the fundamentals are based on this idea that you can lose one of X, Y, Z and still be able to reconstruct what it was, because you know the mathematical relationships imposed on these.
 

Davvo

MVP
Joined
Jul 12, 2022
Messages
3,222
RAIDZ1 is considered risky nowadays, you should go RAIDZ2.
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
The question you ask really doesn't have anything to do with ZFS as such; it's more a matter of parity RAID in general, which has been going on for over 30 years. ZFS' implementation is different in a variety of ways from "classic" RAID 5, but the relevant principle is the same.

But to be clear on a couple of side issues, in case you're thinking you can store 8 TB of data on an array of three 4 TB disks:
  • Operating systems (other than macOS) use increments of 2^10 (or 1024 bytes) to describe file sizes, sometimes denoted as KiB (1024), MiB (1,048,576), GiB (1,073,741,824), etc. Hard drive manufacturers uniformly use increments of 10^3. At the TB/TiB level, that amounts to a difference of about 9%, so the "4 TB" drives have a capacity of 3.64 TiB. The array you describe would thus have a "raw" capacity, before allowing for ZFS overhead, reserved space, and other factors, of 7.27 TiB.
  • For reasons of performance and stability, it's recommended to keep your storage pool not more than 80% full. That would mean, again ignoring ZFS overhead, reserved space, and other factors, that the array you described would have a usable capacity of 5.82 TiB.
 
Top