Defragmenting a UFS partition ?

From: Grant Ward <Grant.Ward_at_cssip.edu.au>
Date: Tue, 30 Nov 1999 19:40:01 +1030

Hi all,

Short version (executive summary :)

I was wondering if anyone knew of an easy way to defragment a UFS
partition (on DU4.0D, PWS500au) other than backing up, newfs'ing and
restoring (there's ~4.5Gb in 240,000 files so this method would be
rather lengthy).

Long version :

One of my users has discovered that their data disk says it is full
even though it isn't (it still had ~700Mb free when the command
failed) while he is creating a large tar file. Even root couldn't use
any more space (ie. not a min free space issue either). There are
thousands of inodes left too.

I suspect the problem is related to the high fragmentation on the
partition which I noticed during the fsck a few weeks ago when the
machine was rebooting after a crash. It was in double digits (>10%)
and in all my years administering Unix boxes, I've rarely seen more
than a couple of percent and normally under 1% - the same is the case
for a couple of local colleagues I checked my sanity with (Berkeley
FFS rules OK :)

We deleted a large quantity of data files (tens of 1000's of 4kb
files) and then tried creating the large tar file again. As we
deleted more files, we were able to get further and further. At the
end of this, fsck reports the fragmentation is down to 8.3%, and we
can create our large tar file until it fails (write failed, file
system is full), and this time we now have only ~400Mb free space
available instead of failing at 700Mb free. Still not satisfactory,
but we can "get to" 300Mb more of the space.

So I'm wondering if I could do even better if I could reduce the
fragmentation back to a reasonable level, or have I just missed
something incredibly obvious (easy to believe with all the other
things going through my mind at the moment) ?

Many thanks in advance.

Cheers, Grant.
 
Grant Ward ( Grant.Ward_at_cssip.edu.au )
Ph: +61 8 8302 3927 Mobile: +61 414 727 747
Fax: +61 8 8302 3124 Pager: 61414727747_at_sms.on.net
Received on Tue Nov 30 1999 - 09:11:55 NZDT

This archive was generated by hypermail 2.4.0 : Wed Nov 08 2023 - 11:53:40 NZDT