[ale] ext2fs and non-fragmentation

Danny Cox danscox at mindspring.com
Thu May 30 07:32:33 EDT 2002


Steve,

On Thu, 2002-05-30 at 07:03, sangell at nan.net wrote:
> Anyone know of a good site that explains in detail the how ext2fs avoids
> fragmenting disks, (or maybe you can explain it yourself). I am trying to
> replace some more MS servers and was asked the question in a meeting
> yesterday, "How does linux avoid fragmenting drives?" and to be quite
> honest I couldn't answer, and to some "It just doesn't!" is not a
> sufficient answer. I tried a few searches on google but the previous answer
> was about all I could find.

	One main concept works on the idea of allocating inodes/data within
"cylinder groups", keeping the data and meta data together.  When
growing a file, if it can find the necessary room in the current
cylinder group, it uses that.  Only when it's full does it change to
another, which becomes the "current" cylinder group for the next
allocation.

	It *does* eventually fragment badly, but only when the FS is 95% (or
some magic percentage), and then it *really* slows down.  That's why 10%
(or 5%) is only reserved for root.  Normal users can't use that last
little bit to really slow the system down.

	So, the answer is: certainly files are fragmented, but usually within
one cylinder group, so next-block-lookup is still fast, and doesn't move
the head assembly too much.

	As to where I saw this, it was long ago, in a collection of papers on
BSD.  The paper was entitled something like "Implementation of the (a)
Fast File System" or "The Berkely Fast File System".  So, looking on the
various BSD sites may get you further.

	If you can get him to respond, contact Ted Tso (see the MAINTAINERS
file in /usr/src/linux), and he may point you to some useful
information.  Then again, he may not. ;-)

-- 
kernel, n.: A part of an operating system that preserves the
medieval traditions of sorcery and black art.

Danny


---
This message has been sent through the ALE general discussion list.
See http://www.ale.org/mailing-lists.shtml for more info. Problems should be 
sent to listmaster at ale dot org.






More information about the Ale mailing list