[Techtalk] Different usage betweed df and du

Maria McKinley maria at shadlen.org
Wed Jul 13 16:01:43 EST 2005


 From the man page:

The du utility displays the file system block usage for each file 
argument and for each directory in the file hierarchy rooted in each 
directory argument.  If no file is specified, the block usage of the 
hierarchy rooted in the current directory is displayed.  If the -k flag 
is specified, the number of 1024-byte blocks used by the file is 
displayed, otherwise getbsize(3) is used to determine the preferred 
block size.  Partial numbers of blocks are rounded up.

So it looks like it does, but I agree, I can't see that alone accounting 
for this big a difference.

cheers,
maria

Mary wrote:
> On Tue, Jul 12, 2005, Maria McKinley wrote:
> 
>>df is usually pretty straightforward and looks for free space, ie. if it 
>>says, so much used on such a disk, I'd trust it.  du works by going 
>>through directories and adding up file sizes, so I'm guessing it is 
>>missing something somewhere.  I'm not sure if du looks at dot files, so 
>>maybe there is a .trash somewhere that is really full?
> 
> 
> Does du look at block sizes? If it doesn't that could mean a
> discrepency, because even if a file is 2 bytes long, an entire block of
> the filesystem will be unavailable so df will report it used.
> 
> Unless you have lots and lots and lots of tiny files though, I can't see
> that accounting for a 5x difference.
> 
> -Mary
> _______________________________________________
> Techtalk mailing list
> Techtalk at linuxchix.org
> http://linuxchix.org/cgi-bin/mailman/listinfo/techtalk


More information about the Techtalk mailing list