NETGEAR is aware of a growing number of phone and online scams. To learn how to stay safe click here.

Forum Discussion

mattjax05's avatar
mattjax05
Aspirant
Sep 20, 2012

Xraid 5 Parity and Stripping how much capacity?

I've been trying to get my head round this one. Take a 4 drive nas for instance with four 500gb drives. With xraid5 the volume availanle is 1500gb. That's where I'm stumped and I know it's because of my lack of computer knowledge.

In my head the parity block is representing all the other blocks in the stripes. So say you had four blocks per drive and four drives each stripe has 125gb of data the parity block would represent 375gb? But if each stripe had 125gb the volume in each drive would be 750gb (375+125+125+125) But to get a volume of 1500gb each non-parity block would need 125gb.

Where am I going wrong please?

9 Replies

Replies have been turned off for this discussion
  • mdgm-ntgr's avatar
    mdgm-ntgr
    NETGEAR Employee Retired
    X-RAID on Sparc (e.g. Duo/NV+ v1) models with four disks is RAID-4
    X-RAID2 (single-redundancy) on x86 or ARM with four disks of equal capacity would be RAID-5.

    Let's say you have four disks installed. The sectors on the disks would be synced so that:
    A = 1/3 B + 1/3 C + 1/3 D
    B = 1/3 A + 1/3 C + 1/3 D
    C = 1/3 A + 1/3 B + 1/3 D
    D = 1/3 A + 1/3 B + 1/3 C

    WIth RAID-5 the parity is distributed amongst the disks. With RAID-4 there's a dedicated parity disk.
  • Where I'm stumped is that in my head the A,B,C,D (left of your diagram) contains all the information in the stripe. So block 'A' contains all of 1/3 of B, 1/3 of C and 1/3 D. If that's the case the capacity is only 1000gb in my example, so I'm misinterpreting something? Thanks.
  • StephenB's avatar
    StephenB
    Guru - Experienced User
    mdgm likes those equations, but I also find them confusing (and I do know how it works).

    There is a diagram here (http://www.thegeekstuff.com/2010/08/rai ... -tutorial/). The relevant section is Raid-5 (though it shows only three disks).

    The parity block is a logical XOR of the three data blocks. Let's call a group of blocks D1, D2, D3, P. the D's are data, the P is the parity

    P is computed so
    D1 xor D2 xor D3 xor P = 0 (this is for every byte in the block).

    If a block is missing, you can rebuild it from the other 3 by solving the equation above. Any one of the 4 blocks could be missing, the 4 equations are:
    P = D1 xor D2 xor D3
    D1 = P xor D2 xor D3
    D2 = D1 xor P xor D3
    D3 = D1 xor D2 xor P

    You arrange the blocks in a known pattern so that D1, D2, D3, and P are always on different disks (this is shown in the picture I linked to). So if one disk is replaced, you can rebuild all the blocks on it using the above equations. If 2 disks fail, you don't have the information you need to rebuild anything.

    RAID-6 is similar, except there are 2 parity blocks, and they are constructed in different ways. You end up with 2 simultaneous equations, so you can solve them if you have 2 unknowns (any two missing blocks can be reconstructed).

    Of course if you have a Duo, there are only two disks. In that case, the two disks are simply mirrored (that is called RAID-1).
  • Thanks for reply. So what does the parity block contain when all disks are operational? In my head I see the following (based on 4 drives (A.B.C.D), 4x500gb disks and 4 blocks):

    A. B. C. D.
    83 83 83 249
    83 83 249 83
    83 249 83 83
    249 83 83 83

    The 249s are parity blocks (copies of data) and the 83s are data. All the 83s total 1,000gb capacity (bar rounding) but in this array it should be 1,500gb capacity, shouldn't it?
  • StephenB's avatar
    StephenB
    Guru - Experienced User
    There are a lot more blocks, typically the block size is 2 kilobytes.

    Also, your picture shows 12 data blocks and 4 parity blocks, and 16 blocks all together. So 75% of the space is data, and 25% is parity.

    75% x 2000 = 1500 GB
    25% x 2000 = 500 GB of parity overhead.

    The parity block always needs to be current (and written when the disks are all operational). Otherwise you can't recover anything when a disk is replaced.

    So whenever a data block is changed, the parity block is recomputed and saved.

    In other words, whenever you write to this raid array, you are reading the 3 data blocks, updating one of them, recomputing the parity, and writing the changed data block and the changed parity block back to the disk.

    There is a faster way to do it: (a) read the data block you are going to change, read the parity block, (b) xor the parity block with the data block, (c) update the data block, xor the parity block with the new data block, and (d) write both blocks back.
  • mattjax05 - as a non-computer/IT person I have often tried to figure this out myself. After 5 years and multiple NAS units, and replacing failed drives and upgraded array disks one at a time, I finally just accepted that it works.

    StephenB - thanks for the explanation of the formula. I think that most of the non-technical types assumed as I did that the parity block was somehow a copy, what you have pointed out is that it is not, it is a separately created data block that permits a missing data block to be recreated. Thank you for the explanation.
  • StephenB's avatar
    StephenB
    Guru - Experienced User
    PapaBear wrote:
    ...I think that most of the non-technical types assumed as I did that the parity block was somehow a copy, what you have pointed out is that it is not, it is a separately created data block that permits a missing data block to be recreated...
    Exactly!
  • Thanks all for your input. I originally thought the parity block was a copy of the other blocks in the strip. This is still a mystery to me. 75% is for data, if I used that up the 25% would have a one-in-four chance of knowing which drive is going to fail. I know that's not true and I guess xor has something to do with this.
  • StephenB's avatar
    StephenB
    Guru - Experienced User
    Maybe it will help if we use bits (0 or 1) instead of bytes and blocks.

    xor gives you a "1" if the two bits are different, and a "0" if the two bits match.

    So imagine that
    d1 = 0
    d2 = 1
    d3 = 1

    then p = 0.

    Imagine that d3 gets erased/lost

    d3 = d1 xor d2 xor P -> 0 xor 1 xor 0 -> 1

    if d2 is lost, then
    d2 = d1 xor d3 xor P -> 0 xor 1 xor 0 -> 1

    if d1 is lost, then
    d1 = d2 xor d3 xor P -> 1 xor 1 xor 0 -> 0

    What is happening here is a mathematical equation (algebra) is being set up between the blocks. If only one of the 4 blocks is lost, the NAS can solve the equation.

NETGEAR Academy

Boost your skills with the Netgear Academy - Get trained, certified and stay ahead with the latest Netgear technology! 

Join Us!

ProSupport for Business

Comprehensive support plans for maximum network uptime and business peace of mind.

 

Learn More