How to display byte sizes with binary prefixes?

1

For as long as I can remember, Microsoft DOS and Windows have been displaying byte sizes with decimal prefixes, instead of binary prefixes. This has plagued at least two generations of computer users over the years. There must be at least A6 questions of the type "why is my X GB hard disk drive only showing Y GB?" on the web.

There is nothing wrong with using decimal prefixes to display byte sizes. Really! But when you use binary based size calculations and you prefix them with decimal prefixes, then it becomes a total wreckage!

Here is an example of what a 32 GB disk partition is displayed like in diskpart on Windows.

  Partition ###  Type              Size     Offset
  -------------  ----------------  -------  -------
  Partition 1    Primary             29 GB  1024 KB

Is there a sane, logical reason for this? Why is Microsoft still keeping up with this bad practice in the latest Windows versions?

At very least, I think they should consider doing what Canonical is doing with Ubuntu Linux. They are using decimal prefixes, and decimal based calculations to display disk and file sizes. So in Ubuntu, a 500 GB disk will display as 500 GB. Bah oui! Voilá!

Here is what that same disk partition would be displayed like in parted in Ubuntu.

Number  Start   End     Size    Type     File system  Flags
 1      1049kB  32.0GB  32.0GB  primary  fat32        lba

I would like to have a flipped version of the Ubuntu approach, where I have binary based size calculations and binary prefixes. How can this be done on Windows? Is there some hidden option or a registry hack for this? How about Linux?

Samir

Posted 2015-07-05T20:49:19.327

Reputation: 17 919

1For Ubuntu Try df -h vs df --si... :-) Those options work with du too – Hastur – 2015-07-05T21:07:08.370

So this is not system-wide then on Linux? I will check out those commands. How about Windows? – Samir – 2015-07-05T22:43:11.943

@Hastur How do you set this for the entire system? Some environment setting? I don't want to be opening Terminal and running these commands each time I want the preferred read-out. Please post an answer if you know how to make this the preferred choice for the entire system. – Samir – 2015-07-06T08:28:15.243

just stating the obvious here, but a workaround is third party software. Or of it's just an EXE displaying byte sizes of partitions in the form you want then that's a very small program whether a GUI(like something easily written in visual studio). Or something in C# (adapting this) https://msdn.microsoft.com/en-us/library/system.io.driveinfo(v=vs.110).aspx?cs-save-lang=1&cs-lang=csharp#code-snippet-2

– barlop – 2015-07-06T09:34:39.913

Answers

1

I can give you a quick answer for KDE 4.13.3 under Kubuntu 14.04.2 LTS.
Search under:

System Settings  
   +---> Country/Region & Language   
     +---> Other
       +---> Byte Size and Unit  

You can choose among

  • IEC Unit (kiB,MiB,etc) e.g. 2000 bytes = 1.95 KiB
  • JEDEC Unit (KB,MB,etc) e.g. 2000 bytes = 1.95 KB
  • METRIC Unit (kB,MB,etc) e.g. 2000 bytes = 2.00 kB

I'm quite sure that you can find similar option on each other Desktop Environments...

Note: The exact difference arises from the difference between the "human" 103=1000 and the "logic" 210=1024...


Historical Note:
Vendors and Law: We have this kind of confusion because vendors behave following market's rules, when laws do not force them to do otherwise. I mean that to say this HDD is 4 GB sells better then to say it is 3.78 GB. For the same reasons the internet providers often speak about bps and let you understand Bps. There is a factor 8: a Byte(B) is 8 bits(b).

The problem is that the laws exist, but not in all the nations are the same.

The International System, or SI, is the most widely used in the world for commerce and science (It was published in 1960 and at present are partially out only USA that is adopting, Burma and Liberia).
It establishes not only the units of measurement but even the prefixes.

Since it is natural in the computer world the use of a numeric base in power of 2 (and not 10 as in human world) it was introduced in 1998 the system of the binary prefixes. Here directly the table. Nowadays we find in the situation that

the International Electrotechnical Commission (IEC) and several other standards
(NIST...) and trade organizations approved standards and recommendations 
for a new set of binary prefixes that refer unambiguously to powers of 1024

When you read 1GB it should be 1 000 000 Bytes,
instead when you read 1GiB it should be 1 073 741 824 Bytes.


Additional References

Hastur

Posted 2015-07-05T20:49:19.327

Reputation: 15 043

I use Unity (GNOME), so I don't have that option. Where would one find this option in GNOME environment? – Samir – 2015-07-06T10:52:32.623

Microsoft is not using JEDEC prefixes though? Not from what I can tell. 1: In Windows, kilobyte is is abbreviated as kB with a lower case letter, and it means 1024 byte. JEDEC assigns KB (with upper case letter) to mean 1024 byte. 2: JEDEC defines KB, MB, and GB. Windows can display TB prefixes. So Windows is really using 1024 byte units and decimal prefixes or SI prefixes. Which I find somewhat disturbing. – Samir – 2015-07-06T10:59:59.773

I did a web search for why my * GB disk drive only shows * GB and found about 76 million hits! Google didn't like that so on the next query I only received 9 hits. It had filtered some of the hits as unrelated. Disabling the filter gave me 2.4 million hits. This is still more than the 1 million I predicted, and it shows how many people are confused about this. Majority of them are using Windows too. – Samir – 2015-07-06T11:08:05.543

From the BIPM paper: "These SI prefixes refer strictly to powers of 10. They should not be used to indicate powers of 2 (for example, one kilobit represents 1000 bits and not 1024 bits)." I think Microsoft needs to read this. :-) – Samir – 2015-07-06T11:15:38.110

Are you sure you have no "System Settings...Country/Region & Language ... Units..." at all? BTW which is the value of your $LC_MEASUREMENT? – Hastur – 2015-07-06T12:22:54.320

I do have "Language Support" where I have the "Language" and "Regional Formats" tabs. On the regional formats I can set "display numbers, dates an currency amounts" according to country setting and "apply system-wide". – Samir – 2015-07-06T21:45:22.720

For what it's worth, the $LC_MEASUREMENT is set to sv_SE.UTF-8. But how is this country specific? Also, how can I set only the byte size prefixes and size calculations, without affecting things like currency, date and time format and so on? – Samir – 2015-07-06T21:53:35.030

In your list of Kubuntu options, shouldn't JEDEC be 1.95 KB and metric 2.00 kB? – typo – 2017-07-09T17:54:40.170