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 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 can make us 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.

HDD in Linux, is it necessary to defragment

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 sort these files , defragmentation takes place, thereby enabling 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.

Desfragmentar HDD externo W10

Defragment on Windows yes, on Linux no

Windows uses an NTFS file system, which clutters files when copied, making it difficult to read and causing slower system performance over time. This means that it is 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 Ext2, Ext3 and Ext4 file system, 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.

Desfragmentar

This means that the defragmentation task is not essentially necessary in this case, although if we wish we can carry it out. And it is that, although we can consider that defragmenting a file system in Linux is something 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.