If we have a HDD in Linux, is it necessary to defragment?

If we have a HDD in Linux, is it necessary to defragment?

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 if 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.

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 on 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 found on the disk. For sort these files defragmentation occurs, thereby allowing the system to access the files as quickly as possible. 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.

Read:  Choose your next Linux thanks to the advantages of virtual machines

Defragment W10 External HDD

Defragment on Windows yes, on Linux no

Windows uses a file system NTFS, which clutters the files when copying it, making it difficult to read and causing a lower performance of the system 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 primarily uses a file system Ext2, Ext3 and Ext4, which, despite the fact that they also generate fragmentation, have a more efficient block allocation algorithm, causing fragmentation to be very low, so the files are kept in order and the system is not going to slow down frequently.


This means that the defragmentation task 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.