Mass Storage & Disk Scheduling

the flash translation layer

/ FTL /

Imagine a shop that, on the outside, lets you 'rewrite' any page in a notebook as often as you like. But behind the counter, the paper is special: you can only write on a fresh sheet, and you can only erase a whole pad of fifty sheets at once. So a clerk quietly keeps a map of which real sheet currently holds your 'page 7', writes updates onto fresh sheets, and recycles spent pads when you are not looking. The flash translation layer is that hidden clerk inside an SSD: it makes awkward flash behave like a simple, freely-overwritable disk.

Concretely, the OS talks to an SSD as if it were an ordinary disk — a flat array of logical blocks it can overwrite at will. But flash physically forbids in-place overwrite and can only erase in large blocks. The FTL bridges the two by keeping a mapping table from each logical block address to the physical flash page that currently holds its data. When the OS rewrites a logical block, the FTL writes the new data to a free pre-erased page, updates the map to point there, and marks the old page stale. It also runs garbage collection (copying the still-live pages out of a mostly-stale block so the whole block can be erased and reused) and wear leveling (spreading writes across all cells so none wears out early).

Why it matters: the FTL is the entire reason an SSD can pretend to be a drop-in disk replacement; the OS file system needs no rewrite to use one. But that convenience hides costs the OS cannot fully see. The constant copy-and-remap causes write amplification — the drive physically writes more bytes than the OS sent, which both slows writes and consumes the flash's limited erase cycles faster. Because the FTL works blind to which blocks the OS still cares about, the TRIM command exists to tell it which logical blocks are now free, so garbage collection does not waste effort preserving data nobody wants.

The OS overwrites logical block 500 ten times in a row. The FTL never touches one physical spot ten times; it writes ten fresh pages across the chip, updating its map each time and leaving nine stale pages behind for garbage collection — which is why the drive may have physically written far more than the OS thinks.

A hidden mapping table makes flash look like an overwritable disk.

The FTL lives inside the drive's firmware, not in the OS, so the OS cannot see its mapping or directly control garbage collection. The best the OS can do is send hints like TRIM; it cannot manage the flash directly.

Also called
FTL快閃轉譯層