df -h showing wrong output in GB

Posted by Anurag Uniyal on Super User See other posts from Super User or by Anurag Uniyal
Published on 2012-11-02T16:04:09Z Indexed on 2012/11/03 11:06 UTC
Read the original article Hit count: 392

Filed under:
|
|

If I list df output for KB, MB and GB, they do not match e.g.

$ df -k |grep xvdb
/dev/xvdb1            12796048    732812  11413172   7% /xxx
$ df -m |grep xvdb
/dev/xvdb1               12497       716     11146   7% /xxx
$ df -h |grep xvdb
/dev/xvdb1             13G  716M   11G   7% /xxx
  • 12796048 KB = 12496.14 MB so that is slight off but OK
  • 12796048 KB = 12.2 GB, 12407 MB is also 12.2 GB

so why df is showing 13 GB or am I missing something?

Here is full df listing

$ df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/xvda1            7.5G  1.7G  5.5G  24% /
none                  5.8G  128K  5.8G   1% /dev
none                  5.8G     0  5.8G   0% /dev/shm
none                  5.8G   44K  5.8G   1% /var/run
none                  5.8G     0  5.8G   0% /var/lock
none                  5.8G     0  5.8G   0% /lib/init/rw
/dev/xvdb1             13G  716M   11G   6% /xxx

Coreutils version seems to 7.4 as info coreutils shows

This manual documents version 7.4 of the GNU core utilities,

© Super User or respective owner

Related posts about ubuntu-10.04

Related posts about coreutils