My Disk Space Doesn't Add Up!

Sometimes your disk usage does not add up - for example:

karl@someserver:~$ df -h /
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1        52G   49G  243M 100% /

So what gives? 49Gb + 248Mb is definitely less than 52Gb !! This is a sizeable discrepancy of at least 1.5 Gb!

Also, the percentage looks off: 49/52 =~ 94.2% - which is definitely not 100%!

The answer is simple: filesystem overhead : If you have a disk device of 52Gb, and put a file system on it, do not expect to write a 52Gb file to the resulting file system. By necessity, the file system itself will need disk space for:

  • keeping track of which disk blocks are free (or bad)
  • directory listings
  • file and directory metadata (ownership, permissions, modification times etc)
  • user disk quota management
  • journal - for crash recovery
  • space reserved for the root user - usually 5% (this is not included in the "used" amount)

The above is true for the most commonly used file system: ext4. Other file systems vary, but they will all have some overhead.