lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  PHC 
Open Source and information security mailing list archives
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 9 Jul 2012 12:16:11 -0400
From:	Greg Freemyer <>
To:	Phillip Susi <>
Cc:	Andreas Dilger <>,
	ext4 development <>
Subject: Re: e2defrag 0.81 released

On Sat, Jul 7, 2012 at 10:53 AM, Phillip Susi <> wrote:
> Hash: SHA1
> On 07/07/2012 02:02 AM, Andreas Dilger wrote:
>> I hate to rain on your parade, but, are you aware of e4defrag?
> Of course.  I started working on e2fsprogs two years ago though, when e4defrag was still on the drawing board, and just haven't gotten around to polishing and announcing it until now.

e4defrag has been around more than 2 years.  It's been at least 2
years since I did a code review of how it works.

> My understanding of e4defrag is that it works essentially like tools such as shake: find a fragmented file and copy it, hoping the copy will be less fragmented.  Thus, it does nothing for free space fragmentation, file locality, etc.  Plus, it doesn't have cool ansi graphics ;)

More or less true except iirc the process is more like:

find a fragmented file.
fallocate a new donor file with uninitialized data blocks..  (ie. data
blocks get assigned, but not written to.)
if new donor file is less fragmented than orig file:
   copy data from orig_blocks to donor_blocks
   swap donor blocks with original blocks at the inode level.
end if
delete donor

At a minimum I think e4defrag should work better with sparse files and
defrag each block group separately.

Also it used to hold the file lock for the entire time the copy data /
swap donor blocks operation took place.  For a large file that could
be a very long time.  I don't know if that was ever made less
intrusive or not.  ie. defragging a 100 GB file used to require
putting a i/o lock in place for the entire time it took to copy that
100GB of blocks to the donor blocks.

Of course, even that is better than having to unmount the filesystem
like you new tool apparently requires.

>> It is already in e2fsprogs, and can be used on a mounted ext4 filesystem...
>> It also needs some lovin' to make it really robust, but would definitely
>> be a better starting point than the ancient e2defrag code...
>> That's why it is always a good idea to post to the mailing list _before_
>> you start on a project, to see what else is going on...  Definitely there
>> is a need for such a tool, but I hate to see effort being spent in two
>> different directions to make two so-so tools, when it could be going in
>> the same direction to make one excellent tool.
> I'm hoping that eventually e4defrag will be able to do everything e2defrag can, and not too much slower, but for the moment, e2defrag already works, and I haven't seen any indication that e4defrag is planned to do free space defragging and file packing.  Perhaps having a little friendly competition will change that.

I think you're right e4defrag userspace code ignores consolidating
freespace to make bigger extents possible and I don't think userspace
has any file packing specific knowledge.

Does fallocate itself assist with either?

ie. since e4defrag uses fallocate to allocate the donor file blocks,
logically it would make sense to add the intelligence you are looking
for into fallocate.  And hopefully it is already there.

To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to
More majordomo info at

Powered by blists - more mailing lists