Β§38.1–38.4Interface And RAID Internals … RAID-0: Striping

Part III OSTEP pp. 449–454 Β· ~10 min read

  • RAID
  • RAID level
  • fail-stop fault model
  • striping
  • stripe
  • chunk size
  • mapping problem

When we use a disk we sometimes wish it were faster (I/O is often the system bottleneck), sometimes bigger (data keeps growing), and sometimes more reliable (a dead disk with no backup means data gone for good). What if one technique could give us all three?

The Crux: How To Make A Large, Fast, Reliable Disk

How can we build a storage system that is large, fast, and reliable out of ordinary disks? What are the key techniques, and what are the trade-offs between different approaches?

That technique is the Redundant Array of Inexpensive Disks (RAID) β€” coined in the late 1980s by Patterson, Gibson, and Katz at Berkeley. A RAID uses several disks in concert to build one disk that is faster (parallelism), bigger (capacity), and more reliable (redundancy lets it survive a disk failure and keep running as if nothing were wrong).

38.1 Interface And RAID Internals

The magic is that a RAID does all this transparently. From the file system’s point of view a RAID looks exactly like a single disk: a linear array of blocks you read and write. Internally it is a complex beast β€” but the software above never has to know.

Externally one big disk; internally a specialized computer managing several disks.

file systemone logical I/ORAID β€” looks like one big diskmicrocontrollerruns RAID firmwareDRAM + NVRAMbuffer / safe writesparity logic(some levels)↓ maps each logical I/O to one or more physical I/Os β†“πŸ’½πŸ’½πŸ’½πŸ’½

A RAID is essentially a specialized computer: a microcontroller running firmware, DRAM to buffer blocks, sometimes non-volatile RAM to hold writes safely, and sometimes dedicated logic to compute parity. When a file system issues one logical I/O, the RAID figures out which disk(s) to touch and issues one or more physical I/Os. A mirrored RAID, for instance, turns every logical write into two physical writes.

Tip: Transparency Enables Deployment

New functionality spreads fastest when it can be added transparently, demanding no changes elsewhere. You could swap a SCSI disk for a SCSI-based RAID array and the host, OS, and applications did not have to change one bit. By solving the deployment problem, RAID was successful from day one.

38.2 Fault Model

To compare RAID designs we need a fault model β€” which failures a RAID is meant to survive. We start with the simplest: the fail-stop model. A disk is in exactly one of two states β€” working (every block readable and writable) or failed (permanently, wholly lost) β€” and critically, a failure is detected immediately (the controller knows at once when a disk dies).

workingall blocks R/Wfailedpermanently lostfaultdetected at once

This deliberately ignores harder, β€œsilent” faults β€” disk corruption, or a single unreadable block on an otherwise-working disk (a latent sector error). Those are more realistic but much harder; we defer them to the data-integrity chapter and assume fail-stop for now.

38.3 How To Evaluate A RAID

We judge every RAID design along three axes:

  • Capacity β€” given N disks of B blocks each, how many useful blocks do clients get? No redundancy gives NΒ·B; mirroring (two copies) gives (NΒ·B)/2; parity schemes land in between.
  • Reliability β€” how many disk failures can the design tolerate (under the fail-stop model)?
  • Performance β€” workload-dependent, so we first need workloads to reason about.

We consider two workloads . A sequential workload reads/writes large contiguous regions (e.g. 1 MB starting at block x); the disk spends almost all its time transferring, at S MB/s. A random workload issues many small requests to scattered locations; the disk spends almost all its time seeking and rotating, at R MB/s. Because positioning dominates small requests, S ≫ R.

How different are S and R? Take a disk with a 7 ms average seek, 3 ms average rotation, and a 50 MB/s transfer rate. For a 10 MB sequential transfer we spend 7 + 3 ms positioning and 200 ms transferring:

S=10Β MB7Β ms+3Β ms+200Β ms=10Β MB210Β msβ‰ˆ47.6Β MB/sS = \frac{10\ \text{MB}}{7\ \text{ms} + 3\ \text{ms} + 200\ \text{ms}} = \frac{10\ \text{MB}}{210\ \text{ms}} \approx 47.6\ \text{MB/s}

Nearly the full 50 MB/s β€” the positioning cost is amortized away. For a 10 KB random transfer, positioning is unchanged but the transfer takes only ~0.195 ms:

R=10Β KB7Β ms+3Β ms+0.195Β ms=10Β KB10.195Β msβ‰ˆ0.98Β MB/sR = \frac{10\ \text{KB}}{7\ \text{ms} + 3\ \text{ms} + 0.195\ \text{ms}} = \frac{10\ \text{KB}}{10.195\ \text{ms}} \approx 0.98\ \text{MB/s}

So S/R β‰ˆ 48 β€” sequential is roughly fifty times faster. Hold onto S and R; every RAID level below is scored in these units.

38.4 RAID Level 0: Striping

The first RAID level is not really a RAID at all β€” it has no redundancy β€” but striping (RAID-0) is the performance and capacity upper bound, so it is worth understanding first. The idea: spread the array’s blocks across the disks in round-robin order. The blocks in one row form a stripe ; the chunk size sets how many blocks land on a disk before moving to the next.

RAID-0 spreads the array's blocks round-robin across the disks β€” no redundancy, all disks working in parallel. Each column is a disk; each row is a stripe.
Disk 0Disk 1Disk 2Disk 30123456789101112131415chunk size = 1 block (4 KB per disk before moving on)

1Simple striping (chunk = 1 block)

Spread consecutive logical blocks across the disks in round-robin order (Fig 38.1): block 0 β†’ Disk 0, block 1 β†’ Disk 1, … block 4 wraps back to Disk 0. A large sequential read of blocks 0–7 hits all four disks at once β€” maximum parallelism.

step 1 / 4

The mapping problem

Every RAID must solve the mapping problem : translate a logical block into a physical (disk, offset). For simple striping it is just two integer operations:

Disk=Aβ€Šmodβ€ŠNOffset=⌊A/NβŒ‹\text{Disk} = A \bmod N \qquad \text{Offset} = \lfloor A / N \rfloor

(integer arithmetic β€” 14 / 4 = 3, not 3.5). The last step of the walkthrough above traces block 14 β†’ Disk 2, offset 3.

Evaluating RAID-0

Striping is the easy case on all three axes, and gives the numbers every other level is compared against:

  • Capacity: perfect. All NΒ·B blocks are useful β€” nothing is spent on redundancy.
  • Reliability: zero β€” perfect in the bad way. There is no redundancy, so the loss of any single disk loses data.
  • Performance: excellent. A single-block request has the latency of one disk (RAID-0 just forwards it). Steady-state throughput uses every disk in parallel: N Β· S for sequential, N Β· R for random.

These NΒ·S / NΒ·R figures are both the simplest to compute and the ceiling for the redundant levels ahead β€” mirroring (ch38.5) and parity (RAID-4/5) buy reliability by giving some of this performance and capacity back.

Check yourself: RAID interface, fault model, and striping

1.What does it mean that a RAID is "transparent" to the system above it?

2.Under the fail-stop fault model, what does the RAID assume about disks?

3.The three axes for evaluating a RAID are capacity, reliability, and performance. Why does performance need workloads defined first?

4.In a 4-disk RAID-0 with a one-block chunk size, where does logical block 14 live?

5.How does chunk size affect a striped array?

6.What are RAID-0's capacity, reliability, and throughput?

6 questions