[ubuntu-uk] df and du give different results

Stuart Bird e_tective at yahoo.co.uk
Thu Jan 3 21:06:09 GMT 2008


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!

----- Original Message ----
From: Chris Rowson <christopherrowson at gmail.com>
To: British Ubuntu Talk <ubuntu-uk at lists.ubuntu.com>
Sent: Thursday, 3 January, 2008 8:18:42 PM
Subject: Re: [ubuntu-uk] df and du give different results

> Chris
> I have just done some testing as promised with the hidden trash
 folder on my
> ntfs drive and found that both df -h and du -hs /* did not report the
> changes in file sizes on the /media volume until I manually deleted
> files from it (therefore it would appear that both commands respond
> changes in hidden files at least when files are deleted from them).
> they were consistently 0.9 Gb adrift in the sizes they were reporting
> despite the fact that the folder I was using for testing was a little
> 300 Mb.
> I am going to do some more testing as this happens to have some
 bearing on
> my line of work. I will post back if I come up with anything
> significant/relevant/interesting.
> If anyone out there can provide a full explanation of why/how this
 occurs I
> would be very interested. I am sad enough that I find this kind of
> fascinating :-)
> I hope you resolve your issue soon.
> Stu
Thanks for that Stu,


ubuntu-uk at lists.ubuntu.com

Sent from Yahoo! Mail - a smarter inbox http://uk.mail.yahoo.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://lists.ubuntu.com/archives/ubuntu-uk/attachments/20080103/85bbd32d/attachment-0001.htm 

More information about the ubuntu-uk mailing list