[arch-releng] SI/IEEE, MiB,MB bits (pun intended)

Dieter Plaetinck dieter at plaetinck.be
Sat Feb 14 15:32:21 EST 2009


Hi Evangelos/team,
I was wondering if you could help me figure out some MiB/MB related
things.


As far as I understand:
SI prefixes are, and always have been multiples of 10. ( eg
10^3,10^6)

But, many people have abused SI prefixes to denominate numbers like
2^10 (1024), 2^20 etc.
Eg OS vendors and many software developers have used this definition,
while hard disk vendors used the real meaning

So, along came IEEE to introduce prefixes for these binary multiples,
so that we can use SI prefixes only for what they are
meant (ieee at the same time also definined some more things like b=bit,
B=byte, etc)


Thanks to your patch (http://bugs.archlinux.org/task/12949) the
installer to use both the IEEE nomenclature and powers of 1024.


But:

df has these options (man df)
-h, --human-readable
            print sizes in human readable format (e.g., 1K 234M 2G
-H, --si
            likewise, but use powers of 1000 not 1024


So 'df -h' uses the SI nomenclature ('K','M','G') but calculates in
powers of 1024, so their values are actually in Ki, Mi, Gi etc


But, if I create in the installer a partition of the size 10.000MiB:

echo $(((2**20)*10000))
10485760000 <-- this is the amount of bytes I expect to see on the
blockdevice.

fdisk -l says:
10487232000 bytes
Why is it not the same?

Also a df -m (-m is not documented? but it says "1M" blocks) of the
filesystem (ext2) yields 9845M. If 1M means 10^6 then this is wrong
because it would be way too few, and if it means 1MiB than it's also
 still wrong. how much space can you loose by formatting a block device
 as ext2? Even after setting reserved blocks to 0 (tune2fs -r
 0 /dev/sda3) It still is 9845M. (the amount available is 9823M)

Any ideas?
Thanks,
Dieter



More information about the arch-releng mailing list