How to optimize / defrag ext4 filesystem Make sure the target filesystem is sane Open up the terminal and run: sudo fsck.ext4 -y -f -v /dev/<disk/partition>