File and memory sizes continue to confuse the public at large. I should know, I’m one of them. As is often the case, consumers feel cheated out of buying what they felt was a product of a certain size, only to get it home and have their computer report a different amount. It came up briefly in the #ubuntu IRC chat room. Below is the conversation between myself and two others.

jrdave: hey guys… a quick question for u… I have an old PC with 512MB RAM… debian (free -m) is reporting 504MB only! Any explanations? (the video is NOT shared)
mechtech: jrdave: rounding…I have 1024, but Ubuntu says only 1001
jrdave: mechtech: so if I convert the amount manually it show be correct (from bytes)?
mechtech: jrdave: makes sense to me
jrdave: mechtech: lemme try
jrdave: mechtech: NO… its in KB and when divided by 1024 it shows 504MB!!!
mechtech: jrdave: why would you divide by 1024?
jrdave: mechtech: coz the default output is in KB
mechtech: jrdave: you need only move the decimal place three places to the left to convert from KB to MB
jrdave: mechtech: 1MB=1024KB and not 1000
stovicek: jrdave: marketing in the storage world isn’t entirely accurate as many find with more often with hard drives. same holds true for memory. you probably have somewhere around 512000 bytes in marketing terms, that’s 512MB, not 504MB. It all depends on how you divide the bytes, either by 1024 or 1000.
jrdave: stovicek: BIOS reports 512MB
mechtech: jrdave: as I said before and stoveicek has more verbosely described…rounding
stovicek: jrdave: because bios divided it by 1000. Either way, you have a half gig.
mechtech: jrdave: therefore, to convert KB into MB, simply move the decimal point three places to the stovicek: jrdave: I’ve got 4Gb. Bios reports it as 4GB. But I see 3830MB. It’s still the same 4GB, just divided by a different factor.
jrdave: stovicek: I see

The explanation I gave wasn’t entirely accurate, but it was still partly true. Anyone buying a new hard drive can attest to the feeling of an immediate loss of hard drive space when they’re 1TB hard drive shows as having only 931GiB. Both numbers are correct and the manufacturer took advantage of the two possible measurements by selling a 1TB drive to the consumers. So what gives?

If you noticed, I used the notation of GiB, instead of GB. The reason for this is that byte prefixes such as kilo, mega, and giga are defined by the International System of Units to mean multiples of 1000. A kilobyte (kB) is then equal to 1000 bytes, a megabyte (MB) equal to 1,000,000 bytes, and a gigabyte (GB) meaning 1,000,000,000 bytes. This is the decimal system.

Traditionally, memory and storage measurements were made using a factor of 1024. Your end result would be a measurement in “binary”. A kilobyte would equal 1024 bytes, a megabyte would equal 1,048,576 bytes (1024 x 1024), and a gigabyte would equal 1,073,741,824 bytes (1024 x 1024 x 1024). But that would mean that the same terms are equal to two different sets of measurements.

The IEC, who is a non-profit international standards organization, has proposed using byte prefixes such as kibi, mebi, and gibi (among others) in place of kilo, mega, and giga for the “binary” measurements. Therefore, 1 kilobyte (KB) equals 0.976 kibibytes (KiB). Getting back to the consumer’s new 1TB drive, 1 terabyte (TB) equals 931 (GiB) gibibytes.

This also relates to the IRC conversation above. When the user issued free -m at the command line, he was actually seeing the “binary” measurement. The man page for free incorrectly states that the different display switches will show kilobytes, megabytes and gigabytes. But as I described above, those would be the decimal factors of 1000, not the “binary” factors of 1024 that it uses. For instance, the following two examples are from my own laptop (slightly cropped to better fit the blog’s layout):

adam@obsidian:~$ free
             total       used       free
Mem:    4016529408 3787829248  228700160
-/+ buffers/cache: 1780539392 2235990016
Swap:            0          0          0

First, show in straight bytes and below showing “megabytes”:

adam@obsidian:~$ free -m
             total       used       free
Mem:          3830       3611        218
-/+ buffers/cache:       1697       2132
Swap:            0          0          0

My laptop has 4GB installed. From the first display, you can clearly see over 4,000,000,000 bytes. So, technically, there is actually 4.02GB. But in the next display, we see something dramatically different. Now there’s only “3830MB”. What’s incorrect is the expected outcome and the implied notation. If the man page was correct, it should show 4017MB, but it doesn’t. What we truly see is 3830MiB, mebibytes and not megabytes. Nothing was lost, it’s just a consequence of using different factoring.

It’s still confusing for me even after knowing it as well as I do. The point I’m trying to make is that it can be unsettling especially in today’s computer age with such massive storage devices, but users shouldn’t panic. You can start by reading the entries at Wikipedia for a more in depth, and possibly clearer, explanation than what I provided here.

Share