Technically, TRIM is a command for the ATA interface. The command is different for other interfaces, and goes by different names in different operating systems, but the action is usually referred to as "Trim". Trim tells your solid state drive which pieces of data can be erased. No matter what name it goes by, Trim works with Active Garbage Collection to clean up and organize your solid state drive. As you use your drive, changing and deleting information, the SSD needs to make sure that invalid information is deleted from the drive and that there is available space for new information to be written. Trim is beneficial, but not mandatory. Because some operating systems do not support Trim, SSD manufacturers design, create, and test their drives assuming that Trim will not be used.
What does Trim do?
The Trim command tells the SSD that specific areas contain data that is no longer in use. From the user's perspective, this data has been deleted from a document. Because of the way solid state drives read and write information, the data is not deleted from the drive at the user's command. Instead, the area of the SSD that contains the data is marked as no longer used. The Trim command tells the drive that the data can be removed. The next time the computer is idle, Active Garbage Collection will delete the data.
If the Trim command did not exist (as was the case before Windows® 7), then the solid state drive would not know that certain sectors in the drive contained invalid information until the computer told the drive to write new information to that location. The drive would need to erase the existing information, then write the new information. This takes slightly more time to do than just writing the new information, so using Trim and Active Garbage Collection helps your SSD perform write commands more quickly.
Trim also affects the longevity of the solid state drive. If data is written and erased from the same NAND cells all the time, those cells will lose integrity. For optimum life, each cell should be utilized at roughly the same rate as other cells. This is called wear leveling. The Trim command tells the SSD which cells can be erased during idle time, which also allows the drive to organize the remaining data-filled cells and the empty cells to write to to avoid unnecessary erasing and rewriting.
How Active Garbage Collection works
Flash memory, which is what SSDs are made of, cannot overwrite existing data the way a hard disk drive can. Instead, solid state drives need to erase the now invalid data. The problem is that a larger unit of the memory, a block, must be erased before a smaller unit, a page, can be written. For example, if there are four pages with data in an otherwise empty block and three pages of data are deleted, the remaining page of data must be written to a new block, then all four pages in the old block can be deleted, freeing them up to be rewritten in the future.
If the drive were to not go through this process of moving valid information so that invalid information can be deleted, and instead, just keep writing new information to new pages, eventually it would fill up with data, some of it no longer valid. To prevent this, Active Garbage collection goes through the disk and moves each page of valid data to a page in another block so the block with invalid data, which has been identified with Trim, can be cleaned out.
Benefits of Trim and Active Garbage Collection
The biggest benefit of Trim is the time savings by having the solid state drive erase data while the computer is idle, rather than using extra time during a write process to remove data that is no longer valid. Because Active Garbage Collection moves related segments of data next to each other, dynamic wear leveling works more efficiently. Garbage collection and Trim work with wear leveling, an algorithm that ensures that each cell is written to and deleted from about the same number of times as all the other cells. This extends the life of the solid state drive.
Microsoft® Windows® from 7 forward supports Trim. It runs automatically in the background unless you have turned it off. You can run it manually or check that Trim is enabled by looking at the Properties of the drive, then selecting Tools, and Optimize.
MacOS® with Apple® SSDs has built-in Trim and Active Garbage Collection. Some versions of MacOS support third-party SSDs with additional software. To check to see if you have Trim support, select the Apple menu while holding down the Option key. Under System Information, scroll to the name of your storage interface under Hardware. TRIM Support will indicate either Yes or No.
Most RAID (Redundant Array of Independent Disks) setups do not support Trim, although that is changing. More RAID software supports Trim with each generation, so check your particular software.
Active Garbage Collection support
Garbage collection occurs automatically using proprietary Active Garbage Collection functionality created by the manufacturer of the solid state drive. Because garbage collection is so important to the functioning of the drive, all drives have it.
Micron makes all of its solid state drives from the silicon up, and garbage collection is a vital part of the drive. Learn more about the process to manufacture SSDs.
Trim and Active Garbage Collection are useful tools that can benefit the speed, function, and longevity of your SSD. But if your operating system doesn't support Trim, it's not a disaster. All Crucial SSDs are designed and tested assuming that they will be used without Trim.
©2019 Micron Technology, Inc. All rights reserved. Information, products, and/or specifications are subject to change without notice. Neither Crucial nor Micron Technology, Inc. is responsible for omissions or errors in typography or photography. Micron, the Micron logo, Crucial, and the Crucial logo are trademarks or registered trademarks of Micron Technology, Inc. Microsoft and Windows are either registered trademarks or trademarks of Microsoft Corporation in the U.S. and/or other countries. MacOS and Apple are trademarks of Apple, Inc., registered in the United States and/or other countries. All other trademarks and service marks are the property of their respective owners.