Sign up ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

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?

share|improve this question

migrated from Aug 18 '12 at 2:35

This question came from our site for professional and enthusiast programmers.

marked as duplicate by Mikel, Renan, Michael Mrozek Aug 18 '12 at 11:11

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

Which OS/filesystem? Just "UNIX" isn't very .. precise. – pst Aug 17 '12 at 23:49

2 Answers 2

Take a look at du vs. df difference

Here is a more thorough explanation:

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.

share|improve this answer
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. – Mikel Aug 18 '12 at 3:55

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.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.