# Server disk space, df not accurate [SOLVED]

## audiodef

I recently removed a large file from my server. After doing that, not only did df not show more free space, it showed LESS free space than before I deleted the file. 

I don't believe df is showing me anything accurate. What can I do, other than restarting my server, to fix this? I'm open to using something other than df as long as I can get accurate disk space reports.

EDIT:

I just tried df --total. How can rootfs take up 59% and the total be 58%? Does tmpfs (1% here) get subtracted from rootfs for the "total"?

EDIT 2:

df -i shows what I expect: around 25% usage. Why would df -h show me 59% usage? What is df --sync supposed to do (because it appears to do nothing for me)?

----------

## frostschutz

df -i is something else entirely, not about space, but inodes.

df is usually accurate. some things to consider are root reserves (ext* takes 5% of available space by default), hard links (space won't be freed until you deleted all hardlinks to the file), files still in use (space won't be freed until all processes that still use this file end), as well as files hidden by mounting - if you have a big file in /home/bigfile, and then mount another filesystem to /home, then /home/bigfile is hidden but still consumes space.

The only way for df to show a "wrong" value is if the filesystem is inconsistent somehow. Only in this case you need to umount and fsck. In all other cases you'll simply have to figure out what is using the space. Mount it exclusively (mount /dev/yourdevice /mnt/somewhere) so you won't have anything hidden by other mounts there, then check it out with du or whatever.

----------

## audiodef

Thanks for the explanation, frostschutz.   :Smile: 

I used du -chs to poke around, and found that /var/log had gotten out of control. I thought I had handled that with logrotate. I manually cleaned it up, and now disk usage is where it should be.

----------

