[plug] ext4 fragmentation

Brad Campbell brad at fnarfbargle.com
Mon Jun 19 03:44:48 AWST 2017

On 18/06/17 00:05, Alastair Irvine wrote:
> On Fri, 17 March, 2017 at 01:06:47PM +0800, Brad Campbell wrote:
>> G'day all,
>> I'm approaching my 6 yearly HD replacement on my bulk storage array.
>> Current array is 14 x 2TB drives in a RAID6 with an ext4 filesystem.
>> This array was re-built with a fresh format in 2013, so it has about
>> 4 years heavy use on the filesystem.
> [snip]
>> Having said that, the 1TB file copied across to the replacement
>> array was giving me ~900MB/s until I used e4defrag on it. Now it's
>> down to 500MB/s. So things are not perfect in defrag land.
> [snip]
> Hmm... seems like there might be a mismatch between your filesystem
> block size and your RAID chunk size.  Or something.
> Anyone who's deal with RAID at a more detailed level than I have may be
> able to expand on this.

N, I can assure you they are all set up correctly.

> Are you using software or hardware RAID?

Linux software RAID.

The issue (such as it is) relates to the way the defrag tool works. You 
let it loose on a file and it counts the extents. It then maps a new 
file the same size and if it has fewer extents it copies the data across 
and frees up the original.

This is all nice if you have a drive with plenty of free space, but I 
have a pretty full array with fragmented free space, so while the new 
file had fewer extents, they were further apart and caused a significant 
delay in seeking.

It was an interesting process tracking it all down, but at the end of 
the day e4defrag results can be variable depending on the state of the 

Dolphins are so intelligent that within a few weeks they can
train Americans to stand at the edge of the pool and throw them

More information about the plug mailing list