Curriculum / Part 2 · Flash and NVMe deep dive
Lesson 10

RAID and erasure coding

RAID 0/1/5/6/10, erasure coding with k+m, capacity efficiency, and why rebuild time grows with drive size.

⏱ 40 min5-question quizLab 2.3

The simple version

You and four friends each keep a page of a story. If one friend loses their page, the story is broken. So you add a sixth friend who keeps a clever "checksum" page: with it, any one missing page can be rebuilt from the rest. Add two checksum friends and you survive two losses. That's parity, and erasure coding is the general version.

RAID levels

LevelLayoutSurvivesUsable capacity (n drives)
RAID 0Striping0 failuresn
RAID 1Mirroringn−1 (of a mirror set)1 drive's worth
RAID 5Striping + single parity1n−1
RAID 6Striping + double parity2n−2
RAID 10Stripe across mirrors1 per mirror pairn/2
$ cat /proc/mdstat
$ sudo mdadm --detail /dev/md0

Erasure coding (k+m)

Data is split into k data fragments plus m parity fragments, spread across k+m drives or nodes. Any m can be lost.

Efficiency = k ÷ (k + m)

8+2 → 80% usable, survives 2.   4+2 → 67%, survives 2.   16+4 → 80%, survives 4.

Wider stripes give better efficiency, but every rebuild must read from more surviving fragments and small writes cost more. Distributed storage systems apply EC across nodes so a whole server can fail.

Rebuild time

Rebuild time ≈ capacity to rebuild ÷ effective rebuild rate

30.72 TB at 200 MB/s → 30.72 × 10¹² ÷ 200 × 10⁶ = 153,600 s ≈ 42.7 hours.
Same drive at 1 GB/s → 30,720 s ≈ 8.5 hours.

During rebuild, the array runs with reduced protection and lower performance. As drives get bigger, that window grows, which is why large flash pools favour double parity or wider EC, and distributed rebuild that spreads the work over many drives at once. (Rebuild rate here is an example input: real rates depend on the system and how much foreground load it protects.)

Tools

mdadm --detail
Linux software RAID state, layout and rebuild progress.
cat /proc/mdstat
Quick view of md arrays and resync speed.
/proc/sys/dev/raid/speed_limit_min, _max
Linux md rebuild speed limits in KiB/s.

Quiz

Lab

Lab 2.3 · Rebuild math

A storage pool uses 30.72 TB drives. Your SLA says the pool must be back to full protection within 4 hours of a drive failure. Work out whether the current design meets it. No terminal needed: use the rebuild formula from Lesson 10.

Start lab 2.3 →