SSD defragmentation: Does it improve performance?

At the most basic level, fragmentation occurs whenever data is written to a storage device such as an hard drive or an SSD, subsequently deleted and then a different, larger chunk of data is written on the same location, scattering information across the drive’s physical sectors. This, as one can imagine, is especially bad for spinning hard drives, where the drive’s head has to run back and forth to access the requested file in its entirety, but in theory shouldn’t pose much of a problem to SSDs, since they don’t have moving parts and are particularly good at “hopping” back and forth to access data. Additionally, SSDs aren’t as durable as mechanical hard drives when it comes to writing to them, since writing to them causes wear on the NAND chips therein (although this has been largely overcome in later years and high-quality solid-state drives are quite solid when it comes to endurance. Sorry for the pun.

The above considerations pushed Microsoft to prevent users from defragmenting them, even manually. Instead, Windows’ defragger will opt to optimize them by running a TRIM operation, which clears blocks of data that’s not valid anymore, leading to better write performance in the long run and theoretically allowing for a longer drive life, although this is largely dependent on chance. And besides, good SSDs have an endurance rating of hundreds of terabytes of writes, so these concerns should be a thing of the past, especially if you have a strong backup strategy in place.

With all that in mind, I wanted to see if defragging an SSD would bring about improvements in performance.

Testing methodology and hardware

Let’s spend a few words on the hardware we’ll be using for this test. All testing has been performed on my daily driver PC, a custom-built machine with the following specifications:

CPU: Intel Xeon E3-1231 v3 @ 3.4 GHz (3.7 GHz Turbo Boost) 4 cores, 8 threads
Motherboard: Asus B85M-G
Memory: 16 GB  (4 x 4 GB) G.Skill Ares 2400 MHz running at 1600 MHz
Storage: Crucial MX100 256 GB SSD and 2 x 1 TB WD Blue hard drives (7200 RPM models) in Raid 0

To test hard drive performance, we will be using CrystalDiskMark, a benchmarking utility that takes advantage of Microsoft DiskSpd in order to evaluate how storage devices fare. We’ll be running benchmarks on an SSD and a RAID 0 of 2 1 TB hard drives both before and after defragmentation. The paragraph Results will only list exact figures for our SSD tests, whereas HDD tests will only show the relative performance gains from defragmentation in percentage points for the sake of clarity and brevity.

Results

Sequential read/write

Testing for sequential read performance, one can see that defragmenting the SSD gave us tiny performance improvements, with write performance going from 327.6 MB/s to 334 MB/s. This is hardly an improvement at all, but it’s better than nothing.

Read speeds gains were a similar story, albeit a bit better than before. We went from 480.4 MB/s to 496.1 MB/s. Again, nothing too dramatic in terms of performance gain.

Random read/write

Random read and write performance on chunks of data large 4 KB, however, changes things completely and we actually lost some performance after defragmentation, although not very much. Read speeds took a hit of slightly less than 0.5 MB/s and write speeds one of about 2.5 MB/s. I’m actually not sure why this happened, but considering that the performance loss is in the ballpark of a couple percentage points, I’m not too worried.

Performance gains against a RAID 0 array

The chart above shows the difference between performance gains of defragmenting an SSD versus defragmenting two hard drives in a RAID 0 array. What we’re seeing here is that, even though some applications do allow you to defragment an SSD, there’s little to no practical reason to do so, for three reasons:

  1. SSDs do not benefit that much from defragmentation and, in some cases, actually perform worse after being defragmented;
  2. Memory on an SSD wears with usage, although this will only become apparent in the long run;
  3. Generally, performance on a fragmented SSD is fine as it is.

On the other hand, hard drives, having moving parts, benefit much more from being defragmented regularly, regardless of whether you’re using them in a RAID configuration or you’re runnning loose disks.

Conclusion

Defragmenting SSDs is a waste of time. Don’t do that.

About Andrea Luciano Damico 137 Articles

Andrea Luciano Damico is a freelance translator from Italy. Among his interests are linguistics, technology, video games, and generally being a chill guy.
He runs Let’s Translate.it and Tech4Freelancers.net.