Operating System Slides 📂 Introduction · 22 of 22 45 min read

Disk Structure, Formatting & RAID (0, 1, 5, 6, 10)

Understand how a disk is built and combined. Covers platters, sectors and cylinders, CHS vs LBA addressing (with a worked CHS(5,2,15)↔LBA 454 conversion), low- and high-level formatting, bad-block sparing, and RAID 0/1/5/6/10 laid out block-by-block — striping, mirroring and distributed parity — plus usable-capacity maths for 8×500 GB and 12×2 TB arrays. With animated diagrams.

🛡️

Disk Structure, Formatting & RAID

From the platters and sectors inside a drive to the addressing that finds a block (CHS and LBA), the formatting that makes a disk usable, and the RAID levels that trade capacity for speed and survival. RAID 0, 1, 5, 6 and 10 — laid out block-by-block with fully animated diagrams and worked capacity numericals.
Disk Geometry CHS ↔ LBA RAID 0/1/5/6/10 Capacity Maths
Press Next → or use ← → arrow keys
SECTION 01

The Problem — A Vast Warehouse

Shelves, Aisles, and an Address for Every Box
A giant warehouse stores millions of boxes. To find one you need a precise address — aisle, shelf, slot — and a forklift that travels there. But one warehouse can burn down. So a careful operator keeps copies across several buildings: some split a shipment for speed, some duplicate it for safety, some add a clever checksum crate so a lost box can be rebuilt. A disk array works exactly the same way.
🧠
Two Questions, One Chapter

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.

SECTION 02 · DIAGRAM

Inside the Drive — Geometry

3 platters surface (×2 each) headreads a surface cylindersame track, all platters spindle
💿
The Vocabulary of Access Time

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.

SECTION 02 · DIAGRAM

Anatomy of a Sector

HEADER sector # · sync · ECC DATA 512 bytes of user payload TRAILER ECC bits ~16 B overhead before · 512 B data · ~16 B ECC after
🧬
Payload Wrapped in Protection

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".

SECTION 03

Addressing — CHS vs LBA

🧭
CHS — Cylinder / Head / Sector
The legacy three-part address (C, H, S) that mirrors the physical geometry directly. Cylinders and heads count from 0, sectors from 1. BIOS limits capped it near 8 GB on old systems.
🔢
LBA — Logical Block Addressing
A single running integer: block 0, 1, 2, …. It hides the geometry — the controller translates each LBA to internal cylinder/head/sector. Modern drives use 48-bit or 64-bit LBAs.
# 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
🔑
Why LBA Won

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.

SECTION 03 · WORKED

Converting CHS (5, 2, 15) ↔ LBA

given · H = 4 heads/cyl · S = 20 sectors/track CHS (5, 2, 15)c=5 · h=2 · s=15 (5×4 + 2) × 20 + (15−1) = 22 × 20 + 14 LBA = 454440 + 14
# 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)
🧮
A Clean Round Trip

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.

SECTION 04 · DIAGRAM

Two Kinds of Formatting

Low-Level · by manufacturer divide tracks into equal sectors write header · sync · ECC now addressable by sector # High-Level · by the OS partition the raw disk write FS metadata (MFT / i-node) reserve the boot block build the free-space map
🩹
Bad Blocks & Sector Sparing

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.

SECTION 05 · DIAGRAM

RAID 0 — Striping for Speed

Disk 1 Disk 2 A B C D blocks A B C D spread across both disks — read/written in parallel
All Speed, No Safety

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.

SECTION 05 · DIAGRAM

RAID 1 — Mirroring for Safety

Disk 1 Disk 2 · mirror A A B B C C D D
👯
Every Block, Twice

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.

SECTION 06 · DIAGRAM

RAID 5 — Distributed Parity

Disk 1Disk 2Disk 3Disk 4 A1 A2 A3 P1 B1 B2 P2 B3 C1 P3 C2 C3 parity (P) rotates across disks · recover any lost block by XOR of the rest
🧩
One Parity Block Rebuilds a Whole Disk

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.

SECTION 05 · DIAGRAM

RAID 6 & RAID 10

RAID 6 · double parity D1 D2 P Q P + Q → survives 2 failures · (N−2)×C RAID 10 · mirror, then stripe pair 1 (mirror)A = A pair 2 (mirror)B = B stripe across mirror pairs → N/2 · 1 fail per pair Trade-off RAID 6 → safer, less space RAID 10 → faster, half space both spend disks on resilience
🏗️
More Parity, or Mirror-Then-Stripe

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.

SECTION 05

RAID Levels — 8 × 500 GB Array

RAIDUsableFailures toleratedEfficiencyBest for
04 TB0100%Scratch, video editing
12 TB1–4 (one per pair)50%Boot drives, critical data
53.5 TB187.5%General file servers
63 TB275%Large arrays, long rebuilds
102 TB1–4 (one per pair)50%Databases, OLTP
⚖️
Capacity, Speed, Safety — Pick Two

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.

NUMERICALS

Capacity Maths — Two Arrays

Problem 1 · 8 × 500 GB (raw 4 TB)  ·  Problem 2 · 12 × 2 TB (raw 24 TB).

RAIDFormula8 × 500 GB12 × 2 TB
0N × C4 TB24 TB
1N/2 × C2 TB12 TB
5(N−1) × C3.5 TB22 TB
6(N−2) × C3 TB20 TB
10N/2 × C2 TB12 TB
🧮
Parity Costs One (or Two) Disks — Not a Fraction

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.

SECTION 09

RAID in the Real World

🏢
Enterprise Servers
RAID 5/6 · RAID 10
Parity RAID for bulk capacity; RAID 10 for latency-sensitive databases and OLTP where write speed matters most.
🏠
Home NAS
Synology · QNAP · TrueNAS
Default to RAID 5/6, or software equivalents — Btrfs raid5, ZFS raidz1/raidz2.
☁️
Cloud Object Storage
S3 · Azure Blob
Go beyond RAID to erasure coding (e.g. 10-of-16, 14-of-18) for durability across many nodes.
🎬
Video Editing
RAID 0 · NVMe
Striped NVMe scratch for 4K/8K workflows — pure speed, since the footage is backed up elsewhere.
📡
Boot Drives
RAID 1
Dual-mirrored SSDs keep the OS partition alive through a drive failure — used in servers and base stations.
🚫
RAID Is Not Backup
the golden warning
Ransomware or a mistaken delete propagates instantly to every copy. RAID survives hardware failure, not human or malware error.
SECTION 10

Eight Rules for Disks & RAID

🛡️ DISK & RAID · CHECKLIST
1
Master the geometry — platter, surface, head, track, sector, cylinder — it drives every access-time calc.
2
Modern OSes address by LBA, not CHS; the controller translates internally. Sectors count from 1.
3
Low-level formatting (headers/ECC) is the maker's job; high-level (FS structures) is the OS's.
4
Disks reserve spare sectors for automatic bad-block remapping; SMART exposes the remap count.
5
RAID 0 = 100% capacity, zero tolerance. RAID 1 = 50%, survives one per mirror pair.
6
RAID 5 = (N−1)/N, survives one. RAID 6 = (N−2)/N, survives two — vital for big arrays.
7
RAID 10 = 50% capacity, excellent writes, up to N/2 failures — the database favourite.
8
RAID is not backup — one ransomware hit or deletion propagates to every copy instantly.
FINAL

From One Platter to a Resilient Array

CHS ↔ 454Addressing
RAID 0100% · 0 safe
RAID 5(N−1) · 1 safe
RAID 6(N−2) · 2 safe
≠ backupRemember it
🎯
You Now Understand Disks & RAID

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.

📚
Where To Go Next

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

You have completed Introduction. View all sections →