Published under Category : Hard Disk Drives

Magic of RAID parity and Failure tolerance of ANY drive in an array

RAID 1 is easy to understand. 2 hard drives mirrored to each other. Call it cloning, bit-for-bit copy, exact copy or mirroring, it is easy to visualise.

But if you try to apply the same analogy to, say, RAID 5, it defies logic. We have been asked this question so many times that we finally decided to write this article for everyone who is curious about how RAID 5 works.

Let us look at RAID5 - you are told that if ANY of the drives in RAID5 fail, you can recover your data. So if you have 4 drives in a RAID 5 and ANY 1 drive fails, you can logically recover data/rebuild. how can 1 drive store the data of the other 3 drives.

That's the problem - how is the data in an array of 4 drives distributed so that ANY 1 drive can fail without affecting the data.

The magic is in the parity bit of RAID. The easiest way to understand parity is to think of it as a sum of all the values . Let me first give you an analogy.

Let us say you have 4 cards, each with a number and a 5th card with the sum of all the numbers (marked to show that ). Now if one card fails, any card, you can easily infer the number that card would have had.

CARD 1
CARD 2
CARD 3
CARD 4
CARD 5
4
7
3
2
Sum= 16

 
So if card 1 is missing in the above figure, you can derive the value to 16- (7+3+2) = 4.

CARD 1
CARD 2
CARD 3
CARD 4
CARD 5
?
16-(7+3+2)
7
3
2
Sum= 16

 

Similarly card 2 data can be derived with 16- (4+3+2)= 7 . Same for card 3 and 4. This is a greatly simplified version of how RAID 5 works.  Actual RAIDs use XOR operation to calculate the parity bit, unlike the sum in our example.

RAID5 has just 1 parity bit calculated with XOR and RAID 6 has 2 parity bits. With XOR you can not only calculate the parity bit, but also do the reverse calculation easily.

We will not go into the technical details of the XOR operation here, which is one of the many functions used to calculate parity, as there are already very good articles on the internet explaining this. But we hope that our missing card analogy, with the sum known will give you an idea of the logic behind RAID parity.  RAIDs are a great way to protect you against hardware failure and hopefully you know now how they work.

 

0 comments

About Author : Akash Jain

I have worked in Data Storage Industry since 1998. I loves Technology and write often about NAS, Hard drives, Tapes and Flash technologies

FREE Delivery in UAE

Including Dubai, Abu Dhabi and Sharjah

NAS Experts

QNAP , Synology Top Sub Distributor and Service Partners in UAE

TOP Integrator

Second time Winner of GEC Awards in Data Storage Category UAE

Honest and Credible

4.8+ Star Google rating. Thousands of satisfied customers in UAE