Take the 2-minute tour ×
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 Duplicates:
linux free disk space confusion
Why is there a discrepancy in disk usage reported by df and du?

df -h says that I have 494G used on /var:

Filesystem            Size  Used Avail Use% Mounted on
/dev/sda3             564G  494G   41G  93% /var

But du -sh /var says it's 350G

What makes them different?

share|improve this question

marked as duplicate by Caleb, Gilles, Michael Mrozek Aug 3 '11 at 18:28

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.

2 Answers 2

up vote 4 down vote accepted

du looks at files, while df looks at the filesystem. If you have a small or empty file, du knows the real file size by really looking into it, while df will see that the file has some size, depending on the "block size" that was set when the partition was created. The block size determines the minimum size of files on the filesystem. While there maybe other causes, I think this is the most obvious difference between df and du.

See also How do I determine the block size of an ext3 partition on Linux?

share|improve this answer
    
Wrong. Both use the number of blocks by default. –  Mikel Aug 18 '12 at 4:08

Most of the filesystems ufs, reiser, ext2, ext3, and ext4 (there may be others) have a reserve of a given percentage of disk to be use exclusively by the root userid. This is basically a safety valve allowing the root users or root processes to continue to use disk when things get close on disk while denying the supposedly less important non-root users.

On ext2, and ext3, I believe that the default reservation is 5%, much too high with the sizes of partitions these days. What I usually do is this to my ext filesystems:

 tune2fs -m 1 /dev/sda3

This is generally safe to change while the disk is mounted. However, you might have to remount the disk to make it effective immediately.

share|improve this answer

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