Discrepancy df/du

Howzit Folks?

I get the following results for various commands and can’t figure out what is causing the discrepancy:

df -h /
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 2.0G 2.0G 0 100% /

du -hx --max-depth=1 /
0 /proc
12K /mnt
20K /tmp
4.0K /opt
14M /sbin
0 /sys
14K /media
4.0K /selinux
4.0K /srv
4.0K /winsys
4.0K /var
4.0K /usr
4.0K /home
0 /dev
8.1M /bin
258M /lib
18M /lib64
44M /boot
16K /lost+found
24M /root
44M /etc
408M /

Can anyone tell me why there is a difference of 1640 MB between the 2 commands for the root partition?


One reports the file actual size the other reports the sector byte usage whether or not the file takes up the full sector.

Amounting to being out by a factor of 5…


You could try the --apparent-size flag.

Sure if a lot of files are just over the modulus of the basic block size you can have tons of wasted space.

Is this on a running system? Is the condition persistent?

One possibility is that there is a file still being held open by a process, but which has been deleted. The blocks are still in use, but the file cannot be found by du. When the process exits the blocks are reclaimed.