Open up the terminal and run:
sudo fsck.ext4 -y -f -v /dev/<disk/partition>
sudo fsck.ext4 -y -f -v -D /dev/<disk/partition>
Done. Note : Pass 3A: Optimizing directories.
It also (almost always) reports :
****** FILE SYSTEM WAS MODIFIED *****
Don't panic, as long the previous 'fsck' went off without a hitch, all should be golden. Run the 'fsck' (Without '-D' option) once more sometimes just to see how much it optimized.
Mount your filesystem now.
(Right-click on your disk on the desktop or wherever and 'mount')
After mounting:
sudo e4defrag -v /dev/<disk/partition>
Now, unmount again with :
sudo umount /dev/<disk/partition> && cd /
Finally to check fragmentation stats:
sudo fsck.ext4 -y -f -v /dev/<disk/partition>
Links