Jeff Kinz jkinz at
Sat Mar 19 16:12:03 UTC 2005

On Fri, Mar 18, 2005 at 09:51:44PM +0100, Duncan Lithgow wrote:
> On Fri, 2005-03-18 at 15:03 -0500, Scot L. Harris wrote:
> > On Fri, 2005-03-18 at 14:55, Jesse Hawkins wrote:
> > > I am pretty new to linux, so this might be a
> > > rediculous question to some: Do you have/need to
> > > defrag a linux hard disk? If so, should I use included
> > > tools (and, if so, what are they) or should I
> > > purchase/download 3rd party programs.
> > > 
> > > I am using Fedora 3 on its own box (no dual-booting
> > > here folks).
> > No defrag needed.   Very common question.  :)
> Isn't it more a case of 'fragmentation is minimal' and 'performance cost
> is minimal' rather than 'defrag not needed'?

 2. Why don't I need to defrag Linux? (general knowledge question.)

_Most_ filesystem types of the last quarter-century have a designed-in
tendency to resist fragmentation, provided that they're not too close to
100% full. The only exceptions I know of -- filesystem types that lack
this feature -- are FAT, NTFS, and VMS's partitions. (Note that the VMS
design team were hired by Microsoft Corporation to write MS-Windows NT.)

The matter isn't very well documented, that I've seen. Here's one fellow
who discusses it:

Also this one:

"Utilities exist for such a purpose (look on, but
little purpose exists for them. Unix filesystems by their very nature
resist fragmentation very strongly. It is not uncommon for even a very
full, very heavily used filesystem to keep its fragmentation under 15%.
Also, because of advanced read-ahead, disk buffers, and file caches,
Unix also tends to be much less affected by fragmentation than, say, MS
Windows of any variety."

If you ever wish to manually defragment an ext2 partition anyway,
there's Stephen Tweedie "defrag" aka e2defrag tool, which you can get
here: See the Linux
System Administrator's Guide, .

However, defrag is old, is unmaintained, was always experimental, and is
very likely dangerous to your data. (If you do use it, it's vital that
you allow it to complete, or you will almost certainly lose data.)

Personally, I would much, much rather back up the filesystem (using a
file-by-file tool such as tar), confirm the integrity/completeness of my
backup, blow the original filesystem away, mkfs it again, and then put
the data back. _If_ fragmentation were a problem -- which it is not.

In other words, the only defragmenter I can properly recommend, if you
insist you need one, is mkfs (i.e., backup, destructive reconstruction
of the partition, and a restore operation).

"The only system which is truly secure, is one which is switched off
and unplugged, locked in a titanium lined safe, buried in a concrete
bunker, surrounded by nerve gas and very highly paid armed guards. Even
then, I wouldn't stake my life on it" - Gene Spafford 
(Good thing. the law of unintended consequences: A laptop, w/wireless
NIC and wake on "date" set in the BIOS)
Jeff Kinz, Emergent Research, Hudson, MA.

More information about the users mailing list