RAID 5
0 Liked

    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


    RAID Calculator

    We know that your data is priceless – calculate how many disks you need to get it safe!

    RAID Calculator


    Rating: / 5.

    No votes yet

    44 Comments

    • RichardS

      September 03, 09 2010 05:26:07

      Good catch!
      I really like this explanation 🙂

      VA:D [1.9.22_1171]
      Rating: +8 (from 8 votes)
    • Lukas

      September 06, 09 2010 01:19:59

      This is realy easy ! like 1 + 1 = 0. Thanks for this.

      VA:D [1.9.22_1171]
      Rating: +8 (from 8 votes)
    • Alaa S.

      November 23, 11 2010 08:17:58

      I give it XOR(111,011)% score, thank you very much for that.

      VA:F [1.9.22_1171]
      Rating: +8 (from 12 votes)
      • Pankaj

        April 11, 04 2012 11:51:54

        It should be XOR(110,010,001) % Score……. 🙂

        VA:F [1.9.22_1171]
        Rating: +4 (from 12 votes)
    • Haydn Bell

      December 23, 12 2010 10:48:50

      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: +1 (from 1 vote)
      • Lukas

        January 08, 01 2011 10:50:53

        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
        Example
        4 drives with following data:
        1,1,0,1
        1,0.0.0
        0,0,1,0
        0,1,1,0
        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:
        1,1,0,1,1
        1,0,0,0,1
        0,0,1,0,1
        0,1,1,0,0
        and now let simulate break of 3rd drive
        1,1,x,1,1
        1,0,x,0,1
        0,0,x,0,1
        0,1,x,0,0
        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: +9 (from 13 votes)
    • Austin Data

      October 12, 10 2011 09:44:04

      this is short! and easy! THANK GOODNESS because raid5 is a terrible bore. thank you!

      VA:D [1.9.22_1171]
      Rating: -1 (from 5 votes)
    • Jack

      February 21, 02 2012 05:59:26

      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 2 votes)
      • Mike

        March 07, 03 2012 08:36:42

        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 2 votes)
    • Mike

      March 07, 03 2012 08:38:29

      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: -1 (from 1 vote)
    • Chimpidi

      March 12, 03 2012 12:52:06

      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 2 votes)
    • Nima0102

      April 01, 04 2012 07:20:07

      Excellent and simple explanation.
      Thanks a lot.

      VA:F [1.9.22_1171]
      Rating: -3 (from 3 votes)
    • Shirish

      April 04, 04 2012 01:39:40

      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 4 votes)
    • TJ

      October 02, 10 2012 09:31:15

      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. 😛

      VA:D [1.9.22_1171]
      Rating: -8 (from 28 votes)
      • kerry

        December 27, 12 2013 06:05:12

        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:D [1.9.22_1171]
        Rating: +4 (from 10 votes)
    • nyc seo expert

      November 30, 11 2012 12:15:20

      Great info. Lucky me I recently found your site by accident (stumbleupon).

      I’ve saved as a favorite for later!

      VA:D [1.9.22_1171]
      Rating: -4 (from 4 votes)
    • Market

      January 01, 01 2013 01:15:35

      Thank you for simplifying RAID 5, much easier to understand with your XOR example.

      VA:F [1.9.22_1171]
      Rating: 0 (from 2 votes)
    • Gabor

      February 17, 02 2013 01:12:41

      Hello,

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

      Thanks

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

        February 19, 02 2013 08:30:59

        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: +3 (from 3 votes)
        • Hugo

          January 02, 01 2017 10:15:42

          Yeah but if you are using 4 drives in raid 6, you may as well use raid 10 because you get the same capacity and redundancy and you get better performance. Also raid 10 is way less complicated and doesn’t require a raid controller which will set you back a good $200.

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

      March 10, 03 2013 03:15:50

      .Its really a good & easy explaination…,
      about raid…

      VA:F [1.9.22_1171]
      Rating: -2 (from 2 votes)
    • adam

      June 28, 06 2013 01:11:12

      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: +1 (from 1 vote)
      • Janusz Bak

        June 28, 06 2013 03:24:50

        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: +1 (from 1 vote)
    • Samit Mandol

      June 30, 06 2013 02:45:23

      Very good explanation!!

      VA:F [1.9.22_1171]
      Rating: +1 (from 1 vote)
    • Mohammad

      October 13, 10 2013 08:55:37

      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)
      • Kasia Kolodziej

        October 14, 10 2013 08:16:00

        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: +1 (from 3 votes)
    • Jignesh Rajguru

      December 26, 12 2013 07:19:46

      Really thanks you very much for explanations.

      VA:F [1.9.22_1171]
      Rating: +1 (from 1 vote)
    • Subrahmanyam

      January 31, 01 2014 09:35:43

      Good explanation. Thanks 🙂

      VA:F [1.9.22_1171]
      Rating: -2 (from 2 votes)
    • Mahsaa

      December 29, 12 2014 05:59:04

      Its really Good .
      thx lot

      VA:F [1.9.22_1171]
      Rating: +1 (from 1 vote)
    • Solz

      March 03, 03 2015 02:20:29

      Thank you very much for the explanation

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

        February 09, 02 2016 07:50:03

        This is crtyasl clear. Thanks for taking the time!

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

      April 25, 04 2016 08:18:07

      Very nice post, good job:-)! Best regards for you!

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

      July 23, 07 2016 07:38:26

      while this is an old post… I’ve got to say well done… excellent piece of work… now I get the parity stuff! Thanks!

      VA:F [1.9.22_1171]
      Rating: 0 (from 0 votes)
    • Eswaran.S

      October 05, 10 2016 09:44:03

      I,m Esay to learn this parity topic……Thank u for giving that good example

      VA:F [1.9.22_1171]
      Rating: 0 (from 0 votes)
    • Siba Sankar

      October 20, 10 2016 08:36:32

      This is kind of an explanation I was searching for. Thank You very much

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

      October 27, 10 2016 11:29:05

      excellent ..
      Thank you for making me to understand clearly

      VA:F [1.9.22_1171]
      Rating: 0 (from 0 votes)
    • john smith

      February 20, 02 2017 03:54:05

      you lost me at XOR , what is XOR?

      VA:F [1.9.22_1171]
      Rating: 0 (from 0 votes)
      • Karolina Pletnia

        February 27, 02 2017 11:47:07

        Hello John! RAID 5 uses the bitwise “exclusive OR” (XOR) function to compute the parity values from the array data. So XOR = “exclusive OR”.

        VN:F [1.9.22_1171]
        Rating: 0 (from 0 votes)
    • Jinny Mcreath

      March 30, 03 2017 05:19:32

      Your way of describing everything in this article is actually fastidious, every one can without difficulty understand it, Thanks a lot.

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

      October 24, 10 2017 03:03:05

      THANKS SO MUCH! GOD BLESS YOU!

      VA:F [1.9.22_1171]
      Rating: 0 (from 0 votes)
    • Website Design

      December 19, 12 2018 12:08:27

      This was way more clear than anything else on the internet. Thank you. I think everywhere else on the internet is scared that people won’t read anything technical.

      VA:F [1.9.22_1171]
      Rating: 0 (from 0 votes)
    • Eitan Lindenberg

      July 01, 07 2019 07:05:32

      As someone who is still learning about how RAID works, this explanation made it very clear. Thank you!

      VA:F [1.9.22_1171]
      Rating: +1 (from 1 vote)
    • Aasim

      January 14, 01 2021 08:12:06

      I actually came here to understand how RAID 5 single write and restore in case of single disk failure works. But the explanation is for RAID 4 where a disk is dedicated for parity. I don’t understand the benifit of distributing parity across the disks in RAID 5. Could you explain it?
      Thanks

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

      November 01, 11 2021 11:04:47

      Wow. Turns out I’m not too dumb to understand how RAID 5 works. I just never had the right teacher until now.

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

    Leave a Reply