Subject: Re: Bizarre "df" output on /dev/sd0g
To: None <port-mac68k@NetBSD.org>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: port-mac68k
Date: 02/23/2005 18:23:16
> [...]  But now, when I run "df" to see free space available, I see
> this bizarre output:

> radon# df -k
> Filesystem  1K-blocks     Used       Avail Capacity  Mounted on
> /dev/sd0a        339183   43467  278756         13%  /
> /dev/sd0g        276151 265395     -3052        101% /usr

Except for the peculiar botched column alignment, I see nothing
particularly bizarre there.

> I tried to "fsck" but it didn't solved the problem [...]
> What could be the reason of this negative output? :-S

If your "bizarre output" refers to the negative "Avail" figure and over
100% usage figure, the only real problem here is in your expectations.

FFS (v1, at least) behaves rather badly when it gets very close to full
(where how close "very close" is depends on a number of factors I don't
really understand).  So, for a long time (at least as far back as
4.3BSD, and I think before that), some percentage of the space has been
reserved.  Traditionally this was 10%; recently, I've seen indications
that 5% is used now (and indeed, the first line of output you give
matches that: 43467+278756 is almost exactly 95% of 339183).

Rather than make this space completely inaccessible, implementors
generally reserve it for root.  Processes running as non-root start
getting disk-full errors when they would otherwise have to eat into the
reserved space; processes running as root can run the filesystem right
up to *really* full.

Your "bizarre output" arises because df (or more precisely the FFS
implementation backing the statfs() call used by df) considers the
reserved space unavailable: it shows up in the total space figure, but
is neither "Used" nor "Avail", nor is it counted when computing the
"Capacity" percentage.

Thus, your /usr is "overfull": it's gone about three megabytes (3052K)
into its reserved space.  This is a problem only if either (a) non-root
users need to write to /usr or (b) the performance degradation that the
reserved space is trying to avoid matters for the most recently created
stuff.

/~\ The ASCII				der Mouse
\ / Ribbon Campaign
 X  Against HTML	       mouse@rodents.montreal.qc.ca
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B