Subject: bug#50940: how df utility displays sizes - GB vs GiB

From: Chris Murphy <[email-masked]>
Date: Mon, 4 Oct 2021 16:31:46 -0400

On Fri, Oct 1, 2021 at 12:19 PM Pádraig Brady <[email-masked]> wrote:
>
> On 01/10/2021 14:28, Danie de Jager wrote:
> > Hi,
> >
> > The output from df -h and df -H is always G or M. Depending on who sends me
> > usage stats I have to ask how the command was run to make sure I calculate
> > usage correctly. Systems like Amazon EC2 use the explicit GiB suffix.
> > Making it easier to know what sizes you are looking at.
> >
> > Can a future release of df not be improved to print out the GB or GiB?
>
> So you're suggesting that `df -h` changes to using IEC suffixes like Gi, Ti etc.
> and -H would use the current suffix format to indicate SI units.
> That would be the right thing to do if we were adding these options now,
> but at this stage I'm not sure it's worth it, because you wouldn't
> be sure which version of df you were getting the output from.
>
> For completeness one can get unambiguous output using numfmt like:
>
>    $ df -B1 | numfmt --field - --invalid=ignore --to=iec-i
>    Filesystem        1B-blocks        Used  Available Use% Mounted on
>    devtmpfs              3.9Gi           0      3.9Gi   0% /dev

I'm pretty biased toward showing units correctly, no matter the
ensuing compatibility arguments. The distillation of the compatibility
argument is: changing this will be painful for scripts. While true,
it's still worse to have the wrong units reported. Is the primary
target audience for human-readable values humans? Or scripts?

If it's really such a problem, introduce a computer/script friendly
output format and only ever append to the output when introducing new
values.

-- 
Chris Murphy