How does RAID 5 work? The Shortest and Easiest explanation ever!

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:


Download DSS V7


VN:F [1.9.22_1171]
Rating: 4.8/5 (36 votes cast)
How does RAID 5 work? The Shortest and Easiest explanation ever!, 4.8 out of 5 based on 36 ratings

Related Posts

Janusz Bak

About the Author: Janusz Bak

Janusz has over 20 years of software engineering experience, and is a recognized expert on storage technologies. Before Open-E Janusz headed up German support operations at Aztech Systems, a publicly listed East Asian manufacturer of multimedia PC components. Prior to Aztech, Janusz developed the service and support function of Mega, a Polish IT systems house. is an engineer by training, and received his Master of Engineering from the University of Science and Technology in Krakow.

27 Comments + Add Comment

  • Good catch!
    I really like this explanation :)

    VA:F [1.9.22_1171]
    Rating: 0 (from 0 votes)
  • This is realy easy ! like 1 + 1 = 0. Thanks for this.

    VA:F [1.9.22_1171]
    Rating: +1 (from 1 vote)
  • I give it XOR(111,011)% score, thank you very much for that.

    VA:F [1.9.22_1171]
    Rating: +2 (from 4 votes)
    • It should be XOR(110,010,001) % Score……. :)

      VA:F [1.9.22_1171]
      Rating: +1 (from 3 votes)
  • Understood 3 drive, but wasn’t sure how 4 drive worked. Excellent explaination, simply phrased so even I could catch it on first read. Have just built my first 4 drive Raid 5 PC. Many thanks !!!

    VA:F [1.9.22_1171]
    Rating: 0 (from 0 votes)
    • I will try to help you …
      In case of using more than 3 drivers you must use the same calculation for xor:
      XOR 0,0=0
      XOR 0,1=1
      XOR 1,0=1
      XOR 1,1=0
      4 drives with following data:
      We calculate XOR of those data and place it on 5th drive;
      for the 1st line XOR(1,1,0,1)=1
      for the 2nd line XOR(1,0,0,0)=1
      for the 3th line XOR(0,0,1,0)=1
      for the 5th line XOR(0,1,1,0)=0
      so the data looks like these:
      and now let simulate break of 3rd drive
      so we must get the data for this drive so we must calculate XOR for x from 1st 2nd 4th and 5th drive:
      x for the 1st line from XOR(1,1,1,1)=0 why ? 1,1=0 -> 0,1=1 -> 1,1=0
      x for the 2nd line from XOR(1,0,0,1)=0
      x for the 3rd line from XOR(0,0,0,1)=1
      x for the 4th line from XOR(0,1,0,0)=1
      You have to always calculate sum of two numbers and the result calculate with the next number. Action is alternately for XOR.

      I hope this helps.

      VA:F [1.9.22_1171]
      Rating: +2 (from 4 votes)
  • this is short! and easy! THANK GOODNESS because raid5 is a terrible bore. thank you!

    VA:F [1.9.22_1171]
    Rating: 0 (from 2 votes)
  • Very good explain. Thanks

    If my 2 disks are failed at a time, out of 7 disks, is it possible to get the data in raid 5. I know raid can tolerate only one disk failure, sometime it makes me confuse.

    Thanks in advanced.

    VA:F [1.9.22_1171]
    Rating: 0 (from 0 votes)
    • No, the data is unrecoverable. simply put, raid 5 only tolerates a single drive failure because of the way xor works, if you had data of 1010, and lost 2 drives making it x01x, there’s no way to calculate both of the missing values. Raid 6 would work because of a double parity.

      VA:F [1.9.22_1171]
      Rating: 0 (from 0 votes)
  • Actually, I should have used 7 drives in my example, but the math is the same, 0101010, 2 drives missing, 01x101x, still don’t know if the total string should add up to a 1 or a 0.

    VA:F [1.9.22_1171]
    Rating: 0 (from 0 votes)
  • Excellent explanation. I tried in different sites and got the concept but I was not clear about how the parity plays a role. The explantion given here, clears off my questions. Thanks alot for the details.

    VA:F [1.9.22_1171]
    Rating: 0 (from 0 votes)
  • Excellent and simple explanation.
    Thanks a lot.

    VA:F [1.9.22_1171]
    Rating: 0 (from 0 votes)
  • Gr8 Explanation !!

    But Need to explain how your read/write operation works on RAID5.. that is actual point .. in case of parity ..

    –Shirish Shukla

    VA:F [1.9.22_1171]
    Rating: 0 (from 0 votes)
  • What 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. :-P

    VA:F [1.9.22_1171]
    Rating: -7 (from 21 votes)
    • Did 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.

      VA:F [1.9.22_1171]
      Rating: +2 (from 4 votes)
  • Great info. Lucky me I recently found your site by accident (stumbleupon).

    I’ve saved as a favorite for later!

    VA:F [1.9.22_1171]
    Rating: 0 (from 0 votes)
  • Thank you for simplifying RAID 5, much easier to understand with your XOR example.

    VA:F [1.9.22_1171]
    Rating: 0 (from 0 votes)
  • Hello,

    Could you please explain to me how the raid6 works when two drives missing?


    VA:F [1.9.22_1171]
    Rating: 0 (from 0 votes)
    • Hey Gabor!
      For RAID6, the minimum required disks are four. Two drives can be missing and the system will still work. However, you have to remember that in case these two drives will be rebuilding, the performance might be slower.
      You can find more info here and here.

      VN:F [1.9.22_1171]
      Rating: 0 (from 0 votes)
  • .Its really a good & easy explaination…,
    about raid…

    VA:F [1.9.22_1171]
    Rating: -1 (from 1 vote)
  • clear and simple. so does this mean that there is always a disk dedicated to the “checksum” in a raid5 configuration? Or is both data and XOR bits are distribuited on all drives?

    VA:F [1.9.22_1171]
    Rating: 0 (from 0 votes)
    • Janusz Bak

      Your question is answered in last 2 sentences of my article. In fact I was describing RAID4, but my goal was to make clear how XOR magic works for parity in RAID. My goal was also to make the explanation really easy and short. This is why I have started with RAID4 and referenced to RAID5 Wikipedia post which is already long and much more complicated to understand. The difference between RAID4 and RAID5 is only that RAID5 distributes parity and RAID4 keeps parity in a dedicated drive. It is not so important if you want just understand how parity calculation works.

      VN:F [1.9.22_1171]
      Rating: 0 (from 0 votes)
  • Very good explanation!!

    VA:F [1.9.22_1171]
    Rating: 0 (from 0 votes)
  • So in RAID4 if the parity drive fails, all your data could be lost right?

    VA:F [1.9.22_1171]
    Rating: 0 (from 0 votes)
    • Losing the parity disk in RAID 4 is NOT a problem for the data.
      You will just have the data without parity.
      So, your RAID array is in the degraded mode – as next disk fail will cost data loss.
      After replacing the drive, the rebuild task will re-create the parity based on the data.
      Once the parity is re-created, your RAID array status switches from degraded to normal.
      And now, the array is ready to tolerate the next disk fail and does not lose all the data.

      VN:F [1.9.22_1171]
      Rating: +2 (from 2 votes)
  • Really thanks you very much for explanations.

    VA:F [1.9.22_1171]
    Rating: 0 (from 0 votes)
  • Good explanation. Thanks :)

    VA:F [1.9.22_1171]
    Rating: -1 (from 1 vote)

Leave a comment



  • Support for NAS, iSCSI, FibreChannel
  • High-Availability over 2 nodes
  • Reasonable pricing

Subscribe to our blog

Enter your email address:

Delivered by FeedBurner

URL via QR

QR Code fuer diese Seite
If you want to read this article on your mobile device, scan the QR code.