huge difference between du and df
Hi all,
I had a system (slack64 14.1) crash this morning and I couldn't start X on reboot. Turns out my / filesystem was full, as reported by df. So, trying to clear things up, I used du to find out where the bloat was. Unfortunately, du seemed to find a lot less used space than du reported. To be more specific, "du -xsh " showed 22G used while "df -h" showed 28G used. Since the filesystem was on lvm I was able to increase the volume size to solve my immediate problem, but the discrepancy between du and df still exists. I have run fsck on the root filesystem, which reports all okay. I have rebooted to ensure that no running processes could be still claiming deleted files. Never-the-less I still have this non-trivial discrepancy. Any ideas about how to research further? Thanks, Brian |
I assume that du does not account for the metadata associated with a file whereas df does.
|
Quote:
|
du reports allocated disk usage. df reports filesystem space available to a non-root user. df does not include reserved space as available.
|
Hello,
By default, 5% of disk space is reserved. 28-22=6 => 5%(X)=6G => X=120G -- SeB |
Quote:
|
That difference is almost always due to a huge deleted file still held open by some process, often a big log file. You can run (as root)
Code:
lsof | grep '(deleted)' | less If you have rebooted and still see the problem, then "fsck -f" on the filesystem is warranted. And, now that I see you've already done that, about the only remaining possibility is files hidden under an active mount point. Try this Code:
mkdir /tmp/tmpmnt |
Quote:
Code:
$ du -h ~ | grep -E "^[[:digit:]]+[G]" SeB |
Quote:
Brian |
So indeed there were 6 Gigs of files hiding under one of the mounts. Thank you rknichols for pointing to the solution. Thank you also phenixia for your efforts on my behalf. Now both df and du report 22G used, not even a discrepancy d/t reserved space.
Brian |
Quote:
binding the mount showed up that there was a local directory which had some used space and at some point of time this directory was mounted to some different disk partition, thus leaving behind the old data in the previous partition. |
"Better late than never" isn't always true.
|
All times are GMT -5. The time now is 02:26 PM. |