Re: Ext2 defragmentation

Jamie Lokier (lkd@tantalophile.demon.co.uk)
Wed, 17 Nov 1999 18:37:18 +0100


TenThumbs wrote:
[about find /]
> I tried this with a 1G FAT16 partition and a 1G ext2 partition on IDE
> drives. While find on the FAT fs is faster than on the ext2 fs (the
> first time as well as subsequent times), the difference seems to be
> that ext2 is modifying access times and that data is being
> rewritten. The 2.2.12 kernel does this sub-optimally. Actually, it
> stinks. The head scurrying all over the disk makes a very disturbing
> sound.

It is mostly due to ext2's directory block allocation policy. Files are
allocated close together if they're in the same directory, but
directories are spread more or less randomly over the disk. I have a
program called "treescan" which tries to read in a better order. It's
faster but you still hear a lot of head activity. It's not particularly
random -- it seems even small seeks are noisy.

> I would think that optimizing disk writes would make most of the
> difference go away.

The writes makes some difference: the inodes do seem to get written back
in a bad order. You can see how much improvement is possible here by
mounting with `nodiratime'.

With 2.3.26 the inode write-backs don't seem so significant. (That's
100% subjective and unscientific).

-- Jamie

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/