Is there any defragmenter out there for ext3?

  • 4
    Linux doesn't need...oh. Well, never mind :) – triplethreat78 Jan 12 '11 at 1:21
  • @DJTripleThreat: Where's the dislike button... – user541686 Jan 12 '11 at 1:23
  • Desktop PCs do not need defragmentation, not even on Windows. It's the snake oil of the digital age. And this is not a lecture. :) – nem75 Jul 30 '12 at 16:00


| improve this answer | |
  • How is e2defrag compared to Shake? – Alex S Apr 15 '17 at 11:43
  • 1
    @AlexS, shake just copies files until they luckily happen to end up with no or few fragments thanks to the normal allocation algorithms. e2defrag runs on an unmounted volume and relocates every block on the disk so that they are all packed to the left ( within their native block group by default ), and are in the natural inode order of the files. As a result, it also maximizes the contiguous free space for new files to avoid fragmentation. – psusi Apr 17 '17 at 14:58
  • So, e2defrag would be the best option for Ext3 partitions for now. While e4defrag does Ext4 better, if it support Ext3 we'd have something better? – Alex S Apr 17 '17 at 16:23
  • How do I install it in Linux Mint (13/ 14 or 18/18.1)? I've typically downloaded .debs and used GDebi and am unable to have xenial etc get added on it – Alex S Apr 17 '17 at 16:45
  • @AlexS, e2defrag works on ext4 as well ( unless you have a big enough disk to need the 64 bit feature ). I believe that e4defrag works by moving individual files around to defrag them similar to shake, without regard for packing them to make more contiguous free space. On the other hand, it does work with the filesystem mounted, and a crash or power failure while it runs won't leave your whole filesystem trashed ( backup before using e2defrag ). – psusi Apr 19 '17 at 2:18


| improve this answer | |
  • +1, interesting... so, reading that page, is it true that Linux has no native support for defragmentation like Windows does (with FSCTL_GET_RETRIEVAL_POINTERS)? – user541686 Jan 11 '11 at 23:23
  • It is currently in development. Google for e4defrag. – psusi Jan 12 '11 at 1:03
  • 2
    Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference. – nanofarad Aug 30 '12 at 18:34

There is a useful article but it's a few years old:

There are a few tools for this, and I'm going to cover Shake and Defrag.

  1. Shake is a defragmenter that runs in userspace, without the need of patching the kernel and while the system is used (for now, on GNU/Linux only).

It works by rewriting fragmented files. But it has some heuristics that could make it more efficient than other tools, including defrag and, maybe, xfs_fsr.

  1. Defrag is a shell script. Download the latest version from HERE.

Using Defrag is very easy: copy the script in a folder you want to defragment. This can be just a normal folder or the top level directory of a partition.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.