If you’re struggling with a slow hard drive, you may have seen advice to “defrag” your hard drive. Defragging, short for defragmenting, is a process of shuffling the location of data on your hard drive to a more efficient layout and can result in a reasonable read and write speed improvement.
When first using a hard-drive data is written from the top down. At some point though, some data will be deleted, leaving a blank spot on the hard drive. The next time data is written to the drive, this hole will be filled, but if the file is too big, it will be split to also use the next available space. Over time this leads to many files being split multiple times all over the hard drive. This can cause noticeable performance decreases in HDDs. This is because the read-write head has to move to the new position for each section and the platter has to spin to the right location to start reading.
Defragmenting the hard drive simply shuffles data around to ensure that all files are in contiguous blocks of memory rather than split in fragments across the disk. This also results in a single empty space being left at the end of the disk for new data to be written to. Defragging a drive can result in both faster read and write speeds.
You may also have seen warnings not to defrag SSDs. These warnings are correct, defragging an SSD can significantly reduce its lifespan as the extra writes will help to wear it out. On top of this, as SSDs don’t have moving parts, there’s almost no performance penalty for having fragmented files and so no performance benefit to defragging them. Windows 8, 8.1, and 10 prevent you from defragging SSDs, so you don’t need to worry about doing this by accident.
How to defrag a hard drive
To defrag your hard drive, open the “Optimize Drives” app by pressing the Windows key, typing “Defragment and Optimize Drives” and hitting enter.
Next, simply select the drive you want to defrag, and click “Optimize”. You may have to provide administrative permissions for it to proceed.
Tip: Depending on the size of the drive and how much data needs to be moved, the process can take a long time, potentially more than an hour.
Tip: If you select an SSD and click “Optimise” it will instead perform a drive trim. This explicitly deletes data marked for deletion, which can improve write speeds. The process generally only takes a few seconds.