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 /
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.