Solid State Drives are still a few years away from being mainstream, but with dropping prices they are gradually becoming more and more common. SSDs represent a significant step up from the standard rotating hard disks, and once you’ve grown used to the massive performance benefits of an SSD, you simply won’t be able to do without one. SSDs have no moving parts; hence, access and seek times are significantly lower. They can access any and multiple locations instantaneously. This in turn is responsible for blazing fast read speeds on an SSD. This is also responsible for another significant advantage of SSD – absence of fragmentation woes. SSDs are designed to read and write data from multiple logical blocks to increase performance, hence it actually encourages fragmentation.
Do SSD Drives Need to be Defragged?
So, where does that leave us with defragmentation tools? Do you need to defragment your SSD? The answer is actually both yes and no. First, let us look at what do we mean by defragmentation in the traditional sense of the term. When your system is writing a file, it often doesn’t write them into contiguous blocks on your disk. Instead, it often picks the first free block that it finds. As a result, the data often ends up being scattered across the disk. This is a big problem for hard disks as the read-write head needs to be physically positioned over the block where the data resides (seek time). Having the data scattered across the disk can have a massive impact on read performance. Traditional de-fragmentation tools re-arrange the data on your disk, so that they are packed into the smallest number of contiguous regions possible. However, as I explained above, this is a non-issue for solid state drives. SSDs don’t have any moving parts and can access any block at random. Additionally, they can also read and write data simultaneously from multiple blocks. So, in the traditional sense of the term, SSDs don’t need to be defragged. This is the reason why if you installed Windows 7 on an SSD, the defragment option would be disabled for you. However, on Windows 8, that same feature made a comeback for SSD users. What changed?
What does Optimize and Defragment Tool in Windows 8 do on SSDs?
SSDs have a couple of limitations in the way they work. SSDs are divided into blocks, each of which consists of multiple pages. Pages form the smallest logical unit in a SSD storage. In an empty SSD, you can both read and write from pages, but if your pages already have data, then write becomes a two step process – an erase followed by the actual write. Unfortunately, due to the way SSDs are designed, you must erase entire blocks at a time. This means that when you try to write data to a block that has both valid and invalid (marked for deletion) pages, the following steps need to be followed
- Allocate a new block, and copy the existing valid pages to that new block.
- Write the data you wanted to write to that new block.
- Delete the existing block completely, and add it to the pool of empty blocks.
Obviously, it’s critical that an SSD always maintains a pool of empty blocks. In order to achieve this, the drive runs garbage collection operations in the background. It selects blocks with large number of invalidated pages (pages with data that has been marked for deletion), copies the valid pages to a fresh block, and cleans the block. Different manufacturers have different garbage collection algorithms, and the actual cleaning up of the disk itself is not controlled by the OS. The OS simply sends a TRIM hint to the SSD to indicate that a page has invalidated data and can be deleted. The SSD might choose to act on it immediately and clean-up the block, store it for later action, or discard it because it’s too busy.
SSD performance deteriorates over time due to write amplification, which itself is a manifestation of the garbage collection procedure. Head over to AnandTech for a detailed explanation.
In Windows 8, the “Optimize and defragment drive” tool adapts its behaviour depending upon the kind of storage media you are using. If an SSD is detected, it doesn’t do a typical defragmentation operation. Here’s what an official response from Microsoft on the purpose of Optimize tool had to say:
In Windows 8, when the Storage Optimizer (the new defrag tool) detects that the volume is mounted on an SSD – it sends a complete set of trim hints for the entire volume again – this is done at idle time and helps to allow for SSDs that were unable to cleanup earlier – a chance to react to these hints and cleanup and optimizer for the best performance.
What Does 3rd Party Defragmentation Tools like Perfect Disk do on SSDs?
So, even though defragmentation isn’t necessary on an SSD drive, the in-built Optimize tool is still helpful in preventing gradual performance degradation of your SSD. But, where does this leave other defragmentation tool manufacturers? Why are companies like Raxco selling products like Perfect Disk, which claim to be optimized for SSDs? Are they a sham? Here’s what Perfect Disk has to say about it’s tool.
From the product video, it appears that Perfect Disk also doesn’t do a typical defragmentation on SSD drives, and essentially works in a manner similar to the in-built Optimize tool. The difference lies in the fact that Perfect Disk first tries to consolidate free space and reduce the number of partially full blocks. The free space consolidation for SSDs is different in the sense that it only tries to pack all valid data together, and doesn’t bother about having files stored in contiguous data blocks. Also, while the normal free space optimization clubs together all the free space at the end of the drive, the free space consolidation for SSDs grows the largest existing gap on the volume (wherever that may be). Raxco claims that this makes the TRIM command more effective.
This eliminates one flaw in wear leveling and trim in that partially full blocks are not trimmed. Only blocks that are verified as empty are reset by the SSD (based on block boundaries). This means that when organic writes are committed to the device, the wear leveling algorithm has more trimmed blocks to work with. This helps TRIM both restore performance, and the wear leveling algorithm extend the life of the device.
Does it really work? I’m not convinced that the pre-processing that Pefect Disk does is necessary. To me, it seems that once the OS has issued the TRIM commands to invalidate the pages, the SSD should be able to step in and clean up the block by following the process of move-delete described above. If you have an in-depth knowledge of the way an SSD works, please feel free to shed more light on this topic.