On Mon, 2002-06-24 at 18:23, Alexander Shaw wrote:
> Hey I was close, thanks for that.
> 
> So when exactly does it happen?
> > 
> > On Mon, 24 Jun 2002, Alexander Shaw wrote:
> > 
> > > I'm a fairly new Linux user and in a quiet moment I suddenly 
> > thought about
> > > defragmenting the drives on my RH 7.2 server. I did a search of 
> > the net and
> > > from what I have read am I correct in assuming that 
> > defragmentation is an
> > > integral part of the kernel and it happens automatically?
> > 
> > yup, although you're better off describing it as an integral part
> > of the ext2 filesystem.

The kernel does no defragging job, nor does the ext2 filesystem itself.
What really happens is that the ext2 filesystem is designed in such a
way as to prevent fragmentation from building up in the first place.

I'm not a filesystem hacker myself, but from what I've read I can tell
you that the system takes the following measures:

* When allocating disk space, the filesystem allocates several block at
once to increase the amount of contigous blocks belonging to a file.
Under light disk load conditions, there is no noticeable effect, but
under heavy disk load, when there are lots of processes requesting
filesystem space, it gets allocated more contiguosly to each file.

* When creating files, the filesystem code tries to spread them as
evenly as possible (within performance constraints) across the
filesystem space. This gives files room to grow contiguosly untill the
filesystem approaches 100% capacity.

Despite these measures, a filesystem can get fragmented. You can check
the fragmentation of a filesystem with 'e2fsck -n -f /dev/whatever'. If
you try it on a mounted filesystem, disregard the errors that will
appear, since they are meaningless on a mounted filesystem. Also note
that this takes a long time on large filesystems.

There is a tool to defrag ext2 filesystems whose name I don't remember
right now, but the techniques described above make it mostly unneeded.

Finally, make a note that these comments only apply to the ext2 and ext3
filesystems. Other filesystems behave differently.

I hope these helps you better understand the fragging issues in linux.

Cheers,
-- 
Javier Gostling
Ingeniero de Sistemas
Virtualia S.A.
[EMAIL PROTECTED]
Fono: +56 (2) 202-6264 x 130
Fax: +56 (2) 342-8763

Av. Kennedy 5757, of 1502
Las Condes
Santiago
Chile



_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to