Curriculum / Part 1 · Foundations: what storage even is
Lesson 3

HDD vs SSD vs NVMe

Why spinning disks are slow at random I/O, how flash changed the rules, and why NVMe replaced SATA/AHCI for SSDs.

⏱ 35 min5-question quiz

The simple version

A hard disk is a record player. To read a song it has to move the arm to the right track (seek) and wait for the record to spin round to the right spot (rotational latency). Jumping around between songs is slow.

An SSD is a wall of mailboxes: any box opens equally fast. And NVMe is like giving that wall thousands of postmen at once instead of one postman with a short list.

Why HDDs are slow at random I/O

Avg rotational latency = ½ × (60 ÷ RPM)

7,200 RPM → ½ × 8.33 ms ≈ 4.17 ms. Add a few ms of seek and each random I/O costs several ms, so a single HDD manages on the order of a hundred or two random IOPS.

Sequential reads avoid seeks, so HDDs still stream well. That's why they survive as cheap capacity and archive tiers, not as the tier GPUs read from directly.

Flash removes the moving parts

SSDs have no seek or rotation, so random reads typically complete in tens of microseconds rather than milliseconds. The internal parallelism (many NAND dies and channels, Lesson 6) also means an SSD only reaches full speed when many I/Os are in flight.

AHCI vs NVMe: the queue problem

SATA / AHCINVMe
Queues1Up to 65,535 I/O queues
Commands per queue32Up to 65,536
AttachmentSATA controllerDirectly on PCIe
Interface ceilingSATA 3: 6 Gb/s (~600 MB/s)Set by PCIe gen × lanes (Lesson 9)

AHCI was designed for spinning disks. NVMe gives each CPU core its own queue pair, so cores don't fight over a lock to submit I/O.

Reading a drive's health

$ nvme list
$ sudo nvme smart-log /dev/nvme0
$ sudo smartctl -a /dev/nvme0

Watch percentage_used (rated endurance consumed), media_errors, critical_warning and the temperature fields. You'll use these again in Lesson 9's thermal-throttling discussion.

Tools

nvme list
Every NVMe namespace with model, capacity and firmware.
nvme smart-log /dev/nvme0
Health log: wear, errors, temperatures (nvme-cli).
smartctl -a /dev/nvme0
Same health data via smartmontools; also works for SATA/SAS.
cat /sys/block/sda/queue/rotational
1 = spinning disk, 0 = non-rotational.

Quiz

Lab

Related lab

Lab 2.2 · One drive with terrible p99

A training job's checkpoint restores are sometimes slow on gpu-a. Each of its four NVMe drives serves part of the data, and the slowest one sets the pace.

Start lab 2.2 →

Try it now in the simulator (opens with the command ready; press Enter):

$ nvme list$ nvme smart-log /dev/nvme0