# Where is e4defrag?

## Cazzantonio

I was trying out ext4 filesystem with kernel 2.6.28. I successfully converted an old ext3 fs to ext4 and I was searching for e4defrag to test online defragmentation (and to convert all files to use extents).

I have the latest version of e2fsprogs (1.41.3) and still can't find the e4defrag tool that is used to defragment an ext4 fs.

Where can I get it?

----------

## GODhack

I think you need version from git to get this.

----------

## sleipner

 :Wink: 

```

wget http://www.kernel.org/pub/linux/kernel/people/tytso/ext4-patches/LATEST/broken-out.tar.bz2

tar -xjf broken-out.tar.bz2 broken-out/defrag-09-online-defrag-command

tail -n+18 broken-out/defrag-09-online-defrag-command > e4defrag.c

gcc -Wall e4defrag.c -o e4defrag

```

----------

## Cazzantonio

That "broken-out" scares me... I think I'll wait patiently to see it in e2fsprogs   :Smile: 

----------

## Gusar

 *Cazzantonio wrote:*   

> That "broken-out" scares me... I think I'll wait patiently to see it in e2fsprogs  

 Broken-out means each change is in a separate patch instead of one huge patch that contains everything.

----------

## chris...

i tried the above and ran e4defrag on a directory

```
        Success:                        [ 0/26 ]

        Failure:                        [ 26/26 ]

```

----------

## sleipner

it's really old stuff there..

you could try to build it from kernel.org git. there is more up to date patches for ext4 stuff anyway.

----------

## chris...

where is this new stuff?

----------

## sleipner

http://git.kernel.org/?p=fs/ext2/ext4-patch-queue.git;a=tree

----------

## chris...

looks to complex right now,

so defrag isnt in the current kernel?

i need more then just some application?

----------

## drescherjm

I do not believe that defrag it went into 2.6.29 although it may be be in 2.6.30. I know it was not in 2.6.28 unless backported.

----------

## chris...

any update on this?

----------

## drescherjm

Still not ready. 

https://bugs.launchpad.net/ubuntu/+bug/321528

Theodore Ts'o is the developer of ext4

----------

