Disk Structure, Formatting & RAID
The Problem — A Vast Warehouse
First, how is a single disk organised and addressed — platters, sectors, CHS and LBA, formatting? Then, how do we combine many disks with RAID to gain speed, capacity or fault tolerance? This tutorial answers both, block by block.
Inside the Drive — Geometry
A drive stacks 3–8 platters, each with two surfaces and a head. A surface holds concentric tracks split into sectors (512 B or 4 KB — the smallest unit). The same track across every platter forms a cylinder, so the arm reads a whole cylinder without moving. This vocabulary is what every seek-time calculation is built on.
Anatomy of a Sector
A sector isn't just data. A header carries its number, a sync pattern and error-correcting code; a trailer adds more ECC. Those extra bytes let the controller find the sector reliably and detect and repair bit errors — the hidden machinery behind "just reading a block".
Addressing — CHS vs LBA
# The controller maps between them LBA = (c × H + h) × S + (s − 1) # H = heads/cyl, S = sectors/track c = LBA / (H × S) h = (LBA / S) mod H s = (LBA mod S) + 1
CHS ties software to physical layout and hit hard capacity ceilings. LBA gives the OS one clean number line and lets the drive rearrange its own geometry (zone recording, remapping) invisibly. Every modern OS speaks LBA; CHS survives only in legacy boot corners.
Converting CHS (5, 2, 15) ↔ LBA
# And straight back: LBA 454 → CHS (H=4, S=20) c = 454 / (4×20) = 454 / 80 = 5 h = (454 / 20) mod 4 = 22 mod 4 = 2 s = (454 mod 20) + 1 = 14 + 1 = 15 # back to CHS (5, 2, 15)
Forward, CHS (5, 2, 15) packs into a single LBA 454; backward, integer division and modulo unpack 454 into exactly the same cylinder, head and sector. Remember the offset quirk — sectors count from 1, so we subtract 1 going in and add 1 coming out.
Two Kinds of Formatting
Every disk ships with a pool of spare sectors. When one goes bad, the controller silently swaps in a spare (sector remapping) — the OS never notices. SMART exposes the remap count as an early warning that a drive is starting to fail.
RAID 0 — Striping for Speed
Striping splits data across N disks so they read and write in parallel — up to N× throughput and 100% capacity (N × C). The catch: zero fault tolerance. Lose any one disk and the file is shredded across the survivors — total loss. Great for scratch space, dangerous for anything you can't recreate.
RAID 1 — Mirroring for Safety
Mirroring writes each block to both disks. Capacity halves (N/2 × C, 50% efficient), but the array survives a full disk failure — the mirror keeps serving. Reads can come from either copy (up to 2× read speed); writes go to both. Ideal for boot drives and small critical data.
RAID 5 — Distributed Parity
Each stripe stores N−1 data blocks + 1 XOR parity block, and the parity rotates across disks (that's what makes it RAID 5, not RAID 4). If P = A1 ⊕ A2 ⊕ A3 and a disk dies, the missing block is just the XOR of the survivors: A2 = A1 ⊕ A3 ⊕ P. Capacity is (N−1)×C, surviving one failure.
RAID 6 & RAID 10
RAID 6 adds a second, independent parity so it survives two simultaneous failures — essential for big arrays whose rebuilds take hours. RAID 10 mirrors pairs and stripes across them: excellent write throughput and up to N/2 failures (one per pair) — the go-to for databases.
RAID Levels — 8 × 500 GB Array
| RAID | Usable | Failures tolerated | Efficiency | Best for |
|---|---|---|---|---|
| 0 | 4 TB | 0 | 100% | Scratch, video editing |
| 1 | 2 TB | 1–4 (one per pair) | 50% | Boot drives, critical data |
| 5 | 3.5 TB | 1 | 87.5% | General file servers |
| 6 | 3 TB | 2 | 75% | Large arrays, long rebuilds |
| 10 | 2 TB | 1–4 (one per pair) | 50% | Databases, OLTP |
RAID 0 maxes capacity and speed but risks everything; RAID 1 and 10 spend half the disks on safety; RAID 5 and 6 buy fault tolerance cheaply with parity. There's no free lunch — the right level depends on how much you value each corner of the triangle.
Capacity Maths — Two Arrays
Problem 1 · 8 × 500 GB (raw 4 TB) · Problem 2 · 12 × 2 TB (raw 24 TB).
| RAID | Formula | 8 × 500 GB | 12 × 2 TB |
|---|---|---|---|
| 0 | N × C | 4 TB | 24 TB |
| 1 | N/2 × C | 2 TB | 12 TB |
| 5 | (N−1) × C | 3.5 TB | 22 TB |
| 6 | (N−2) × C | 3 TB | 20 TB |
| 10 | N/2 × C | 2 TB | 12 TB |
Parity always costs whole disks, so it gets cheaper as the array grows. On 12 disks, RAID 5 gives 22 of 24 TB (91.7%) and RAID 6 gives 20 TB (83.3%) — far better efficiency than on the 8-disk array, while mirroring stays stuck at 50% no matter the size.
RAID in the Real World
Eight Rules for Disks & RAID
From One Platter to a Resilient Array
From platters, sectors and the CHS↔LBA maths, through low- and high-level formatting, to laying out RAID 0, 1, 5, 6 and 10 and computing their usable capacity — you can address any block and pick the array that fits a workload's need for speed, space or survival.
Storage sits under the whole file system you met earlier — allocation, free space and disk scheduling. From here the course turns to I/O systems and protection & security, where the OS guards the data these disks hold.
🛡️ End of tutorial · Press ← to review, or click Restart