What is TRIM Support?

First some background: The longer you use an SSD, the more likely it becomes that you see degradation in performance, even if the device isn’t filled with data. When the performance of conventional hard drive deteriorates it’s usually sufficient to defrag, because in this case it is beneficial to have all data stored in sequence or in the same physical location on the hard drive so that the head doesn’t have to move back and forth when reading or writing to the disk.

With an SSD the complete opposite applies – it is better to have the data spread out across different locations so that the data can be read in parallel. This is essential to get the best possible performance from the drive.

In addition, an SSD does not like to overwrite or delete data. Such instructions consume performance and also shorten the life span of the drive – a solid state drive can only a finite number  of overwrites before it reaches the end of its life cycle (depending on the quality of the drive and cell type).

The primary solution to this issue is that when you delete a file from the device it is just flagged as “available” instead of being physically deleted.  To keep the number of overwrites to a minimum on the SSD, the operating system or drive controller steps in to ensure that it writes to a new location as often as possible (instead of overwriting the old file) to avoid unnecessary wear and tear.

However, when there are no vacant blocks that can be used for new files you run into another issue. While it is possible to read and write to NAND flash in 4KB pieces you can only delete an entire block of 512KB. In other words, if you want to overwrite a 6KB previously deleted file with another 6KB file, the drive has to start by loading the entire 512KB block. Then it rewrites it by replacing the deleted file with the new one and finally writes the entire block back to the drive.

Introducing TRIM

In Windows 7 (and Linux from the 2.6.33 kernel) this performance-degrading problem can be mitigated with the TRIM command. When the OS recognizes your drive as an SSD, it tells the device when a file is removed so that it can clear the blocks used by the file, leaving it empty when a new file is to be written.

So basically, the whole procedure mentioned previously is carried out when a file is deleted instead of when it should be overwritten. That way you will see a small reduction in performance when deleting a file, but gain lots of performance when writing files to an SSD drive that has been in use for a while.

TRIM support varies among different manufacturers, but should be standard in new drives soon enough. Some drives even come with proprietary software solutions that offer similar functionality in older operating systems like XP and Vista, but that’s another story.

Tags: