Did You Know? : Defragmentation

black internal hdd on black surface

Years ago when your computer would become slow someone who ‘did’ computers would say ‘Defrag it!’ Don’t do this anymore…

The TLDR here is that generally modern computers utilize SSD or some form of solid-state storage, which no longer requires a defrag every so often.

Computers store data on storage medium. It used to be the common and economical choice to utilize spinning disks or Hard-Disk Drives (HDDs) to store data. Essentially, platters made of aluminum, magnesium, or a similar substance would spin inside a ~3.5″ enclosure and a ‘head’ would pivot back and forth reading and writing data.

silver hard drive interals
Photo by Pixabay on Pexels.com

The HDD head moved from the inner most position to the outer most position creating a really dense spiral. Ideally, data would be most efficiently written on the ‘spiral’, where all related information about a file is directly adjacent to each other. Without spending too much time on the minute details, data written to HDDs rarely follows the spiral. Other pieces of files might be occupying nearby ‘sectors’ or for some reason the HDD was unable to write data in a ‘straight’ line. Over time it is inevitable that the data on the HDD becomes fragmented, ie: data is spread out on the HDD. When this happens, the HDD head has to pivot to multiple positions and wait for the platters to spin to the appropriate spot to read the next sector of data. This doesn’t take a lot of time initially; however, when a lot of data becomes fragmented it becomes very noticeable.

Defragmentation (defrag) is the process of reorganizing data so that related files’ information becomes adjacent to each other. It effectively tries to move data around on the platters so that (as best as it can) the data aligns to the ‘spiral’.

If you still use a traditional HDD then you may need to defrag your drive every so often; however, you should never do this on solid-state storage (SSD / NVMe). SSDs don’t use spinning platters; they store data on flash chips, which are significantly faster to access. The speed increase is so dramatic that even if data is non-contiguous the practical impact to the user is less noticeable. Additionally, SSDs are rated for a number of read/write actions, and needlessly defragmenting an SSD will impact the overall lifespan of the drive.

Modern implementations of ‘Defrag’ on Windows 10 and Windows 11 restrict SSDs from being affected by the defragmentation process, instead opting for an ‘Optimize’ process. This optimize process is called ‘Trim’ and it marks areas of the SSD that used to store files that have been deleted as empty so that new data can be stored there. This helps with preserving the life of the SSD.

It is unlikely that you will easily be able to defrag an SSD, but older defrag programs could still allow it. You shouldn’t do it unless you have a HDD. Now you know.