How does data redundancy under RAID 5 work?

497 views

I do understand RAID 1. You have two drives that are mirrored. So when one drive fails, you have the full set of data on the other drive.

But with RAID 5 you are able to lose a complete drive out of a set of 3 for example. You have full data redundancy without sacrificing half of your capacity. How does this work?

In: 5

7 Answers

Anonymous 0 Comments

Not sure I can do like 5, but like a teenager maybe.

In RAID 5, data is written to a collection of disks. It writes the data to all the disks except one. For that last disk, a parity bit is calculated for each bit written to the others. That parity bit is either a 1 or a 0, but it tells the system if the actual data, the total of 1’s and 0’s is odd or even. So if one disk is lost, the system can recalculate if it is missing a 1 or a 0. In reality, disks don’t write individual bits, they write in blocks. The parity block will contain all the parity bits for the chunks on the other disks.

In RAID 5, the first block goes on disk 0, then disk 1, then disk 2, etc, The parity block goes on the last disk. Now this is done across all disks in the set. If you have 10 disks, then 9 will hold data while the last one will have the parity bit. The system rotates the starting point so that which disk holds the parity bits for a particular block. That way, all the disks hold the same amount of actual data and parity information. If you lose one disk, the system calculates the missing data from the parity bit for each read/write. This will slow the system down a bit, but you will lose no data. Replacing the disk re-scans all the data and parity bits to repopulate the missing data. That’s why rebuilding a RAID array takes so long.

So like you’re 5: If you have 5 trays. You place an apple on tray 1, an apple on tray 2, no apple on tray 3, and an apple on tray 4. So you have three apples, right? Now there’s a rule, if you have an even number of apples, you don’t put one on tray 5. If you have an odd number of apples, you put one on tray 5 so that your total number of apples is always even. So now you put one on tray 5. That’s the parity tray. Now, if you take away tray 2, can you use that rule to figure out if tray 2 had an apple or not? Sure you can! Since you have three apples left on the 4 trays, the tray that’s now missing must have an apple because you know that there needs to be an even number of apples!

You are viewing 1 out of 7 answers, click here to view all answers.