Question:How does parity work on a RAID-5 array? ?? ??(5 answers) ?? ???Closed 7 years ago. ?

In a raid 5 setup, you get 4 TB of usable space out of 3 x 2 TB disks. How is that possible?

Simple minded as I am, I would think that you need 4TB to store your things, and use the remaining 2TB for recovery. But how can I recover 4TB out of only 2TB? If 1kb is gone, I only have 0.5kb to recover from. And if that is sufficient, why not use 0.5kb for storage right from the start.

I know this is a naive question. But what is the answer?

Answer: For the example, we have 3 disks. One disk holds the parity information, the other two the data (thus you lose 1 disk worth of space to parity). Now, for every bit the parity is calculated, such that all of the disks contain always an even number of bits at the same position. (This example is the basic theory, the implementation might differ slightly):

?Data 1 ?Data 2 ?Parity ?0 ?0 ?0 ?0 ?1 ?1 ?1 ?0 ?1 ?1 ?1 ?0

If you lose one disk and have now (for this position on every disk) the information 1?1 you know, that the ?must be 0 because you have to get an even number of bits. Same for e.g. ?00 (==000) or any other combination, also with more data parts (works the same also for 20 data and 1 parity disks). Also long as you lose only any one disk (one bit per parity group), you’re fine.

Note: The position of the parity rotates (with RAID-5) over the disks for every stripe (RAID block, something between 2k and 64k bytes), to spread the load on the disks evenly.