Β§38.7–38.10RAID-5: Rotating Parity … Summary

Part III OSTEP pp. 462–464 Β· ~7 min read

  • rotating parity

RAID-4 pays a heavy price for parity: the lone parity disk serializes small writes. RAID-5 fixes that with one small change, and then we can line all four levels up side by side.

38.7 RAID Level 5: Rotating Parity

RAID-5 works almost identically to RAID-4 β€” except it rotates the parity block across the drives instead of pinning it to one disk. Step through the change and why it matters:

RAID-5 = RAID-4 with the parity block rotated across the disks β€” same capacity and reliability, but no single parity bottleneck.
Disk 0Disk 1Disk 2Disk 3Disk 40123P0↓4567P1↓891011P2↓12131415P3↓all parity on Disk 4 β†’ bottleneck

1RAID-4: parity pinned to one disk

In RAID-4 every parity block (P0–P3) lives on Disk 4. Any two small writes must both touch that one disk to update their parity β€” so writes serialize behind it (the small-write problem).

step 1 / 3

RAID-5 analysis. Capacity, reliability, sequential read/write, and single-request latency are all identical to RAID-4. Two things improve:

  • Random reads reach NΒ·R (not (Nβˆ’1)Β·R) β€” with parity spread over every disk, all N disks can serve reads.
  • Random writes jump to (N/4)Β·R. Because parity no longer lives on one disk, independent writes hit disjoint disks and run in parallel; across many requests all disks stay busy. The remaining factor of 4 is simply the 4 physical I/Os every parity write costs (read data, read parity, write data, write parity).

Because RAID-5 matches RAID-4 everywhere and beats it on random I/O, it has almost entirely replaced RAID-4 in practice. The only holdout is systems that only ever do large (full-stripe) writes and thus never hit the small-write problem; there, RAID-4 is occasionally used for being slightly simpler to build.

38.8 RAID Comparison: A Summary

Here are all four levels along the three axes. (We simplify a little β€” e.g. a mirrored write’s seek is the max of two, so real random-write numbers are a touch lower β€” but this captures the essential trade-offs.)

Figure 38.8: the RAID levels at a glance (N disks of B blocks; S = sequential MB/s, R = random MB/s, T = single-disk request time). Tap a cell for the why.
RAID-0 stripingRAID-1 mirroringRAID-4 parityRAID-5 rot. parity
CapacityNΒ·B(NΒ·B)/2(Nβˆ’1)Β·B(Nβˆ’1)Β·B
Reliability (disks lost)0111
Seq. readNΒ·S(N/2)Β·S(Nβˆ’1)Β·S(Nβˆ’1)Β·S
Seq. writeNΒ·S(N/2)Β·S(Nβˆ’1)Β·S(Nβˆ’1)Β·S
Random readNΒ·RNΒ·R(Nβˆ’1)Β·RNΒ·R
Random writeNΒ·R(N/2)Β·R(1/2)Β·R(N/4)Β·R
Latency β€” readTTTT
Latency β€” writeTT2T2T
Dotted-underlined cells have explanations β€” click one.

Tip: Which RAID? It Depends On What You Value

  • Pure performance, reliability be damned β†’ RAID-0.
  • Random I/O and reliability β†’ RAID-1; you pay in capacity.
  • Capacity and reliability β†’ RAID-5; you pay in small-write performance.
  • Mostly sequential I/O, want capacity β†’ RAID-5 again (full-stripe writes dodge the small-write penalty).

38.9 Other Interesting RAID Issues

We simplified to teach the core ideas. Real systems go further: there are other levels (Levels 2 and 3 from the original taxonomy; RAID-6 adds a second parity block to survive two simultaneous disk failures). When a disk does fail, a RAID may keep a hot spare on standby to reconstruct onto immediately β€” and performance during reconstruction is its own concern. Our fail-stop assumption is also optimistic: real disks suffer latent sector errors and silent corruption (the subject of the data-integrity chapter). Finally, a RAID can be built purely in software in the OS β€” cheaper, but it must solve the consistent-update problem itself, without the luxury of battery-backed NVRAM.

38.10 Summary

RAID turns a pile of independent disks into a single storage device that is larger, faster, and more reliable β€” and does so transparently, so the file system and applications above are none the wiser. Which level to use, and how to set its parameters (chunk size, disk count), depends entirely on what the workload values; getting it right β€œremains more of an art than a science.”

Next we climb up from the raw device to the software that gives it structure: files and directories, and the file systems that implement them.

Check yourself: RAID-5 and the comparison

1.What is the single change RAID-5 makes to RAID-4, and what does it fix?

2.RAID-5's small random write throughput is (N/4)Β·R. Where do the N and the 4 come from?

3.Compared with RAID-4, RAID-5's random READ throughput is:

4.You need good capacity AND reliability, with a mostly-mixed workload. Which level, and what's the cost?

5.Which statement about the RAID comparison (Fig 38.8) is correct?

6.What does RAID-6 add beyond the levels analyzed here?

6 questions