64

Possible Duplicate:
Why is there a discrepancy in disk usage reported by df and du?

df says 8.9G used by the partition mounted in /

:~$ df -h Filesystem Size Used Avail Use% Mounted on /dev/sda5 227G 8.9G 207G 5% / 

However, a du in / yields a much smaller number.

:~# du -chs / 5.5G / 5.5G total 

I was expecting a smaller number, but why is to so much smaller?

1
  • Which OS/filesystem? Just "UNIX" isn't very .. precise. Commented Aug 17, 2012 at 23:49

2 Answers 2

43

Take a look at du vs. df difference

Here is a more thorough explanation: http://linuxshellaccount.blogspot.com/2008/12/why-du-and-df-display-different-values.html

Basically, df reads the superblock only and trusts it completely. du reads each object and sums them up.

Also, a running process can keep a deleted file open. This means the space will still be reserved and seen by df, but since du will no longer see a reference to that file in the directory tree, it cannot see those reserved blocks.

1
  • The page you link to is wrong. du shows block usage by default, not file size. You have to do du -b or du --apparent-size to get the effect you describe. Commented Aug 18, 2012 at 3:55
5

Probably df is accounting for all the space allocated for inodes and other administrative overhead, whereas du is just accounting for the space used by the files.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.