Hardware & Devices

How SSDs Work: NAND Flash, Wear Leveling, TRIM and NVMe

What really happens inside a solid-state drive every time you save a file

Zarton EditorsOct 29, 2026 · 7 min read
Listen to this article

Your solid-state drive has no spinning platters and no moving heads, yet it is quietly doing more bookkeeping than any hard disk ever did. Every time you save a file, a tiny computer inside the drive decides where the data really goes.

This guide explains how SSDs work, from the flash cells that hold electric charge to the firmware tricks (wear leveling, garbage collection and TRIM) that keep a drive fast and alive for years.

Inside an SSD: three main parts

Course notes from Williams College describe an SSD as a device that looks like an ordinary block device to your operating system but contains its own RAM, processing power and NAND flash chips. In practice that means three cooperating pieces:

  • NAND flash – the chips that actually store your bits as electric charge, with no moving parts.
  • The controller – a small processor running firmware that decides where every write lands.
  • The host interface – SATA or NVMe over PCIe, the "language" the drive uses to talk to your computer.

The controller's firmware layer, called the flash translation layer (FTL), hides all of flash memory's awkward rules so your OS can pretend it's talking to a simple array of numbered blocks.

How NAND flash stores bits

Each flash cell is a transistor that can trap a precise amount of charge. The drive reads a cell by checking which voltage range that charge falls into. If a cell only needs to tell "charged" from "not charged," it stores one bit. Squeeze more distinguishable levels into the same cell and it stores more bits.

Pages, blocks and the erase-before-write rule

Cells are grouped into pages, the smallest unit the drive can read or write, and pages are grouped into blocks. Older drives described in TechRadar's explainer used 4 KB pages in blocks of 128 pages; modern NAND uses larger pages, such as a 16 KiB example cited in the Williams College notes.

Here's the catch that shapes everything else: a page can be written only once, and it can't be overwritten until its whole block is erased. Erasing happens only at block granularity. So the drive can't "edit" data in place. When you change a file, the new version is written to a fresh page and the old page is simply marked invalid.

SLC, MLC, TLC and QLC

The more bits a cell holds, the more precisely the drive must place and read its charge, and the faster the cell wears out. Kingston and Lenovo summarize the trade-off like this:

TypeBits per cellTypical enduranceWhere you'll find it
SLC1~100,000 P/E cyclesIndustrial and server gear; fastest, priciest
MLC2~10,000 P/E cyclesBalanced price, speed and endurance
TLC3~3,000 P/E cyclesMost consumer SSDs
QLC4 (16 voltage states)Lower than TLCBig, read-heavy storage: game and media libraries, archives

"P/E cycles" means program/erase cycles: how many times a block can be erased and rewritten before its cells become unreliable. Kingston also notes that 3D NAND, which stacks cells in layers instead of laying them flat, raises density without a big price jump and improves endurance and power use compared with flat 2D NAND.

The flash translation layer: the drive's secret map

Because data never stays put, the controller keeps a map from the logical block addresses your OS uses to the physical pages where data really lives. Every write updates that map. On top of mapping, the FTL handles three jobs that keep the drive healthy.

1. Garbage collection

Over time, blocks fill with a mix of valid pages and invalid (stale) ones. To reclaim space, the controller copies the still-valid pages from a block into a clean area, updates its map, then erases the whole block. TechRadar notes that some drives do this during idle time, which is one reason a brand-new SSD feels quicker than one that's been filled and rewritten for months.

2. Wear leveling

If the drive always reused the same few blocks, those would burn out early while the rest sat untouched. Wear leveling spreads writes across all blocks so they age evenly. Pages that fail are retired, and a pool of spare capacity, called over-provisioning (the gap between physical and advertised capacity), gives the controller room to work and replacements for worn-out blocks.

3. Write amplification

Garbage collection has a cost: copying valid pages means the flash absorbs more writes than you actually sent. Williams College defines write amplification as the total flash writes issued by the FTL divided by the writes issued by the host. The lower it stays, the longer the drive lives.

TRIM: telling the drive what you deleted

When you delete a file, the file system just marks that space free in its own records. The SSD doesn't know, so it would keep faithfully copying those dead pages during garbage collection. TRIM (called "discard" on Linux) fixes this by letting the OS tell the drive which logical blocks no longer hold useful data, so the controller can skip them and erase sooner.

Red Hat's storage guide describes three ways Linux can do this and recommends batch or periodic discard over continuous online discard for most workloads:

# Check the device supports discard (non-zero means yes)
cat /sys/block/nvme0n1/queue/discard_max_bytes

# Batch: trim every mounted file system now
sudo fstrim --all

# Periodic: run a weekly trim automatically (systemd)
sudo systemctl enable --now fstrim.timer
Online discard is also possible with the discard mount option, but Red Hat suggests it only when batch trimming isn't practical.

TechRadar notes Windows has supported TRIM since Windows 7, so most desktop users never need to touch it. On Linux servers, confirm the timer is on; it pairs well with our guide to how Linux containers work.

SATA vs. NVMe: why the interface matters

Early SSDs used the same SATA connection and AHCI command protocol designed for hard disks. That protocol offers a single command queue with room for 32 commands. NVMe, built specifically for flash over PCIe, allows up to 64K queues, each up to 64K commands deep, and lets every CPU core own its queue so cores don't have to coordinate before sending work.

The bandwidth gap is just as stark. Mete Balci's tour of NVMe notes that SATA III tops out at 6 Gb/s, while an M.2 drive on four PCIe 3.0 lanes reaches nearly 4 GB/s. Deep queues matter because flash banks work in parallel, and fast drives need many outstanding requests to stay busy.

How to check your SSD's health

NVMe drives keep a built-in health log. On Linux, nvme-cli or smartctl can read it:

sudo nvme smart-log /dev/nvme0
# or
sudo smartctl -a /dev/nvme0

Three fields tell most of the story:

  • Percentage used – the vendor's estimate of how much rated endurance is consumed. 100 means the rated life is used up, though the drive may keep working; plan a replacement.
  • Available spare – how much of the spare capacity reserved for retiring bad blocks remains, from 0% to 100%.
  • Data units written – host writes, counted in units of 1,000 × 512 bytes. Multiply by 512,000 to get bytes, then compare with the drive's TBW (terabytes written) rating on its datasheet.

Netdata points out that "percentage used" already includes write amplification inside the drive, so it can differ from a simple TBW calculation, and it can even read above 100.

Key takeaways

  • SSDs store bits as trapped charge in NAND cells; more bits per cell means more capacity but less endurance.
  • Flash can't overwrite in place: pages are written once and erased a whole block at a time.
  • The controller's flash translation layer remaps every write and runs garbage collection and wear leveling.
  • TRIM tells the drive which data is deleted, cutting wasted copying and write amplification.
  • NVMe's deep, parallel queues and PCIe bandwidth unlock speeds SATA can't reach.
  • Check "percentage used" and "available spare" to see how much life a drive has left.

Frequently asked questions

Do SSDs wear out?

Yes. Each erase slightly degrades flash cells, so every block has a limited number of program/erase cycles. Wear leveling and spare capacity spread that wear out, and each drive's datasheet lists an endurance rating (TBW) so you know what to expect.

Is QLC bad?

Not for the right job. QLC stores four bits per cell, which makes large drives affordable, but it writes more slowly and endures fewer cycles than TLC. It's a good fit for read-heavy libraries and archives, and a weaker fit for constant heavy writing.

Should I defragment an SSD?

No. SSDs have no seek time, and the controller already scatters data across chips on purpose. Defragmenting only adds writes. Let the OS run TRIM instead.

Why does my SSD slow down when it's nearly full?

With few empty pages left, the controller has to run garbage collection more often, copying valid data before it can erase blocks. Keeping some free space and TRIM enabled gives it room to work.

Sources

Comments

No comments yet — be the first to share your thoughts.

Join the discussion

Comment

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Keep reading

All posts

Run your whole business from one conversation.

Get startedTalk to us