[ubuntu-uk] df and du give different results

Chris Rowson christopherrowson at gmail.com
Fri Jan 4 09:35:11 GMT 2008


>
> Chris
>
> I just got this response from another list:
>
> The df command will report all the available space on the disk , in other
> words it will report the number of blocks in the "free" list.
>
> The du command gives you and total number of blocks used by the directory
> that is passed to it as a parameter.
>
> The difference between the output is because du doesn't take into account
> the blocks taken by the directory itself, nor does it count the blocks used
> by the "special files" on the filesystem. Things like your device files etc.
>
> That is why du (in my experience) always reports less than df.
>
> Which is more or less what Alan said I think!
> HTH
>
> Stu

Hi again,

Thanks again for looking into it further for me.

I don't buy the 'the space is being used by filesystem itself or
device files etc' argument in this case though. It might account for
some space, but we're talking nearly half of the available filesystem
here (about 12 gig or so) just missing to du .....

I've got another Dapper server sat here too. This one does web-content
filtering and caching (squid and dansguardian) for up to 500 clients
and is always under a pretty heavy load. Running du and df on that box
doesn't show much of a difference in results to be honest.

Repeating the test on a CentOS test server running a LAMP environment
like the problematic one, again doesn't show anywere near as much as a
difference in results either!

To be honest, I can't recall being as stuck as this with any problem
in the past. I'd have ignored it by now, but the disk is at 98%
capacity according to df. Not good.... (especially when the people I
work with have a real downer on anything Linux too...)

Cheers

Chris



More information about the ubuntu-uk mailing list