7

Is there any defragmenter out there for ext3?

tshepang
  • 1,937
  • 3
  • 20
  • 35
user541686
  • 4,097
  • 10
  • 34
  • 49

3 Answers3

6

http://launchpad.net/e2defrag.

psusi
  • 37,033
  • 2
  • 68
  • 106
  • 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 02:18
  • @AlexS, also you can just build it from source. Untar, `./configure`, `make`, `sudo make install`. Have the build-essential package installed first. I forget if there were one or two others needed as well, but you should see them listed in the Depends: header of the debian/control file. – psusi Apr 19 '17 at 02:28
4

Shake

  • +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 01:03
  • 2
    Whilst this may theoretically answer the question, [it would be preferable](http://meta.stackexchange.com/q/8259) to include the essential parts of the answer here, and provide the link for reference. – nanofarad Aug 30 '12 at 18:34
1

There is a useful article but it's a few years old:
DEFRAGMENTING LINUX EXT3 FILESYSTEMS USING SHAKE AND DEFRAG

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.


Rinzwind
  • 293,910
  • 41
  • 570
  • 710