In this article we explain what defrag is and why it is generally a bad idea to run it on an SSD.
But that is a very simple answer to a much more nuanced truth that most websites and forums have wrong. Keep skimming through this article if you want to understand that Defragging and Optmizing an SSD are both very good things, when left to Microsoft.
What Does Defrag Do?
Defragmenting a spinning hard disk moves the thousands of file parts into sequential order so that disk read heads do not waste time, electricity and wear skipping through your spinning disk to find all the pieces.
Should I Defrag my SSD?
Crucial, one of the worlds largest manufacturers of SSD’s explains it this way:
Defragging ensures that large files are stored in one continuous area of a hard disk drive so that the file can be read in one go. Mechanical drives have a relatively long seek time of approximately 15ms … This really adds up when reading lots of different files split into lots of different fragments.
However, this isn’t an issue with SSDs because the seek time are about 0.1ms. You won’t really notice the benefit of defragged files. SOURCE
However this leaves three questions:
1 – Why Is Defragging an SSD a Bad Idea?
Running a defragmenting utility on an a solid state disk is bad idea because SSD’s wear out with use, and defrag moves a lot of files. Given that there is virtually no performance increase from defragmenting SSD, there is almost nothing but downside to doing it… so don’t 😉
2 – Does Windows 10 / 11 Defrag SSD’s Automatically?
However, once a month Windows automatically considers partially defragmenting an SSD if there is exceptional fragmentation that is approaching the ‘maximum fragmentation threshold’. After that threshold is reached the “meta data” for the file fragments exceeds what the SSD can handle causing the SSD to stop reading and writing. This is a bad thing so Microsoft will carefully defrag the rare potentially problematic files.
3 – What Does Windows 11 / 10 SSD Optimization Do?
When a file is deleted on an SSD, the memory cells (yes, the physical cells inside the memory chips) are simply flagged as available to be overwritten, but the data still exists. Unlike old spinning disks, SSD’s cannot write data into their memory cells if something is already in that space.
SSD’s run a command named “Trim” to actively delete the data in the memory cells that are flagged as garbage.
Think of Trim as popping bubbles to make the space available again. Without the Trim command, your SSD would just keep filling up until it was 100% maxed out.
Back in 2008 and 2009 the better SSD’s did not wait for a software tool to Trim off the garbage; they had “auto trim” running right on the SSD hardware controller. Today virtually all SSD’s have auto-trim built in so the junk data gets removed quickly.
However, if you look at Windows 11 and Windows 10 you will find a the old disk utility that used to do very little more than defrag. Today, if Windows detects an SSD the ANALYZE button becomes grayed out because that relates to defrag and users should not defrag and SSD. But there is an Optimize button and that seems to confuse people.
The Optimize button in the Windows Optimize Drives utility, simply runs another Trim command to ensure all of the junk is gone. If you care about the technical detail, this is cleverly called a “retrim” command.
And this may lead you to wonder, how an SSD could screw up its own trimming. Well, it turns out that SSD manufacturers are very concerned about performance and their controllers can only handle so many commands at once. If the SSD is busy and a pile of Trim commands are sent to the SSD (i.e. because you deleted a bunch of files), it may max out it’s buffer and drop some of those Trim commands.
That is very bad because unless the memory cells are flushed with a Trim command, they can not be reused. So over a long period of time, your SSD could be increasingly consumed by old data that did not actually get deleted.
Windows Disk Optimization uses the retrim command slowly so it does not max out the command buffer.
Summary of Defrag, Disk Optimization, Trim & Retrim
For all these reasons it is important that:
- you do NOT run defrag on your SSDs, BUT
- you do NOT disable Windows Disk Optimization
The moral of the story, is just leave Windows defrag at its default settings.
If you have any questions, just leave us a comment below and we will do our best to get back to you.