Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 15 Jun 1998 20:58:14 -0700 (PDT)
From:      Doug White <dwhite@gdi.uoregon.edu>
To:        Tim Gerchmez <fewtch@serv.net>
Cc:        questions@FreeBSD.ORG
Subject:   Re: Fragmentation?
Message-ID:  <Pine.BSF.3.96.980615205329.2150K-100000@gdi.uoregon.edu>
In-Reply-To: <3.0.5.32.19980612014516.007de260@mx.serv.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 12 Jun 1998, Tim Gerchmez wrote:

> Anyone have any idea how to defragment a FreeBSD partition?  I've noticed
> the fragmentation level of /usr steadily going up.  I know there are Linux
> versions of Defrag (assuming they'll only work on Linux partitions)... is
> there a FreeBSD version?  Thnx,

I'll get into the technicalities .. :)

The answer to the question is that you don't.  The filesystem FreeBSD
uses, the Unix or Fast File System, is designed to avoid fragmentation in
its basic design.  The filesystem spaces files out on the disk so that
files can be written contiguously, which is unlike FAT which just uses the
next available block.  UFS depends on there being blank space on the FS to
write new files to; it helps this by reserving 10% of the FS space off. 
(Root can override the restriction and use this space.)  

However, if the disk becomes full, the FS has trouble finding contiguous
blocks to write files in, so it has to fragment them. 

You can `de-fragment' the disk by backing everything up, newfs-ing the
disk, and restoring, which rewrites and reorganizes all the files.  

To prevent the problem, keep tabs on the `df' command.  If usage gets up
around 90% (depending on the size of the FS) you should clean things up.

Hoe this helps.

Doug White                              | University of Oregon  
Internet:  dwhite@resnet.uoregon.edu    | Residence Networking Assistant
http://gladstone.uoregon.edu/~dwhite    | Computer Science Major
NOTICE:  Make sure your mailer replies to dwhite@resnet or I won't get it! 


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.96.980615205329.2150K-100000>