What is defragmentation?
Whenever we use our computers, data needs to be read and written. The new data is written where the system finds enough free space. That means a single file can be chopped to pieces and written in different storage locations. With time, this can get very messy – very fragmented. If your computer has a hard drive, it can become slower when reading or writing. Then you need to put it back in order and defragment it – defragmentation.
Defragmentation is the process of organizing, moving back the data blocks together to form the complete files. It increases the efficiency of the system and you can feel the improved performance.
SSD and defragmentation
What if your computer is newer and you have an SSD? Don’t defragment it. It won’t make your memory work faster. It doesn’t have moving parts like the HDD and doesn’t last long even if the files are fragmented. Actually, defragmentation for SSDs is bad. It just shortens their life, because the SSD has a limited number of reading and writing cycles.
For storage optimization, SSD uses SSD TRIM, UNMAP or DEALLOCATE. TRIM informs the memory about which data blocks can be deleted because they are not in use anymore. UNMAP is similar, but for the SCSI and the last on the list is for NVMe SSDs.
Windows has had an automatic defragmentation function since the launch of Windows 7. If you want to, you can perform a manual defragmentation on Windows 10 the following way:
- Click on the Start Menu, type in “Defragment and Optimize Drives” and select it.
- Choose the hard discs that you want to optimize.
- If your computer hasn’t updated the information recently, click on Analyze.
- After the analysis ends, click on Optimize. Once the optimization finishes, the defragmentation process is completed.
If you are using a modern Apple computer, with software newer than 2002, you probably don’t need to defragment it manually. macOS has a built-in defragmentation tool, that kicks in when needed. The older HFS+ and the newer APFS file systems defrag on the fly.
If you really want to perform a defragmentation, create a backup, reinstall the OS and get your files back.
Most Linux distros also don’t need a defragmentation. They use ext4, or older ext3 and ext2 file systems that don’t need it. They have a different, intelligent data allocation that spreads the data and leaves free space. Problems start when you leave less than 20% free space on your hard disk. Just clean up some space and you are good to go.
Just like on the macOS, if you want to defrag, back up your files, format, and put back your files.