Users who are used to using Windows as an operating system are probably familiar with the terms fragment and defragment, as it is a utility widely used in the Microsoft operating system to improve its performance when using mechanical hard drives. That is why if we decide to switch to a Linux-based operating system, we may wonder whether we should also defragment our HDD to improve its performance over time.
This is something that can attract our attention because when we install Linux distros we will surely not find tools to defragment, although they do exist. This may indicate that we will not need much. We always speak from the perspective of a mechanical hard drive since SSD disks do not require defragmentation regardless of the operating system we use.
Hey Linux user, let’s talk about Fedora 35 and GNOME 41
Defragment a hard drive
If you have ever heard the term defragment, this refers to a process that is performed to order the files that are stored on the disk continuously. This happens especially in Windows , where when copying a file to the hard disk, it is not copied as is, but divided into several parts that fill in free spaces on the disk. To order these files defragmentation, thus the system to access files as quickly possible occurs. This action was especially recommended a few years ago, although today it has lost importance. This is due, above all, to the increasingly common use of SSD disks to the detriment of mechanical hard disks, which do not require this process to optimize their performance.

Defragment on Windows yes, on Linux no
Windows uses an file NTFS system , which messes up files when copying them, making it difficult to read and causing slower system performance over time. This makes it recommended to defragment every so often for HDDs to achieve that performance improvement when reorganizing files. This action is especially important on pre-Windows 7 operating systems.
For its part, Linux mainly uses an file system Ext2, Ext3 and Ext4 , which, although they also generate fragmentation, have a more efficient block allocation algorithm, causing fragmentation to be very scarce, so they remain The files are tidy and the system will not slow down frequently.

This means that the defragmentation task is not essentially necessary in this case, although if we wish we can carry it out. And, although we may consider that defragmenting a file system in Linux is unnecessary, the truth is that there are tools such as “e2freefrag”, “filefrag” or “e4defrag” that are in charge of checking disk fragmentation and that we can make use of them.
The defragmentation task can be carried out if we consider it appropriate, especially in cases where the hard disk is close to its full capacity or if we have been installing and uninstalling packages for a long time.