We all have limited time to study long and complicated information about RAID theories, but you may be interested as to how RAID 5 works. We made it simple for you by providing the shortest and easiest explanation ever.
RAID 5 – how it works?
First we need to remind you XOR definition:
XOR function result is equal 1 if both arguments are different.
XOR (0, 1) = 1
XOR (1, 0) = 1
XOR function output is equal 0 if both arguments are same.
XOR (0, 0) = 0
XOR (1, 1) = 0
Now let us assume we have 3 drives with the following bits:
| 101 | 010 | 011 |
And we calculate XOR of those data and place it on 4th drive
XOR (101, 010, 011) = 100 (XOR (101,010) = 111 and then XOR (111, 011) = 100
So the data on the four drives looks like this below:
| 101 | 010 | 011 | 100 |
Now let’s see how the XOR MAGIC works. Let’s assume the second drive has failed. When we calculate XOR all the remaining data will be present from the missing drive.
| 101 | 010 | 011 | 100 |
XOR (101, 011, 100) = 010
You can check the missing other drives and XOR of the remaining data will always give you exactly the data of your missing drive.
| 101 | 010 | 011 | 100 |
XOR (101, 010, 100) = 011
What works for 3 bits and 4 drives only, works for any number of bits and any number of drives. Real RAID 5 has the most common stripe size of 64k (65536 * 8 = 524288 bits )
So the real XOR engine only needs to deal with 524288 bits and not 3 bits as in our exercise. This is why the RAID 5 needs a very efficient XOR engine in order to calculate it fast.
So when adding one drive for parity you will be able to rebuild the missing data in case of any drive failure.
In our example we have explained RAID 4 where parity is on a dedicated drive. RAID 5 will distribute parities evenly between all drives. Distributed parity provides a slight increase in performance but the XOR magic is the same.
To learn more about RAID 5 please go to Wikipedia article.
RAID – The Series. Check out:
RAID Calculator
We know that your data is priceless – calculate how many disks you need to get it safe!
37 Comments
Shirish /
04, 04 2012 01:39:40Gr8 Explanation !!
But Need to explain how your read/write operation works on RAID5.. that is actual point .. in case of parity ..
–Shirish Shukla
TJ /
02, 10 2012 09:31:15What do you guys mean great explanation??? This is a half-way explanation. How about starting out by EXPLANING what the heck XOR is??? What does it stand for? What is it? Where did it come from? Is it just a variable?? That’s like those people who tell stories about people you’ve never heard of before as if you should know who they are: “So me and Bill went to John’s house and then Phil walked in”. Come on…..
And if that’s not enough, how about explaning what XOR (101,010) = 111 actually means. I’m guessing by way of simple addition that they are adding the bits together on the left side and then subtracting them on the other, but still……….NO EXPLANATION!!! You know how I can tell a developer write this little “explanation”? Because this is exactly the type of stuff developers do and they have no idea why people have to keep asking them 50 questions. It’s not because we’re stupid, it’s because they give half explanations.
But other than that it’s pretty cool. 😛
kerry /
27, 12 2013 06:05:12Did you read the article or are you just dumb? The author very clearly explained XOR. I am not a developer and I have never heard of XOR before. I understood RAID generally but could not understand how you got redundancy with only 4 drives and capacity equal to 3 drives w/ RAID 5. This explanation cleared it up for me. You still have questions b/c you can’t read or (more likely), you have low intellect.
nyc seo expert /
30, 11 2012 12:15:20Great info. Lucky me I recently found your site by accident (stumbleupon).
I’ve saved as a favorite for later!
Market /
01, 01 2013 01:15:35Thank you for simplifying RAID 5, much easier to understand with your XOR example.