This article was written by Glenn Brensinger, a former technician, and originally debuted in Tech Tails issue #758.

Solid state drives (SSDs) are advertised as better than standard hard drives, and in most cases that’s true. There are no moving read/write heads or spinning platters, so there’s no time wasted while the drive rotates around to grab the next data fragment. Plus, the lack of moving parts means better battery life on portable systems.

However, due to the way data is stored on a solid state drive, you will see a higher performance gain on reading data than writing it. Loading applications and documents will take almost no time at all compared to the same retrieval on a hard disk, but writing large amounts of data may not be that fast. The reason is because of the way a SSD stores data.

Picture a large storeroom with a row of shelves, and each shelf contains a row of egg cartons. Near the door of the storage room is a large whiteboard with a list of what is in each of the egg cartons. Any time someone needs to store some information, they write it on a slip of paper and put it into an empty spot in an egg carton, then go to the inventory list and mark down the location of that note.

When someone needs to find a note, they consult the list so they know which egg carton to go to. If you no longer need a note, you go to the whiteboard and erase the reference to the note so others know that space can be reused. Seems like a decent system, right? Well, there’s one issue: No one ever goes into the shelves and does any housecleaning, so you have rows of egg cartons full of old notes that aren’t being used anymore.

When you delete a file, the directory portion of the file system (the whiteboard) is updated to show that the file is no longer needed so the space it takes up can be reused. However, the data is not actually removed from the hard disk (unless you specify a secure wipe, which is outside the scope of this article). For a standard hard drive, any existing (unused) data is overwritten by the new data in one pass, so to the user it’s transparent. Because of the way the memory cells work on a solid state drive, data cannot be overwritten; the storage cell must be emptied before something else can be put there.

Data on a solid state drive is stored in blocks, with each block containing multiple cells. Data can be written to each cell individually, but data has to be erased by the block. Remember those egg cartons? To save a note, you find an empty spot in an egg carton and drop the paper into it. To replace one of those pieces of paper, however, you have to remove every piece of paper from the egg carton, temporarily store them in another egg carton (known as a cache) dump all of the notes, then put only the notes that are still in use back into the original egg carton.

Now there are empty spaces so you can save your new note, but two extra steps were needed just to store it. Since it all happens in a matter of microseconds, it doesn’t typically become a problem for small files, but when you start dealing with large files (such as editing movies) the slow-down in writes can become very noticeable.

This is where the TRIM feature comes in. TRIM, while capitalized, is not an acronym for anything; its purpose is to trim old data from the SSD. The operating system will watch for idle times (when no data is being written) and signal the drive to erase any storage locations that have been marked for deletion. Later, when data needs to be written to that space, there is no wait time since the space is already empty. The TRIMming happens in the background while you’re doing other things, so you aren’t even aware that it’s going on.

A lot of newer solid state drives either have TRIM support built in or the vendor has made a firmware update available to enable it. TRIM does not happen automatically, however; the drive needs to be told by the operating system when it’s safe to trim. Windows 7, Windows Server 2008, Linux 2.6, OpenSolaris, and FreeBSD already have TRIM support, but Mac OS X support was not scheduled to be included until version 10.7 “Lion” later this year. It was recently discovered that the newly released line of MacBook Pro “Thunderbolt” systems run an updated build of Snow Leopard that includes support for TRIM. As of the time this article is being written, the only drives supported are the ones Apple ships with the system, but that may change in the future as Apple evaluates other brands.

There are utilities available to do a manual TRIM on operating systems that do not have support built in; however, some of them could cause data loss if not used properly, so I will not mention them here. They fall under the category of “if you know how to use it, you’ll know where to look for it.”