RAID 5
Raid 5 - Striping with rotating parity block
Probably the most common RAID system used on servers. Combines some of the advantages of RAID 0 and RAID 1. Data is striped in blocks (A1,A2 and A3 in the diagram below) and an additional parity block is written (Ap). For each new stripe the parity block 'rotates' to the next drive in the sequence.
Advantages of RAID 5
- Fast data reads and writes
- Good redundancy - if one drive fails, the system continues to run.
- System rebuilds automatically if hot spares included in system.
Even though there is redundancy in RAID 5, regular backups are critical.
Disadvantages of RAID 5
- More expensive than RAID 0
- Writes to disk take slightly longer than RAID 0
- Slightly Reduced storage space as 1 drive in each array is used for redundancy
Most RAID 5 systems allow for 'Hot Spares' - this allows 1 or more spare drives to be placed on the RAID controller, so that in the case of drive failure. The Hot spare will replace the failed drive and will rebuild itself with the data from the remaining good drives.
The parity calculations for RAID 5
Parity is calculated by XOR'ing each value with the next. The final value is stored for each byte in the parity block. For example:
If the three values are (in decimal), 25, 50, 99 then we calculate 25 XOR 50 XOR 99 = 72 so for this byte 72 would be stored in the parity block. If a drive fails, then the missing value can be calculated by the remaining values. Lets say that the first drive fails. We XOR the following values to get the missing one.
50 XOR 99 XOR 72 = 25 we can now write this value to a 'hot spare' and completely rebuild the array.