determine ufs2 %fragmentation on mounted filesystem

Nathan Kinkade nkinkade at
Wed Feb 9 09:31:01 PST 2005

On Wed, Feb 09, 2005 at 09:10:39AM -0800, Kris Kennaway wrote:
> On Wed, Feb 09, 2005 at 10:34:33AM -0600, Nathan Kinkade wrote:
> > Does anyone know of a way to determine the %fragmentation on a mounted
> > UFS2 filesystem?  An entry showed up in messages yesterday stating that
> > /usr has moved from time to space optimization yet the filesystem is
> > only at about 25% of it's capacity.  From what I can read it seems that
> > the kernel might also make this switch if fragmentation becomes
> > excessive.  However, this is a busy production machine running Squid, so
> > I can't conveniently umount /usr.
> Try dumpfs(8).
> Kris

I had already tried dumpfs, but couldn't find any information about
actual filesystem fragmentation in the output.  Erik's suggestion of
running `# fsck -t ufs2 /usr` seemed to work, though I felt a little
skittish about running it on a live filesystem.  It found numerous
errors and auto-answered "no" for all of them, though I never specified
that it should do that.  Does fsck just do this by default on a mounted
filesystem?  Also, I had tried running fsck manually earlier and the
only difference between what I did and Erik's suggestion was the -t
option, which I wouldn't think should have been necessary.  Shouldn't
fsck be able to determine the fs type by looking at the superblock?

By the way, the fragmentation was as 5.1%.  Quite high, and I'm
wondering how it got that way?  Squid?

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url :

More information about the freebsd-questions mailing list