Re: [bug?] df and du -s output inconsistent?
Mark Ferlatte <ferlatte@rescomp.berkeley.edu> writes:
> On Thu, Mar 09, 2000 at 09:24:41AM +0900, Olaf Meeuwissen spoke, and we
> listened to:
> > There is something funny about the output of df and du -s. Just take
> > a look at the typescript below:
> >
> > bash-2.03$ df /home
> > Filesystem 1k-blocks Used Available Use% Mounted on
> > /dev/hda7 2058900 1652232 300239 85% /home
> > bash-2.03$ du -s /home
> > 661643 /home
> >
> > According to df about 1.6Gb of the /home partition are used whereas du
> > -s says it about 1Gb less. Who's wrong? Or am I missing something?
>
> Some programs will open a tmp file and unlink it so that other
> processes won't mess with it. (Think of it as an anonymous file
> that gets cleaned up when the process closes it or dies).
>
> du won't show these files, because it queries file by file. Since
> these files don't exist within the directory tree, du doesn't find
> them and count them. df queries the filesystem to determine how
> much space is left, and does count the space used by these files.
Fine, that explanation makes sense, at least enough to swallow it :-)
> Basically, to reclaim that disk, you need to find the process that
> is using the anonymous file, and kill it. Or you can just reboot,
> which should clear it out.
Uhm, thing is, the data above are from this morning, right after I
booted my system. Any processes that created an `anonymous' file
yesterday are not running today.
--
Olaf Meeuwissen Epson Kowa Corporation, Research and Development
Reply to: