I'm curious about df -H and df -h, then man df tells me:

   -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 what is the rationale behind the use of powers of 1000?

Maybe a side question (or even related):

root@host:~# df
Filesystem     1K-blocks      Used Available Use% Mounted on

Is K block 1024 or 1000?


I speculate that this is due to storage manufacturers using the SI decimal prefixes near-universally.

Further on in the manpage (assuming GNU df):

   SIZE  is  an  integer and optional unit (example: 10M is 10*1024*1024).
   Units are K, M, G, T, P, E, Z, Y (powers of 1024) or KB, MB, ...  (pow‐
   ers of 1000).

So 1K is 1024.

In another GNU tool, dd, this bug discussion provides some insight:

I recall considering this when I added this kind of diagnostic to GNU dd back in 2004, and going with powers-of-1000 abbreviations because secondary storage devices are normally measured that way. For this reason, I expect many users will prefer powers-of-1000 here. This is particularly true for transfer rates: it's rare to see "GiB/s" in real-world prose.

The commit which added this feature to df in 1997 only says what, and not why.

  • wow you rock! You even found the commit. May I ask how? Thanks :D
    – CppLearner
    Dec 6 '14 at 18:38
  • 4
    The usual way to locate a commit which caused something is bisection. I started at 1997, went to 2005, then to 2001, then 1999, then 1998, and so on.
    – muru
    Dec 6 '14 at 18:41

If you go back 15-20 years the power-of-2 math was sensible, as it did match up with the storage blocks as mentioned in other answers. Then we encounter the inertia factor where 'we always did it that way' kicks in. And the small difference between ^2 and ^10 never added up to much. Software providers used ^2 for convenience (and inertia), drive manufacturers used ^10 because it produced a bigger number on the box.

As drives reached capacities of hundreds of gigabytes and then multi-terabytes the difference became rather substantial and thus noticeable to the average consumer. 30+Gb difference couldn't be passed off as "operating system overhead". The few lines of code in the programming eliminated a lot of calls to the support desk. Yes, df isn't used by the average Mac user on a daily basis but it (or it's functions/libraries/codebase) will be used by higher level UI program.

  • Another great answer. thanks for the explanation.
    – CppLearner
    Dec 7 '14 at 1:21

If a particular storage medium uses allocation units of e.g. 1024 bytes, knowing that a file took 260K on disk would imply that it took 260 storage units. If instead the space were reported as 260k, it would be unclear whether that meant 253 storage units (259,072, rounded up to 260) or 254 storage units (260,096 bytes). The avoidance of such ambiguity was a good argument in favor of using power-of-two units.

Since hard drive manufacturers started using decimal rather than binary prefixes, however, and since the size of individual storage units is an increasingly-trivial portion of a drive's capacity, binary prefixes no longer have the same advantage as they used to.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.