Parity and Error Checking

In RAID parlance, error checking is also known as parity checking.  For these examples, we will assume we are dealing with RAID 5 at bit level parity.  The parity bit contains the XOR of all the other bits in the same position on each disk.  i.e. bit 0 on each disk, bit 1 on each disk, etc.  In the case of a disk failure, the missing data can be calculated from the information on the other disks until it is replaced.  On a write operation data is written on the data disk and parity is generated across the blocks in the same stripe or rank.  On a read, the parity is checked to verify information and disk operation.

RAID 5 A Blocks B Blocks C Blocks D Blocks E Blocks
Stripe 0 A0 B0 C0 D0 0 Parity
Stripe 1 A1 B1 C1 1 Parity E1
Stripe 2 A2 B2 2 Parity D2 E2
Stripe 3 A3 3 Parity C3 D3 E3
Stripe 4 4 Parity B4 C4 D4 E4

If we assume a block is 8 bits than Stripe 0.

Bit 0 1 2 3 4 5 6 7
Block A0 1 1 1 1 0 0 0 0
Block B0 0 0 1 0 1 0 1 1
Block C0 1 1 0 0 1 1 1 0
Block D0 1 0 1 1 1 1 1 0
0 Parity 1 0 1 0 1 0 1 1

If the C blocks or disk fails, the parity bit is computed for blocks a,b,and d.   Whatever is required to make this bit equal to the parity bit is either written to the new disk or used as the data for C0.  i.e. the new parity bit is 0, the bit required in C0 for a parity bit of 1 is 1. 

While it is improbable that a block would ever be 8 bits, this makes for a good example.