coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: question about SI/IEC in df


From: L A Walsh
Subject: Re: question about SI/IEC in df
Date: Thu, 28 Nov 2019 19:22:04 -0800
User-agent: Thunderbird

On 2019/11/28 04:39, Krzysztof Labus wrote:
> In the manual I see:
> The SIZE argument is an integer and optional unit (example: 10K is
> 10*1024).  Units are K,M,G,T,P,E,Z,Y (powers of 1024) or KB,MB,...
> (powers of 1000).
>
> 1. Why df not using Ki, Mi, Gi etc. in powers od 1024 ??
>   
---
    Compatibility with existing scripts and sanity.

    Only recently have disks been large enough to be able to accurately
express space on a disk using base 10 units.

    If someone claimed 1MB meant 1,000,000 bytes, you knew they were
'marketing' (lying), because disks only recognized space in sectors and
you can't have 10**6 Bytes -- exactly on a disk, and have it be usable. 
With 512
byte sectors, you have 1953.125 sectors.  It wasn't until disks were sold
in units of 10**9 Bytes (1 billion), that such a number could be exact.
With 4096-Byte sectors, you need 10**12 Bytes, (1 trillion) or a teraByte.

Anyway, _my feelings_ are if you are talking about Bytes, you are already
using a binary unit of information(1B=2**3b).
then it seems bad form to mix bases by using base 10 with Bytes.

Thus using KB..TB..etc... would use base 2 in prefixes to go with the
base-2 unit:
2**10...2**40.

While kb, mb, gb, tb would always use base 10 to go with the base 10
unit of information.

Note, there is no confusion in use of mb for mega-bit as a bit cannot be
a fractional
value.

^ <https://en.wikipedia.org/wiki/Binary_prefix#cite_note-bipm-book-83>

> 2. On my computer: df -H print:
> -----
> none        _504k_     0  _504k_   0% /dev
> -----
>
> df -H
> -----
> none        492K     0  492K   0% /dev
> -----
> I see the difference in the presentation of results and what is in the
> manual -> (...) KB,MB,... (powers of 1000) (...) but df -H print small
> letter k
>   
I think that comes from common base-10 prefixes using lower case as in
km for kilometer, and ms for millisecond.

Certainly for memory, base-10 makes no sense since memory doesn't come in
base-10 sizes and along with my examples above, usually uses a base-2
unit (Byte)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]