Programming
We provide developers and engineers the guides and tutorials they...
Search
We provide developers and engineers the guides and tutorials they...
Content is king. It's not just about how you're going to write, b...
Looking for an engaging connection with thousands of other people...
SSD vs HDD from the hardware up: spinning platters and seek time versus NAND flash, plus NVMe, wear levelling, TRIM and when a hard drive still wins.
Quick answer: A hard disk drive (HDD) stores data on spinning magnetic platters and must physically move a read head to the right spot, which takes several milliseconds per access. A solid-state drive (SSD) stores data as electrical charge in flash memory cells and has no moving parts, so it can reach any piece of data in a fraction of a millisecond. The difference is largest for random access, which is exactly what booting, launching apps and running databases need.
| HDD | SATA SSD | NVMe SSD | |
|---|---|---|---|
| Storage medium | Magnetic platters | NAND flash | NAND flash |
| Moving parts | Yes | No | No |
| Random access time | Several milliseconds | Around 0.1 ms | Tens of microseconds |
| Random operations per second | Roughly 100 to 200 | Tens of thousands | Hundreds of thousands or more |
| Sequential speed | Roughly 100 to 250 MB/s | Up to about 550 MB/s | Several GB/s |
| Cost per GB | Lowest | Higher | Higher |
| Shock resistance | Poor | Good | Good |
Figures are typical ranges and vary by model.
Inside an HDD, one or more rigid platters coated with magnetic material spin at a constant speed, commonly 5,400 or 7,200 revolutions per minute. A tiny head on the end of an arm floats nanometres above the surface, reading and writing magnetic patterns.
To read a block, two mechanical things must happen:
Add them up and a random read costs around 10 ms. That limits a hard drive to roughly a hundred or two random operations per second, no matter how fast the computer is.
Sequential reads are a different story. Once the head is in place, data streams past continuously, so large files read at a respectable speed. Hard drives are slow at jumping around, not at reading in a straight line.
An SSD stores bits in NAND flash cells. Each cell is a transistor with an insulated region that can trap electrons. The amount of trapped charge represents the stored value, and it stays there without power.
Cells differ in how many bits they hold:
| Cell type | Bits per cell | Trade-off |
|---|---|---|
| SLC | 1 | Fastest, most durable, most expensive |
| MLC | 2 | |
| TLC | 3 | Common in consumer drives |
| QLC | 4 | Cheapest and densest, slower writes, least durable |
Reading a cell is purely electrical. There is no arm and no spin, so every location is equally quick to reach. A random read takes tens to hundreds of microseconds, which is why the latency numbers every programmer should know put SSDs so far ahead of disks.
Flash has constraints that the drive's built-in controller has to hide:
To cope, the controller runs a flash translation layer that maps the block numbers your computer asks for onto physical locations, and it does three clever things:
The TRIM command helps: when you delete a file, the operating system tells the drive which blocks are no longer needed, so garbage collection does not waste effort preserving them. More on that in how file systems work.
Early SSDs used SATA, an interface designed for hard drives. Its protocol handles one queue of 32 commands, and its speed tops out around 550 MB/s. That was a ceiling imposed by the cable and protocol, not by flash.
NVMe was designed for flash. It connects over PCIe lanes directly to the CPU and supports thousands of parallel queues. That removes the bottleneck, letting modern drives reach several gigabytes per second and very high random performance.
Fast random access reshaped how software is built:
Hard drives remain the cheapest way to store a lot of data. They are still a sound choice for:
Both types fail eventually, in different ways. Hard drives suffer mechanical wear and are vulnerable to shocks. SSDs wear out with writes and can fail suddenly. Neither replaces a backup.
Yes, each cell survives a limited number of writes. In practice, wear levelling means a typical consumer drive lasts many years of normal use. Manufacturers state endurance as "terabytes written".
For large file copies and heavy workloads, clearly. For everyday tasks such as browsing and office work, the jump from HDD to any SSD is far bigger than the jump from SATA to NVMe.
It is harder than with a hard drive. Because of TRIM and garbage collection, deleted data is often physically erased soon after deletion.
With little free space, the controller has fewer empty blocks and must do more garbage collection during writes. Keeping some space free helps.
The speed difference comes down to physics: a hard drive must move metal, and an SSD only moves electrons. That turns a ten-millisecond wait into a fraction of a millisecond, and it matters most for the scattered small reads that dominate real workloads. Use SSDs for anything you run and hard drives for anything you merely keep.