在 df 中可以选择使用 1000 而不是 1024 的幂的理由是什么?

Cpp*_*ner 8 disk-usage history

我很好奇df -Hand df -h,然后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
Run Code Online (Sandbox Code Playgroud)

那么使用 1000 次幂背后的原理是什么?

也许是一个附带问题(甚至相关):

root@host:~# df
Filesystem     1K-blocks      Used Available Use% Mounted on
Run Code Online (Sandbox Code Playgroud)

K区块是1024 还是 1000?

mur*_*uru 9

我推测这是由于存储制造商几乎普遍使用 SI 十进制前缀。

进一步在联机帮助页(假设 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).
Run Code Online (Sandbox Code Playgroud)

所以 1K 是 1024。

在另一个 GNU 工具 中dd,此错误讨论提供了一些见解:

我记得当我在 2004 年将这种诊断添加到 GNU dd 时考虑过这一点,并使用 1000 次幂的缩写,因为二级存储设备通常是这样测量的。出于这个原因,我预计很多用户会更喜欢这里的 1000 次幂。对于传输速率而言尤其如此:在现实世界的散文中很少看到“GiB/s”。

df1997 年添加此功能的提交只说明了什么,而不说明原因。

  • 定位导致某些事情的提交的常用方法是 [bisection](https://en.wikipedia.org/wiki/Bisection_method)。我从 1997 年开始,到 2005 年,然后是 2001 年,然后是 1999 年,然后是 1998 年,依此类推。 (4认同)