1-min guide

RAID and parity

Servers combine several disks and use them as if they were one. This is RAID. Depending on how they’re combined, data can survive a disk failure.

Reading time: about 1 min

More in the 5-min version →

In the game, this was a team splitting up quiz answersPlay “Split It, Remember It”

In the gameIn real IT
Team membersDisks
Answers (Y/N)Data (1 and 0)
Even-up noteParity
Absent kidFailed disk
Recovering the absent kid’s partRebuild
A second kid is absentDouble failure
Disk0Disk1Disk2Disk3 1011 0110 1100 P 0001 Data Data Parity Data Data Parity Data Data On row 1, each bit position has an even number of 1s. The lost “1100” can be worked out from the other 3 disks
RAID 5 shifts the parity to a different disk on each row (distributed parity). Any one disk can fail and be restored

Parity is a “check bit”

RAID 5 splits data across several disks and adds one more piece: “parity.” Parity bits are set so that the number of 1s in each bit position is always even (as a calculation, it’s XOR — exclusive OR). If one disk’s worth disappears, you can recover the original data by working out “0 or 1, to make it even?” In servers, the RAID controller (PERC on Dell PowerEdge) does this calculation automatically.

Types of RAID

TypeHow it worksSurvivesCapacity*
RAID0Splits data across disksnone4TB
RAID1Writes the same data to 2 disks1 of the 2half
RAID51 parity1 disk3TB
RAID62 parities2 disks2TB
RAID10Mirror + split1 per pair2TB

*With four 1 TB disks. Splitting data across disks is called “striping,” and writing the same data to two disks is called “mirroring.”

The rebuild is the most dangerous time

When you replace a failed disk, its contents are calculated from the remaining disks and written back (a rebuild). With large disks this takes hours, and if another disk fails meanwhile, RAID 5 loses the data. That’s why systems keep a spare disk ready (a hot spare) to start rebuilding immediately, or choose RAID 6, which survives two failures.

RAID is not a backup

RAID only protects against “disk failure.” A file deleted by mistake or encrypted by ransomware is gone on every disk alike. Take backups separately.

How the FE exam asks it

Common questions: “If you build RAID 5 with four 1 TB disks, how many TB can you use?” (answer: 3 TB), and “how many disks can fail at the same time without losing data?”

Summary
  • Parity is a check bit that “makes the number of 1s even” (XOR)
  • RAID 5 survives one disk failure; capacity is (number of disks − 1) disks’ worth
  • RAID is not a backup. Deleted files don’t come back
Go further: 5-min deep diveRAID in depth: RAID 6, RAID 10, write penalty and availabilityWhy RAID 6 is chosen for large disks, why RAID 5 writes are slow, and the availability calculations that show up on exams.Read the 5-min version →