What is TRIM?
A command by which the operating system tells an SSD which areas belong to deleted files. Knowing which data is no longer needed makes garbage collection more efficient.
Field: SRAM and flash memory
Read the beginner explainer: How Do SSDs Work? Inside NAND Flash Memory, Explained
Japanese name: TRIM
Why an SSD needs to be told
An SSD's controller runs a flash translation layer (FTL) that maps the logical block addresses used by the operating system to physical flash pages. Deleting a file only updates the file system's own bookkeeping; the SSD receives no write and still considers the old data valid. During garbage collection, the drive therefore keeps copying data that nobody will ever read again, wasting time and flash endurance. TRIM closes this information gap: the operating system sends the address ranges that no longer hold useful data, so the drive can stop preserving them.
What happens after a TRIM
On receiving TRIM, the FTL removes the mapping for those logical addresses and marks the corresponding physical pages invalid. The data is not necessarily erased immediately; erasure happens later, block by block, when garbage collection reclaims the space. Blocks containing mostly invalid pages can then be erased with little or no copying, which reduces write amplification and keeps write performance steady as the drive fills. Depending on the drive, reading a trimmed address afterward may return zeros or undefined data, so deleted files on SSDs are typically much harder to recover than on hard disks.
Interfaces and how it is issued
TRIM is the name of the ATA (SATA) command option; SCSI and SAS systems use UNMAP, and NVMe provides the same function through the Deallocate option of its Dataset Management command. Operating systems issue it either continuously, sending a discard as each file is deleted, or in periodic batches, which avoids slowing down deletions. Layers between the file system and the drive, such as some RAID or disk-encryption setups and virtual disks, must pass the command through for it to reach the flash, and may need to be configured to do so.
Not to be confused with
TRIM is only a hint from the host; garbage collection is the drive's internal process that actually relocates valid data and erases blocks, and it runs with or without TRIM. In semiconductor fabrication, resist trimming is an unrelated plasma process that thins resist lines below the exposure limit, and laser trimming adjusts resistor values in analog chips. Conventional hard disks overwrite data in place and do not need TRIM, although thin-provisioned storage uses the equivalent unmap command to reclaim space.
Try it: questions about TRIM
- AECC
- BISPP
- CTRIM
Show answer and explanation
Answer: C. TRIM
Deleting a file only updates the OS's bookkeeping, so the SSD does not know the data is obsolete and keeps copying it during garbage collection. The TRIM command tells the SSD which ranges are no longer needed; it marks those pages invalid and can erase them without copying, reducing write amplification and improving performance and lifespan. NVMe provides the same function through the Deallocate attribute of the Dataset Management command.
- AThe write speed doubling
- BThe write voltage becoming higher than normal
- CThe amount of data actually written to flash exceeding the amount written by the host
Show answer and explanation
Answer: C. The amount of data actually written to flash exceeding the amount written by the host
Because flash cannot overwrite and erases by block, garbage collection adds extra writes such as copying valid data to new blocks, so the flash receives more data than the host wrote. The ratio is the write amplification factor (WAF), which can reach several times under small random writes. TRIM, spare area and data compression reduce it, protecting lifespan and performance.
FAQ
Does TRIM erase data immediately?
Not necessarily. TRIM marks the data as invalid and removes its address mapping; the physical erase happens later when garbage collection reclaims the block, though reads of trimmed addresses may already return zeros.
Do NVMe SSDs support TRIM?
Yes, through the Deallocate option of the NVMe Dataset Management command, which does the same job; operating systems usually still call it TRIM or discard.
Is TRIM needed on a hard disk drive?
Conventional hard drives can overwrite sectors in place, so they do not benefit from TRIM; it matters for flash storage, where blocks must be erased before reuse.
Books on SRAM and flash memory Ad
As an Amazon Associate I earn from qualifying purchases.
This page was drafted with AI and fact-checked by a separate AI review before publication. Our Editorial policy explains how we write and check content. If you spot an error, please tell us on our Contact page.
Back to the glossary