About

9.2 RAID Levels & Usable Capacity

Theory: RAID Levels & Usable Capacity

Disks are the part of a server most likely to fail. RAID lets a server lose a disk and keep running. This lesson covers the three building blocks (striping, mirroring, parity), the common RAID levels, how to calculate usable capacity, why rebuilds are dangerous, how to choose a level, and the most important limit of all: RAID is not backup.

What Is RAID?

RAID (Redundant Array of Independent Disks) combines many physical disks into one logical disk. Its main goal is to keep the system running when a disk fails.

RAID is built from three techniques:

TechniqueHow it worksGoal
StripingSplit data into blocks and spread them across disks (A1 on disk 1, A2 on disk 2, …)Speed: disks work in parallel
MirroringWrite the same data to two disks (A1 on disk 1, A1 on disk 2)A full copy
ParityStore a calculated value P from which lost data can be rebuilt (A1, A2, P)Protection with less waste than mirroring

RAID 0: Striping

File A is split into blocks A1–A8; odd blocks go to disk 1 and even blocks to disk 2, so both disks work at the same time.

Disk 1Disk 2
A1A2
A3A4
A5A6
A7A8

Common mistake: RAID 0 is not really “redundant”. It is about speed only, and it is less reliable than a single disk, because any one of several disks failing destroys everything.

RAID 1: Mirroring

Every block is written to both disks.

Disk 1Disk 2 (copy)
A1A1
A2A2
A3A3

RAID 1 buys safety by paying for twice the disks. (A mirror can have more than two copies, an N-way mirror; usable space is still one disk.)

How Parity Works (XOR)

Parity uses the XOR (exclusive OR, ⊕\oplus) operation, applied bit by bit:

aabba⊕ba \oplus b
000
110
011
101

Rule of thumb: same → 0, different → 1. The key property is that XOR undoes itself: if P=D1⊕D2P = D_1 \oplus D_2, then D2=D1⊕PD_2 = D_1 \oplus P and D1=D2⊕PD_1 = D_2 \oplus P.

Mini-example: write, lose, rebuild

1. Write data and parity. D1=1010D_1 = 1010, D2=0110D_2 = 0110:

P=D1⊕D2=1010⊕0110=1100P = D_1 \oplus D_2 = 1010 \oplus 0110 = 1100

2. Disk 2 fails. Its contents are unknown (????). Rebuild from the survivors:

D2=D1⊕P=1010⊕1100=0110D_2 = D_1 \oplus P = 1010 \oplus 1100 = 0110

This matches the original D2D_2 ✓. Lost data is calculated back from the survivors. With more data disks the same rule applies: parity is the XOR of all data blocks in the stripe, and any one missing block equals the XOR of all the others.

What if two disks fail at the same time? With single parity you now have one equation and two unknowns, so the data cannot be rebuilt. That is why RAID 6 adds a second parity block.

RAID 5 and RAID 6

RAID 5: single parityRAID 6: double parity
Parity blocks per stripe1 (P)2 (P and Q)
Minimum disks34
Failures survived12
Usable disksN−1N - 1N−2N - 2

Example layouts (each row is one stripe):

RAID 5Disk 1Disk 2Disk 3
Stripe AA1A2Pa
Stripe BB1PbB2
Stripe CPcC1C2
RAID 6Disk 1Disk 2Disk 3Disk 4
Stripe AA1A2PaQa
Stripe BPbQbB1B2
Stripe CQcC1C2Pc

Parity is spread across all disks, so no single disk becomes a bottleneck (every write must update parity, and rotating it shares that work).

RAID 10: Mirror, then Stripe

Disks are first paired into mirrors, then data is striped across the pairs.

Mirror pair 1: Disk 1Disk 2Mirror pair 2: Disk 3Disk 4
A1A1A2A2
A3A3A4A4

Calculating Usable Capacity

Let NN = number of disks and SS = size of one disk.

Usable capacity formulas

RAID 0=N×SRAID 1=S(N-way mirror)RAID 5=(N−1)×SRAID 6=(N−2)×SRAID 10=N×S2\begin{aligned} \text{RAID 0} &= N \times S \\ \text{RAID 1} &= S \quad (\text{N-way mirror}) \\ \text{RAID 5} &= (N-1) \times S \\ \text{RAID 6} &= (N-2) \times S \\ \text{RAID 10} &= \frac{N \times S}{2} \end{aligned}

Example: 6 × 4 TB (24 TB raw)

LevelFormulaUsableFailures survived
RAID 06×46 \times 424 TB0
RAID 5(6−1)×4(6-1) \times 420 TB1
RAID 6(6−2)×4(6-2) \times 416 TB2
RAID 10(6×4)/2(6 \times 4) / 212 TB1 guaranteed (up to 3, if each is in a different pair)
RAID 144 (6-way mirror)4 TB5

More usable space usually means less protection.

Rebuild Risk and Hot Spares

When a disk fails, the array goes through four states:

Diagram loads as you scroll.

The real danger is a second disk failing during the rebuild. The rebuild reads every block of every surviving disk, which puts heavy load on the rest of the disks, which are often the same age and from the same batch. A RAID 5 array that loses a second disk during rebuild loses everything.

A hot spare is an idle disk already installed in the server. When a disk fails, the rebuild starts automatically, with no waiting for someone to notice, buy and insert a replacement. This shortens the time spent degraded.

Large disks = long rebuilds. For big disks prefer RAID 6 (still protected during the rebuild) or RAID 10 (fast copy rebuild), and keep a hot spare.

Choosing RAID at MediCare Plus

SystemNeedChoiceWhy
EMR databaseFast and always onRAID 10Best speed; fast rebuild by copying
Imaging & file serverLarge capacity, safeRAID 6Survives 2 disk failures; good capacity
Temporary workspaceSpeed onlyRAID 0Data can be recreated; failure is OK

The management question is always: what does an outage cost, compared with what the protection costs?

RAID Is Not Backup

EventRAID helps?Backup helps?Why
One disk fails✓✓ (slower)RAID keeps running; a backup needs a restore
File deleted by mistake✗✓The deletion hits all disks at once
Ransomware encrypts data✗✓Encrypted data is written to all disks
Fire or flood in the server room✗✓ only if offsiteAll disks are in one room; needs an offsite copy
Data corrupted✗✓RAID copies bad data faithfully

RAID protects against hardware failure. Backup protects against data loss. RAID copies every write, good or bad, to every disk, instantly.

Immutable / WORM Storage

Backups only help if the attacker cannot destroy them. Immutable or WORM (Write Once, Read Many) storage guarantees that:

Where it is usedWhy it beats ransomwareTrade-offs
Object lock on cloud storage, immutable cloud backup vaults, WORM tapeA stolen admin password still cannot delete or encrypt itOnly the admin-proof mode really protects; longer retention = higher cost

Link to Week 8: the same idea protects logs and evidence from being changed, which is an integrity control.


Worked Examples

Exercise 1

A RAID 5 array has three data disks and one parity block per stripe. In one stripe, D1=1011D_1 = 1011, D2=0110D_2 = 0110, D3=1100D_3 = 1100.

  • (a) Calculate the parity PP.
  • (b) Disk 2 fails. Rebuild D2D_2 from the survivors.
Show solution ↓
Solution

(a) Parity is the XOR of all data blocks. Work two at a time, bit by bit (same → 0, different → 1):

D1⊕D2=1011⊕0110=1101D_1 \oplus D_2 = 1011 \oplus 0110 = 1101P=1101⊕D3=1101⊕1100=0001P = 1101 \oplus D_3 = 1101 \oplus 1100 = 0001

(b) The missing block is the XOR of everything that survived:

D1⊕D3=1011⊕1100=0111D_1 \oplus D_3 = 1011 \oplus 1100 = 0111D2=0111⊕P=0111⊕0001=0110D_2 = 0111 \oplus P = 0111 \oplus 0001 = 0110

Answer: (a) P=0001P = 0001; (b) D2=0110D_2 = 0110, which matches the original value ✓.

Exercise 2

MediCare Plus buys 8 disks of 2 TB for the imaging server. Calculate the usable capacity with RAID 5, RAID 6 and RAID 10. Which level should be used, and why?

Show solution ↓
Solution

N=8N = 8, S=2S = 2 TB, raw capacity =8×2=16= 8 \times 2 = 16 TB.

LevelWorkingUsableFailures survived
RAID 5(8−1)×2(8 - 1) \times 214 TB1
RAID 6(8−2)×2(8 - 2) \times 212 TB2
RAID 10(8×2)/2(8 \times 2) / 28 TB1 guaranteed (up to 4 in different pairs)

Choice: RAID 6. Imaging needs large capacity and safety, not maximum write speed.

  • RAID 5 gives 2 TB more, but survives only one failure; a second failure during a long rebuild loses every image.
  • RAID 10 is fast but wastes half the disks (only 8 TB), and imaging is not a busy transactional database.
  • RAID 6 keeps 12 TB (75% of raw) and survives 2 disk failures, so the array is still protected while it rebuilds.

Answer: RAID 5 = 14 TB, RAID 6 = 12 TB, RAID 10 = 8 TB; choose RAID 6.

Exercise 3

A RAID 10 array has 8 disks in four mirror pairs: (1, 2), (3, 4), (5, 6), (7, 8). For each set of failed disks, say whether data survives.

  • (a) Disks 1 and 3
  • (b) Disks 1 and 2
  • (c) Disks 2, 4, 6 and 8
  • (d) Disks 5, 6 and 7

Then: if disk 1 has already failed, what is the chance that a random second failure destroys the array?

Show solution ↓
Solution

The rule: RAID 10 loses data only if both disks of the same pair fail.

SetPairs hitResult
(a) 1, 3pair 1 once, pair 2 onceSurvives
(b) 1, 2pair 1 twiceData lost
(c) 2, 4, 6, 8each pair onceSurvives (4 failures!)
(d) 5, 6, 7pair 3 twiceData lost

Second failure: 7 disks remain, and only one of them (disk 2, the partner of disk 1) is fatal.

P(fatal)=17≈14%P(\text{fatal}) = \frac{1}{7} \approx 14\%

Answer: (a) survives, (b) lost, (c) survives, (d) lost; chance of a fatal second failure = 1/7. This is why RAID 10 “guarantees” only 1 failure even though it can sometimes survive many.

Exercise 4

A RAID 5 array uses 16 TB disks. During a rebuild, the controller can write the replacement disk at about 100 MB/s (1 TB = 101210^{12} bytes, 1 MB = 10610^{6} bytes).

  • (a) Roughly how long does the rebuild take?
  • (b) Why is this a risk, and what two changes reduce it?
Show solution ↓
Solution

(a) The whole 16 TB disk must be rebuilt.

t=16×1012 B100×106 B/s=16×1012108=160 000 st = \frac{16 \times 10^{12}\ \text{B}}{100 \times 10^{6}\ \text{B/s}} = \frac{16 \times 10^{12}}{10^{8}} = 160\,000\ \text{s}160 000 s÷3600≈44.4 h≈1.9 days160\,000\ \text{s} \div 3600 \approx 44.4\ \text{h} \approx 1.9\ \text{days}

(b) For almost two days the array is degraded: RAID 5 has already used its one allowed failure, so a second failure loses all the data. The rebuild also puts heavy load on the remaining disks, which makes a second failure more likely. (In practice the rebuild is often slower than this, because users keep working on the array.)

Two changes:

  1. Use RAID 6, so the array still survives one more failure during the rebuild.
  2. Add a hot spare, so the rebuild starts automatically instead of waiting for someone to replace the disk.

Answer: about 44 h (≈ 1.9 days); switch to RAID 6 and add a hot spare.

Exercise 5

(In-class review) The pharmacy server uses RAID 6. It is also backed up every night to immutable storage. For each event, say whether RAID helps and whether the backup helps, with a one-line reason.

  • (a) One disk fails at 10:00.
  • (b) A pharmacist deletes the drug price list by mistake.
  • (c) Ransomware encrypts the whole server.
Show solution ↓
Solution

Ask for each event: is it a hardware problem (RAID’s job) or a data problem (backup’s job)?

EventRAID helps?Backup helps?Reason
(a) One disk fails✓✓ (not needed)RAID 6 survives up to 2 failures, so the server keeps running with no data loss; a restore would only cost downtime and the changes since last night
(b) Price list deleted✗✓The deletion is written to all disks at once; restore the file from last night’s backup (today’s edits to it are lost)
(c) Ransomware✗✓Encrypted data is written to all disks; the immutable backup cannot be changed or deleted, even with a stolen admin password

Answer: (a) RAID ✓ (backup not needed); (b) RAID ✗, backup ✓; (c) RAID ✗, backup ✓.

Exercise 6

Choose a RAID level for each system and justify it in one line.

  • (a) A video-editing scratch area whose files are copied from originals each morning.
  • (b) The operating-system disks of a small domain controller (2 disks).
  • (c) A busy pharmacy order database that must be fast and rebuild quickly.
  • (d) A 12-disk archive of scanned paper records where capacity matters most but losing the array is unacceptable.
Show solution ↓
Solution
SystemChoiceJustification
(a) Scratch areaRAID 0Data can be recreated; speed and 100% capacity matter, failure is acceptable
(b) OS disks, 2 disksRAID 1Simple mirror for a small critical server; survives one failure with a simple rebuild
(c) Busy databaseRAID 10Fastest for heavy reads and writes; rebuild is a simple copy from the partner
(d) 12-disk archiveRAID 6(12−2)/12≈83%(12 - 2)/12 \approx 83\% usable and survives 2 failures during long rebuilds

And for every one of them: RAID is not backup, so the important data in (b), (c) and (d) still needs real backups.