How does parity work on a RAID-5 array?

Solution 1:

It just XORs each corresponding bit from each drive - If you lose any drive, you can re-build the missing data.

For background:

A B (A XOR B)
0 0    0
1 1    0
0 1    1
1 0    1

Assume that D is the XOR of the other columns, then as long as you only lose one drive, you can figure out what you lost.

A B C D
1 0 0 1
0 1 0 1
1 1 0 0

Some times the stripe bit will be distributed across the drives, but the concept is the same.

So for RAID-5, no matter how many drives, you only need 1 drive for parity equal or bigger than the smallest drive in the array you want to RAID.

RAID-5 for personal use is probably best as computational complexity is much lower than RAID-6.

RAID-6 is more complicated using Galois Fields to compute parity. And that can tax parity computations. However, you can lose more drives, but if you rebuild your array as soon as you get a single failure, you should be fine sticking with RAID-5.

Solution 2:

Here's what I think is a better diagram to show how parity works in RAID4 and RAID5

RAID4

Disk1  Disk2  Disk3  Disk4
----------------------------
data1  data1  data1  parity1
data2  data2  data2  parity2
data3  data3  data3  parity3
data4  data4  data4  parity4

RAID5

Disk1   Disk2   Disk3   Disk4
----------------------------
parity1 data1   data1   data1   
data2   parity2 data2   data2  
data3   data3   parity3 data3
data4   data4   data4   parity4