How does RAID5 work? [duplicate]
Solution 1:
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.
Solution 2:
With RAID 5, the rule of thumb is that you lose the equivalent of one drive out of your set to parity. It also means that you can lose a maximum of one drive from your RAID set before recovery is impossible.
So with three drives (the minimum for RAID 5), you would have 3TB in total, but 2TB usable. As you increase the number of drives, your chances of failure increase, because you are only able to lose one drive out of the entire set.
So your files are saved like this:
Drive 1: Striped Data
Drive 2: Striped Data
Drive 3: Parity
The parity bits are randomly distributed across the disks, so from one byte to the next, you don't know specifically which drive your file is on, and which is parity.
Does that help?