Although it has always been a rumor that Linux file systems, based mainly on versions of extend or other systems with journal like JFS, ZFS, XFS or ReiserFS, they do not require defragmentation, it is true that over time its operation is slowing down due to the dispersion of data. Although its impact is never as dramatic as in FAT and NTFS based systems, it is something that we can easily solve within the 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 in a similar way, but we have chosen this for its ease of use. In order to install it within our system, it is only necessary to invoke the following command:
sudo apt-get install e2fsprogs
Once the package is installed, we can invoke the utility from the command line by executing the following statement:
sudo e4defrag -c
As a result we will obtain an image similar to the following one that indicates a fragmentation value of our unit. If this figure reaches a score higher than 30 it would be It is recommended to try to reduce it using the utility that we have indicated, and if it exceeds the value of 56 it will be necessary to act as soon as possible.

To defragment a unit we must invoke the application with the following sequence:
sudo e4defrag /ruta
Or this other one if we want to act on an entire device:
sudo e4defrag /dev/device
As always, we remind you that it is advisable to disassemble the devices or drives of your system on which you are going to act with this utility or a similar one to avoid data corruption.
Finally, theWe encourage you to leave your comments and tell us what This application has worked so well for you and if you have noticed any improvement in your computers after running it.