[vox-tech] solved puzzle: free du and df disagree about free disk space

David Hummel dhml at comcast.net
Tue Sep 21 19:02:41 PDT 2004


On Tue, Sep 21, 2004 at 06:29:31PM -0700, Karsten M. Self wrote:
> 
> on Tue, Sep 21, 2004 at 08:25:20AM -0700, Henry House (hajhouse at houseag.com) wrote:
> > 
> > As you can see from these transcripts, 'du' told me that I had used
> > less than 1 GB on this machine's /var, but according to 'df' there
> > was still no free space.
> 
> Moral Jr:  'du' and 'df' report different statistics.
> 
> 'df' reports the free space on disk.  'du' reports the utilization (in
> blocks) of detectectable files (by definition:  files which aren't,
> say, deleted but with handles held open by running processes).  Adding
> a third mix:  'ls' reports not the size-on-disk (used blocks) but
> actual data size within the file.

Here's a quick and dirty Perl script I wrote a while back to report the
accurate size of files and directories.  It uses stat() recursively.
I'm attaching it in case someone might find it useful.  Just call it
with your file/dir arguments (or none for the current directory).  It
seems to work pretty well (I'll rely on the Perl hackers in the group to
verify).

-David
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fsize.pl
Type: application/x-perl
Size: 1315 bytes
Desc: not available
Url : http://ns1.livepenguin.com/pipermail/vox-tech/attachments/20040921/e3b2d63a/fsize.bin


More information about the vox-tech mailing list