Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 26 May 1999 18:59:35 -0700
From:      Graeme Tait <graeme@echidna.com>
To:        freebsd-hackers@freebsd.org
Cc:        info@boatbooks.com
Subject:   File system gets too fragmented ???
Message-ID:  <374CA707.6FB5@echidna.com>

next in thread | raw e-mail | index | archive | help
I previously posted to 'questions' about a filesystem that was reported 
full when df -ik showed plenty of space remaining, but got no useful 
answers, so I'm hoping this list can offer some assistance.


[Please respond to me directly, as I'm not subscribed here.]


The filesystem is built with 4096 byte blocks, 512 byte fragments, and
2048 bytes/inode, and is mounted 'async noatime'.

It contains about 900,000 files, most of which are small, occupying
around 2-5 fragments. The small files are updated monthly from a tar
archive generated offline. In the course of updates, some files may grow
or shrink by a fragment or so, and some new files are created, and 
periodically old files are deleted.

Apparently over many months of this, the filesystem became badly
fragmented. I'm guessing that when larger files are written, FreeBSD
looks for intact blocks to use, but of the around 600MB df -ik reported
as "Avail", only about 300MB were in a form it wanted to use for a large
files. It was in creating large files that I found the problem with
"missing" filespace. With the filesystem reported full, 'df -ik' showed

Filesystem  1K-blocks     Used    Avail Capacity iused   ifree  %iused

/dev/da1s1f   3563104  2941142   336913    90%  908255  733055    55%

Presumably more space could have been utilized if small files were being
written.


I "cured" the problem by archiving, deleting and restoring first 10%,
then another 10% of the small files. fsck -n now reports:

906229 files, 5827112 used, 1299096 free (366048 frags, 116631 blocks,
5.1% fragmentation)

There were 441481 frags after the first 10% were deleted and restored; I
didn't think to look at this data before the first delete. It's now
possible to write large files that utilize all available space.


However, I don't understand how the FFS works, so I'm just probing and
guessing as to what's going on here.

Could someone please shed a little light on this? Is FreeBSD not able to
self-manage a filesystem operated in this way? Is there some way of
preventing the problem, or of periodically cleaning things up (rebuilding
the whole filesystem from backup means being down for over an hour on a
24x7 server)?

The procedure of deleting and restoring a portion of the files was done 
as an emergency measure - I would prefer not to have to resort to that 
routinely.


-- 
Graeme Tait - Echidna



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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?374CA707.6FB5>