What are TRIM and Garbage Collection?
Trim and garbage collection are technologies used in modern SSDs to improve performance and endurance. When an SSD is brand new, all NAND blocks are empty, allowing the SSD to write new data to an empty block in a single operation. Over time, all empty blocks are used and contain user data. To write new data to an already used block, the SSD is forced to perform a read-modify-write cycle. This cycle reduces the SSD’s overall performance because the SSD must now perform three operations instead of one. The read-modify-write cycle also causes write amplification, which reduces the SSD’s overall endurance.
Trim and garbage collection work together to free up used blocks, thereby improving SSD performance and durability. Garbage collection is a function built into the SSD controller that consolidates data from used blocks to free up more empty blocks. This process is performed in the background and managed entirely by the SSD itself. However, the SSD may not know which blocks contain user data and which contain outdated, deleted data. That’s where Trim comes in. Trim allows the operating system to inform the SSD that certain data has been deleted, so the SSD can reclaim previously used blocks. For Trim to function properly, both the operating system and the SSD must support it. Today, most modern operating systems and SSDs support Trim, but most RAID configurations do not.
SSDs make full use of both garbage collection and Trim technologies to maintain the highest possible performance and endurance throughout their lifespan.