defragmentation in FreeBSD 4.11

Freminlins freminlins at gmail.com
Thu Jul 28 16:41:59 GMT 2005


On 7/28/05, Bob Johnson <bob89 at eng.ufl.edu> wrote:

> > 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.

Apparently UFS can get fragmented even when there is lots of
apparently free space:
http://blogs.sun.com/roller/page/sprakki?entry=ufs_file_system_defragmentation

Obviously this is Sun UFS, but there is a common heritage. I've never
needed to do any sort of defrag on either FreeBSD or Solaris though.

> - Bob

Frem.


More information about the freebsd-questions mailing list