Although it has always been rumored that Linux filesystems, based primarily on versions of extend or other systems with journal such as JFS, ZFS, XFS or ReiserFS, do not require defragmentation, it is true that over time its operability becomes slower due to the dispersion of data. Although its impact is never as dramatic as in FAT and NTFS based systems, it is something we can easily fix within a system if we use a tool like e4defrag.
E4defrag is a utility that is available in most Linux distributions, including Ubuntu, within the package e2fsprogs. There are many others that operate similarly, but we have chosen this one for its ease of use. To be able to install it inside our system, all you have to do is invoke the following command:
sudo apt-get install e2fsprogs
Once the package is installed, we can invoke the utility from the command line if we execute the following statement:
sudo e4defrag -c
As a result we will get a screen like the following that indicates a fragmentation value of our unit. If this figure reaches a score above 30 it would be it is advisable to try to reduce it using the utility which we have indicated to you, and if it exceeds the value of 56 it will be necessary to act as soon as possible.
To defragment a drive we must invoke the application with the following sequence:
sudo e4defrag /ruta
Or this other if we want to act on an entire device:
sudo e4defrag /dev/device
As always, we remind you that it is recommended to disassemble the devices or units of your system on which you are going to act with this utility or something similar to prevent data corruption.
Finally, ors encourage you to leave your comments and tell us what this application has worked for you and if you have noticed any improvement in your computers after running it.