0

I believe df is reporting incorrect disk usage, as I have the following problem:

I deleted a few files to free up space, then run the following:

$ df -H

reports 7.7GB on Volume and 400MB available, however, running:

$ du -sh /

reports 3.8GB usage, on this volume. There is a loss of roughly 3.9GB.

I have ensured there are no opens files using $ lsof and also rebooted the server after deletion.

FYI - OS Version: Centos 6.5

I would appreciate it if you would be able to guide me or point me in the right direction. Thank you.

Robert
  • 111
  • 4

1 Answers1

1

This can happen if you have a lot of very small files; a file will take up at least as much space as a sector in the filesystem, even if it's actually smaller than that.

If f.e. your filesystem has a 1KB sector size and you have 1024 files of 1 byte each, they will take up 1 MB even if their actual size should be 1024 bytes.

This also happens for bigger files (their size is rounded to the nearest full sector), but it's usually harder to notice, because losing a few bytes on MB-sized files doesn't matter much; but if you have a lor of very small files, the wasted space can become a real nuisance.

Massimo
  • 68,714
  • 56
  • 196
  • 319
  • Okay, is there a quick way to detect this? any common directories you would expect these file to occupy? Thanks. As 3.8GB is significant. – Robert Sep 02 '14 at 21:24
  • 3
    du -hs takes this into account. Try it: `echo foo >bar; du -hs bar`. This reports a disk usage of 4k for me on the xfs I tried it on. – András Korn Sep 02 '14 at 21:28