4.2.39 · D4Operating Systems

Exercises — RAID — levels 0, 1, 5, 6, 10 — trade-offs

3,313 words15 min readBack to topic

Before we start, one reminder of the notation we will reuse, so no symbol is unexplained:


Level 1 — Recognition

Recall Solution L1·Q1

(a) RAID 0 — pure striping. It still stores one copy of every block, but keeps zero redundancy (nothing extra to rebuild from). (b) RAID 1 — mirroring. (c) RAID 5 — striping + one distributed parity. (d) RAID 6 — striping + double distributed parity ( and ). (e) RAID 10 — mirror then stripe.

Recall Solution L1·Q2

(a) False. No redundancy means any single failure loses the whole array. (b) True. Two independent parities → two solvable unknowns. (c) True. Half the disks are copies, so usable .


Level 2 — Application

Recall Solution L2·Q1

Raw = TB. Here is why each capacity rule holds, then the number:

  • RAID 0: every disk holds unique data, nothing wasted → TB.
  • RAID 1: each disk has an identical twin, so half the disks are pure copies → TB.
  • RAID 5: one disk's worth of space is spent on parity (rotated, not a single disk) → TB.
  • RAID 6: two disks' worth of space are spent on the two parities and TB.
  • RAID 10: mirroring already halves usable capacity; striping across the pairs adds speed, not space → TB.
Recall Solution L2·Q2

Do it left to right (XOR is associative, so grouping is free): (bit by bit: 1≠0→1, 1≠0→1, 0≠1→1, 1≠1→0). So .

Recall Solution L2·Q3

Recovery rule: . — exactly the original. ✓

Recall Solution L2·Q4

4 I/Os: read old data , read old parity , write new data , write new parity . Parity is recomputed with (no need to touch other disks).


Level 3 — Analysis

Recall Solution L3·Q1

To compute correct new parity you must remove the old data's contribution and insert the new one: This formula needs and , and both currently sit on disk — you must read them first. So: read , read (2 reads) → then write , write (2 writes) = 4 I/Os. The 2 reads are the hidden cost the naïve count forgets.

Recall Solution L3·Q2

RAID 6 keeps two parities and , both of which include the block you changed. Each needs its own read-modify-write:

  • Read , , → 3 reads.
  • Write , , → 3 writes.

Total = 6 I/Os. That is why RAID 6 is slower on small writes than RAID 5.

Recall Solution L3·Q3

A large sequential read is fast when many disk heads pull data at once. So the question is: for each level, how many spindles feed useful data in parallel?

  • RAID 0 spindles: every disk holds unique data, all read simultaneously. Nothing wasted → fastest.
  • RAID 10 ≈ up to spindles: each mirror pair can serve reads from either twin, so both disks in every pair can stream different parts at once → essentially matches RAID 0.
  • RAID 5 spindles read, but only carry data in any stripe (one block per stripe is parity). For a pure sequential read the controller still spins all disks, yet the useful-data bandwidth is capped a touch below RAID 0/10 because one disk's worth per stripe is parity, not payload. That is the reason it sits just behind.
  • RAID 1 (plain mirror, not striped): a single mirror pair only has 2 disks feeding one logical stream, so it does not scale up with large the way striped levels do → slowest per usable-data.

Ordering, with the symbol meaning "about equal to, or slightly faster than": Reads are broadly similar across striped levels; the write side (parity penalty) is the real differentiator.

Recall Solution L3·Q4

RAID 5 has one parity equation, which solves for exactly one unknown disk. While rebuilding the first dead disk, all remaining 11 disks are read hard for hours — stress that raises the chance of a second failure. If a second disk dies before the rebuild finishes, you now have two unknowns but only one equation → unsolvable → total loss. RAID 6 keeps a second, independent parity , giving two equations, so it can still solve for two dead disks and survive that scenario. See Reliability and MTBF for the failure-rate reasoning.


Level 4 — Synthesis

Recall Solution L4·Q1

Choose RAID 10. Reasoning:

  • Write-heavy + small writes → avoid parity's read-modify-write penalty (RAID 5/6 out).
  • Must survive a disk failure with availability → RAID 0 out.
  • RAID 10 = mirror then stripe → fast writes (no parity recompute) and redundancy.

Capacity of RAID 10 is disks. Need TB usable at TB/disk = usable data disks → mirror pairs → disks (giving TB usable). Round pairs up if odd; here it's exact.

Recall Solution L4·Q2

Choose RAID 6. Reasoning:

  • Large writes, rare → the parity penalty is amortised over big stripes, and small-write cost is irrelevant.
  • Cost matters → RAID 6 wastes only 2 disks (vs RAID 10 wasting half).
  • Must survive during long rebuilds of big disks → need double parity (RAID 5 is unsafe here, see L3·Q4).

RAID 6 usable = disks. Need TB at TB/disk = usable data disks → disks. Usable TB. ✓

Recall Solution L4·Q3

RAID 10 is more robust.

  • RAID 10 (mirror-then-stripe): each pair is a mirror. A pair survives as long as one of its two disks lives. Two failures are fatal only if both dead disks are in the same pair. With 4 pairs, the second failure lands in the same pair only ~1 in 7 times → usually survives.
  • RAID 0+1 (stripe-then-mirror): one disk loss kills its whole stripe, so you are left leaning on the other stripe entirely. A second failure in that surviving stripe kills the array. The window of vulnerability is much wider.

Order matters: mirror-then-stripe localises damage to a single pair.


Level 5 — Mastery

Recall Solution L5·Q1

Start from the right-hand side and substitute : Group each surviving () with its copy inside . By commutativity/associativity we can pair them, and by self-inverse each pair vanishes: Only the term with no partner — — survives. This is exactly why single parity fixes exactly one erasure: one equation, one unknown.

Recall Solution L5·Q2

With two dead data disks , the survivors give: is identical to , so it yields the same equation . Two copies of one equation is still one equation with two unknowns → infinitely many satisfy it → unrecoverable. RAID 6 instead computes over GF(2^8), where multiplying by a distinct field element weights each disk differently. Now the equation is linearly independent from the equation, giving a solvable system → both unknowns recovered.

Recall Solution L5·Q3

(a) RAID 5 with : parity of a single data block is just a copy of it (). So it degenerates into RAID 1 (mirroring). Usable disk, same as for . (b) RAID 6, : usable disk. Two of three disks are parity — extremely wasteful, and the minimum size where RAID 6 even makes sense. (c) . Parity of all-zero data is zero (identity ). (d) RAID 1 with has no twin to mirror onto — it is just a single plain disk, no redundancy. Not a meaningful mirror.

Recall Solution L5·Q4

Step: . Then . Recover: . ; . ✓ Matches the original — the round-trip closes.

The failure-survival counting from L4·Q3 is easier to see visually:

Figure — RAID — levels 0, 1, 5, 6, 10 — trade-offs

Recall

What makes a small RAID 5 write cost 4 I/Os?
You must read and before writing and — two hidden reads plus two writes.
Why can single XOR parity recover only one dead disk?
One parity = one equation = one solvable unknown.
Why does RAID 6 use over rather than a second XOR?
A second XOR gives the same equation; weights disks by to be linearly independent, so two unknowns are solvable.
For a write-heavy DB needing redundancy, which level?
RAID 10 — fast writes (no parity recompute) plus redundancy.
For a cheap large archive that must survive long rebuilds, which level?
RAID 6 — only 2 disks wasted, survives a second failure during rebuild.
Difference between RAID 10 and RAID 0+1?
RAID 10 = mirror then stripe (localises damage to one pair); RAID 0+1 = stripe then mirror (one disk kills a whole stripe).