In recent years, SSDs have become the standard storage device for enthusiasts and gamers: they are smaller and faster than hard drives, and they have become much more reliable over time.
If your SSD is already showing signs of failure and the files matter, see our SSD recovery service.
But do you need to defragment them?
That’s the question we answer today. We also explain exactly what happens when you defragment an SSD and whether you need to defragment it before installing Windows 11.
At the end, you’ll find 4 methods for optimizing your SSD so it keeps performing at its best.
Let’s get started!
What is SSD defragmentation?
“Fragmentation” is something that happens naturally to drives as data is written to them.
When you format a drive, you create a file system: an organized map of the drive that tells the computer exactly where each piece of information is stored.
On a new or freshly formatted drive, data is written in one continuous sequence.
But when you delete a file, you leave a gap in that sequence, and the computer marks that space as available for new data.
The problem is that new files will rarely fit that gap exactly.
So the operating system fills the gap with the first part of the file and then looks for the next free space, which leaves pieces of files scattered all over the drive.
As you can imagine, this makes it harder to read a complete file, or a set of related files, because the drive has to jump from one place to another. On a hard drive, that means slower performance.
When you defragment a disk, the computer rearranges your data so that each file is stored in one continuous block, using the drive’s free space as working space.
This process is only useful for hard drives, which have moving mechanical parts. For SSDs, which store data electronically, it is a long, write-heavy process that brings no benefit and only shortens their lifespan.
What happens when you defragment an SSD?
One of two things, depending on the system or program you use: you get a message saying it shouldn’t be done, or the defragmentation runs, leaves the SSD no faster than before and simply adds wear.
Since the first case changes nothing, let’s look at the second:
- The blocks that make up each file are “moved” to consecutive addresses in the file system. However, the SSD controller still places them wherever it sees fit in the physical memory, using a technique called wear leveling. So even though the file system now shows the file in neighboring blocks, they are not physically next to each other.
- Every time a block is “moved”, it is actually copied to a new location and the original is marked as invalid, which means new writes for every move. SSDs cannot overwrite used memory directly: it has to be erased first, and that is done in large blocks by the controller (the TRIM command tells it which data is no longer needed). Defragmentation also tends to move the same data several times, like rearranging jigsaw pieces in one pattern only to find that another piece no longer fits. As a result, defragmenting can move some blocks dozens or even hundreds of times, depending on how full the drive is and how the program chooses to move the data.
Should I defragment my SSD?
The whole problem of fragmentation comes from the fact that hard drives use moving parts to access data.
SSDs have no moving parts (hence “solid state”), so there is no seek time or rotational latency.
Instead, SSDs access their flash memory (NAND) much faster, typically in under 50 µs (50 microseconds). Compared with the average access time of a typical hard drive, around 15 ms, that’s about 300 times faster.
Furthermore, as we have seen, defragmenting an SSD leaves it no better than it was, and it wears the drive out faster than normal use would.
Defragmenting does nothing to speed up an SSD, because it doesn’t slow down when a file is spread across different locations.
The only real reason to defragment an SSD is to shrink a partition, and even then most partition tools can move the files themselves without a separate defragmentation.
In other words, they “move” the data so that the file system shows it near the beginning of the partition instead of the end.
Don’t defragment a new SSD
A new computer is stable, fast and reliable, but its SSD wears out over time as its memory cells deteriorate with each write.
That doesn’t affect normal daily use, because the SSD only wears out after a long time.
It doesn’t happen quickly: a 500 GB Samsung 850 EVO, for example, is rated for 150 TB of total writes (TBW), which is the same as writing the entire drive about 300 times.
Since a typical user writes less than 20 GB a day on average, it would take more than 20 years to reach those 150 TB.
But a defragmentation can easily write hundreds of gigabytes of data, which would wear out an SSD much faster for no gain in performance.
Avoid defragmenting to extend its lifespan
As we have seen, defragmentation reads data from the SSD and writes it again, often many times over, and this shortens the drive’s life.
So if you want to extend your SSD’s life and keep it performing well, don’t defragment it.
Should I defragment the SSD before installing Windows 11?
If your SSD is new, it isn’t fragmented. So rather than defragmenting it, optimize it.
SSD optimization in Windows 11
In Windows 7, 8, 10 and 11, optimization is automatic: TRIM is enabled by default, and from Windows 8 onwards the Optimize Drives tool runs TRIM on SSDs instead of defragmenting them. Windows Vista and XP don’t support TRIM natively, so you need the SSD manufacturer’s tool.
Method 1: Make sure TRIM is enabled
TRIM improves performance and efficiency by telling the SSD which blocks no longer contain useful data, so they can be cleaned in advance. This helps keep the SSD fast throughout its life.
TRIM is enabled by default. Although it is essential for good SSD performance, it also means that deleted files are usually impossible to recover, because the SSD erases the corresponding blocks soon after the file is deleted.
That is why, on an SSD, backups are your best protection against accidental deletion. Disabling TRIM can increase the chances of recovery, but it costs performance and adds wear, so we don’t recommend it.
To check whether TRIM is enabled, follow these steps:
- Type cmd in the Start menu.
- Right-click Command Prompt and select Run as administrator.
- Type the command
fsutil behavior query DisableDeleteNotify. - If the result shows DisableDeleteNotify = 0, TRIM is enabled.
If TRIM is disabled (DisableDeleteNotify = 1), turn it back on:
- Press Windows + X to open the Power User menu and select Command Prompt (Admin) or Terminal (Admin).
Type the commandfsutil behavior set DisableDeleteNotify 0to enable TRIM.
Method 2: Set the SATA controller to AHCI mode
On most computers, the SATA controller is already set to AHCI (Advanced Host Controller Interface) mode by default, because it works best with SSDs.
If your SATA SSD is running in IDE mode, switch the controller to AHCI in the BIOS/UEFI to get the best performance from it. (NVMe SSDs don’t use this setting.) Changing the mode without preparing Windows first can stop it from booting, so follow the steps in order.
To do this:
- Press Windows + R, type msconfig and press Enter.
- In the Boot tab, tick Safe boot, apply the changes and restart the computer.
- During start-up, press F2 or Del to enter the BIOS/UEFI settings and change the SATA mode from IDE to AHCI (if you can’t, disable Fast Boot and try again).
- Save the settings, exit and restart.
- Windows will start in Safe Mode. Run msconfig again, untick Safe boot in the Boot tab and restart your PC.
Method 3: Disable disk indexing
Indexing speeds up file searches on hard drives, but on an SSD you can disable it to reduce writes, since the SSD is already fast enough. Keep in mind that Windows searches may take a little longer.
To do so:
- Open This PC, right-click the SSD drive and select Properties.
- In the General tab, untick “Allow files on this drive to have contents indexed in addition to file properties”.
This disables disk indexing.
Method 4: Adjust the paging file
This method is only recommended if your computer has plenty of RAM. By setting the size of the paging file yourself, you can reduce how much Windows writes to the SSD. If your computer has little RAM, leave the paging file managed automatically.
To adjust the paging file:
- Right-click This PC and select Properties.
- Select Advanced system settings and then click Settings under Performance. In the Advanced tab, click Change under Virtual memory.
- In the window that opens, untick Automatically manage paging file size for all drives and select drive C: from the list.
- Choose Custom size and enter an initial size and a maximum size. Click Set and then OK to save the changes.
Read next
Conclusion
Unlike hard drives, SSDs don’t need defragmenting. Instead, it’s good practice to optimize them: keep TRIM enabled, make sure SATA SSDs run in AHCI mode, and, if it suits you, disable indexing and adjust the paging file.
Remember that with TRIM enabled, deleted files on an SSD are usually impossible to recover, so keeping up-to-date backups of your documents is the best way to protect yourself against accidental deletion and other data loss.
If you have lost files from your SSD, don’t worry: at Bot, we have more than two decades of experience in data recovery and can assess whether your data can be recovered.
What’s more, we have a Class 100 (ISO 5) cleanroom for cases that require opening the device, so it is handled safely.
We collect your device free of charge (islands not included), and the standard diagnosis is free, with results within 48 hours.
Start your recovery with us now and join the more than 200,000 cases we have handled!
