defragmentation in FreeBSD 4.11

Bob Johnson bob89 at eng.ufl.edu
Thu Jul 28 15:57:47 GMT 2005


Message: 6
Date: Thu, 28 Jul 2005 11:20:31 +0300
From: Victor Semionov <victor at vmpbg.com>
Subject: Re: defragmentation in FreeBSD 4.11
To: freebsd-questions at freebsd.org
Message-ID: <200507281120.31564.victor at vmpbg.com>
Content-Type: text/plain;  charset="windows-1251"


> > This is one of the things I find really hard to get Windows users to
> > understand.  They just won't believe that a company like Microsoft would
> > still be using a filesystem that needs defragmenting if it were possible
> > to design one that didn't.  I often wonder why myself - after all, they
> > must have put a fair amount of work into NTFS, which at least doesn't
> > seem to get corrupted in a power failure.  Did they make a trade-off I
> > don't understand, or is it just incompetence - or worse, a deal with
> > disk manufacturers to sell more disk?
> 

Microsoft used to claim that NTFS doesn't need defragmentation.  Compared to 
MSDOSFS, that's a reasonably accurate statement, but if you push it hard 
enough, it will still become fragmented.

> Why is it unnecessary to defragment UFS?
> 

In normal use, files never become fragmented enough to affect performance.  In 
a (loose) sense, files are intentionally fragmented in a controlled way so 
that fragmentation doesn't cause problems.  If you run fsck on a partition, 
you will typically see fragmentation levels of less than one percent.

Also, keep in mind that in the default formatting, a FreeBSD partition has 8% 
of the disk space withheld from normal users to help keep the disk from 
becoming so full the system can't operate, and it has the side effect of 
helping to prevent fragmentation as well.  It is why df can show a disk being 
as much as 108% full.  It is possible to make this space available for normal 
use if, for example, you are using a partition only for data storage and you 
want to squeeze every last bit of space out of it, but of course there will 
be some performance penalty as it starts to get full.  You can also adjust 
other disk parameters to optimize for your particular needs.  See tunefs(8).

If the disk gets close enough to full, the OS has no choice but to start 
fragmenting things.  Try to keep your disks less than about 90% full (that's 
a number I remember from somewhere -- it's just a guideline and not a firm 
limit).  My /home partition is 95% full according to df (which means it is 
actually a little under 90% full including the reserved capacity), and fsck 
shows 0.1% fragmentation.  Of course, it's a fairly big partition, so it 
still has over a gigabyte of free space.  Even the ISO CD images I downloaded 
a few days ago probably didn't get much fragmentation.  


- Bob


More information about the freebsd-questions mailing list