Subject: Re: 'df' not reporting correct disk usage
To: Brian C. Grayson <bgrayson@marvin.ece.utexas.edu>
From: Chris Foote <chris@senet.com.au>
List: netbsd-users
Date: 07/18/1998 14:13:43
On Fri, 17 Jul 1998, Brian C. Grayson wrote:

> > i.e. df reports an additional 47MB of disk space in use than there
> > really is.
> 
>   Have you recently deleted a bunch of stuff on this partition?  

Sure did - I moved a stack of files to the /usr partition in order to free
up some room because /var/log & /var/spool/mqueue were chewing up a bit.
One of the things I did was to link /var/account to /usr/var/account.
Looks like kernel process accounting was the culprit.

> In
> particular, did you delete files (i.e. binaries) that were open
> at the time, like a make install?  If so, the kernel doesn't
> _actually_ delete them until they are finally
> closed/not-being-used.  Thus, one could fill up one's root
> partition by doing something like the following, I believe:
> 
>   ## Assume / has 10MB free, and
>   ## netscape is a 10MB executable.
>   cp /usr/local/bin/netscape /
>   /netscape &
>   rm /netscape
> 
>   At this point, du will say you still have 10MB free, but df
> will say you are at 100%.  If you now try to use any disk space
> on /, it'll fail, until you kill the running netscape,
> at which point the disk _really_ no longer needs to hold the
> backing store for /netscape, so the blocks are deallocated.
> 
>   Make sense?  I'd bet that if you rebooted, df and du would
> agree.  If not, then maybe there _really is_ a bug, but I'm
> skeptical....  :)

Yes, the space was reclaimed after a reboot:
mrtg:~\:# df
Filesystem  1K-blocks     Used    Avail Capacity  Mounted on
/dev/wd0a       84327    27220    52890    34%    /
/dev/wd0e     1782683   954568   738980    56%    /usr
kernfs              1        1        0   100%    /kern


Thanks for the help :-)


Cheers,

Chris Foote                        SE Net
Technical Manager                  222 Grote Street
SE Network Access                  Adelaide SA 5000
e-mail chris@senet.com.au          Australia
phone :  (08) 8221 5221	           PGP Public Key available from
fax:     (08) 8221 5220            http://www.senet.com.au/PGP
support: (08) 8221 5792