Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #199375 > unrolled thread

df -h shows insufficient precision

Started byZenaan Harkness <zenaan@freedbms.net>
First post2018-08-26 04:30 +0200
Last post2018-08-27 15:50 +0200
Articles 7 — 5 participants

Back to article view | Back to linux.debian.user


Contents

  df -h shows insufficient precision Zenaan Harkness <zenaan@freedbms.net> - 2018-08-26 04:30 +0200
    Re: df -h shows insufficient precision Roberto C. Sánchez <roberto@debian.org> - 2018-08-26 04:40 +0200
      Re: df -h shows insufficient precision Roberto C. Sánchez <roberto@debian.org> - 2018-08-26 07:10 +0200
        Re: df -h shows insufficient precision Ionel Mugurel Ciobîcă <I.M.Ciobica@gmail.com> - 2018-08-26 19:20 +0200
      Re: df -h shows insufficient precision Zenaan Harkness <zenaan@freedbms.net> - 2018-08-26 07:10 +0200
    Re: df -h shows insufficient precision Erik Christiansen <dvalin@internode.on.net> - 2018-08-26 10:10 +0200
    Re: df -h shows insufficient precision Michael Stone <mstone@debian.org> - 2018-08-27 15:50 +0200

#199375 — df -h shows insufficient precision

FromZenaan Harkness <zenaan@freedbms.net>
Date2018-08-26 04:30 +0200
Subjectdf -h shows insufficient precision
Message-ID<wqSYq-4Kq-3@gated-at.bofh.it>
A regular itchy annoyance for years now:

df shows bytes, df -h shows only one decimal place, so e.g. on a
1.8TiB drive "1.6T" is the free space, but that resolution/ precision
is insufficient. Of course I can fire up bc, set scale=20 and do some
powers of 1024 division, but that's all very clunky.

How hard would it be to add an option to bc, to choose the number of
decimal places to use in the output, or the number of digits of
precision to display?

TIA,

[toc] | [next] | [standalone]


#199376

FromRoberto C. Sánchez <roberto@debian.org>
Date2018-08-26 04:40 +0200
Message-ID<wqT86-4O1-5@gated-at.bofh.it>
In reply to#199375
On Sun, Aug 26, 2018 at 12:25:44PM +1000, Zenaan Harkness wrote:
> A regular itchy annoyance for years now:
> 
> df shows bytes, df -h shows only one decimal place, so e.g. on a
> 1.8TiB drive "1.6T" is the free space, but that resolution/ precision
> is insufficient. Of course I can fire up bc, set scale=20 and do some
> powers of 1024 division, but that's all very clunky.
> 
> How hard would it be to add an option to bc, to choose the number of
> decimal places to use in the output, or the number of digits of
> precision to display?
> 

Have you looked at the -k and -B options?  Also, di has the -d option
which is more flexible and it also supports format strings.  You should
be able to make it produce output in exactly the way you need.

Regards,

-Roberto

-- 
Roberto C. Sánchez

[toc] | [prev] | [next] | [standalone]


#199379

FromRoberto C. Sánchez <roberto@debian.org>
Date2018-08-26 07:10 +0200
Message-ID<wqVtf-6kt-3@gated-at.bofh.it>
In reply to#199376
On Sun, Aug 26, 2018 at 03:04:38PM +1000, Zenaan Harkness wrote:
> On Sat, Aug 25, 2018 at 10:38:19PM -0400, Roberto C. Sánchez wrote:
> > On Sun, Aug 26, 2018 at 12:25:44PM +1000, Zenaan Harkness wrote:
> > > A regular itchy annoyance for years now:
> > > 
> > > df shows bytes, df -h shows only one decimal place, so e.g. on a
> > > 1.8TiB drive "1.6T" is the free space, but that resolution/ precision
> > > is insufficient. Of course I can fire up bc, set scale=20 and do some
> > > powers of 1024 division, but that's all very clunky.
> > > 
> > > How hard would it be to add an option to bc, to choose the number of
> > > decimal places to use in the output, or the number of digits of
> > > precision to display?
> > > 
> > 
> > Have you looked at the -k and -B options?  Also, di has the -d option
> 
> I assume you mean "du"?
> 
> Unfortunately the du command recursively scans directories - not a
> quick option when all you want is a summary for the drive/ partition.
> 
> > which is more flexible and it also supports format strings.  You should
> > be able to make it produce output in exactly the way you need.
> 
> Thank you - I do use du from time to time, but it's just too slow for
> whole-drive (or partition) "quick" checks...
> 

No.  I actually meant 'di':

$ apt-cache show di
Package: di
Source: di (4.34-2)
Version: 4.34-2+b1
Installed-Size: 105
Maintainer: Michael Ablassmeier <abi@debian.org>
Architecture: amd64
Depends: libc6 (>= 2.3)
Description-en: advanced df like disk information utility
 `di' is a disk information utility, displaying everything
 (and more) that your `df' command does. It features the
 ability to display your disk usage in whatever format you
 desire/prefer/are used to. It is designed to be portable
 across many platforms.

Regards,

-Roberto
-- 
Roberto C. Sánchez

[toc] | [prev] | [next] | [standalone]


#199396

FromIonel Mugurel Ciobîcă <I.M.Ciobica@gmail.com>
Date2018-08-26 19:20 +0200
Message-ID<wr6RH-4vs-3@gated-at.bofh.it>
In reply to#199379
On 26-08-2018, at 01h 08'57", Roberto C. Sánchez wrote about "Re: df -h shows insufficient precision"
> > > Have you looked at the -k and -B options?  Also, di has the -d option
> > 
> > I assume you mean "du"?
> > 
> No.  I actually meant 'di':
> 

That is useful! I already made an alias df to point at "di -m -x tmpfs -s s".

Thank you.

 Ionel

[toc] | [prev] | [next] | [standalone]


#199380

FromZenaan Harkness <zenaan@freedbms.net>
Date2018-08-26 07:10 +0200
Message-ID<wqVtf-6kt-1@gated-at.bofh.it>
In reply to#199376
On Sat, Aug 25, 2018 at 10:38:19PM -0400, Roberto C. Sánchez wrote:
> On Sun, Aug 26, 2018 at 12:25:44PM +1000, Zenaan Harkness wrote:
> > A regular itchy annoyance for years now:
> > 
> > df shows bytes, df -h shows only one decimal place, so e.g. on a
> > 1.8TiB drive "1.6T" is the free space, but that resolution/ precision
> > is insufficient. Of course I can fire up bc, set scale=20 and do some
> > powers of 1024 division, but that's all very clunky.
> > 
> > How hard would it be to add an option to bc, to choose the number of
> > decimal places to use in the output, or the number of digits of
> > precision to display?
> > 
> 
> Have you looked at the -k and -B options?  Also, di has the -d option

I assume you mean "du"?

Unfortunately the du command recursively scans directories - not a
quick option when all you want is a summary for the drive/ partition.

> which is more flexible and it also supports format strings.  You should
> be able to make it produce output in exactly the way you need.

Thank you - I do use du from time to time, but it's just too slow for
whole-drive (or partition) "quick" checks...

[toc] | [prev] | [next] | [standalone]


#199381

FromErik Christiansen <dvalin@internode.on.net>
Date2018-08-26 10:10 +0200
Message-ID<wqYhs-7Wz-5@gated-at.bofh.it>
In reply to#199375
On 26.08.18 12:25, Zenaan Harkness wrote:
> A regular itchy annoyance for years now:
> 
> df shows bytes, df -h shows only one decimal place, so e.g. on a
> 1.8TiB drive "1.6T" is the free space, but that resolution/ precision
> is insufficient.

For more than 3 decades I've just used "df -k". OK, even on smaller
disks than yours, that's a lot of digits, so a bit of mental juggling:

$ df -k
Filesystem    1K-blocks     Used Available Use% Mounted on
/dev/sda9     293477416 15376432 263193184   6% /home

Better is "df -m". On larger disks, you'll have more digits than here:

$ df -m
Filesystem    1M-blocks     Used Available Use% Mounted on
/dev/sda9        286600    15017    257025   6% /home

> Of course I can fire up bc, set scale=20 and do some
> powers of 1024 division, but that's all very clunky.
> 
> How hard would it be to add an option to bc, to choose the number of
> decimal places to use in the output, or the number of digits of
> precision to display?

Harder than putting the output of df -k through two lines of awk in a
shell function, I figure.

Erik

[toc] | [prev] | [next] | [standalone]


#199422

FromMichael Stone <mstone@debian.org>
Date2018-08-27 15:50 +0200
Message-ID<wrq41-7gX-5@gated-at.bofh.it>
In reply to#199375
On Sun, Aug 26, 2018 at 12:25:44PM +1000, Zenaan Harkness wrote:
>df shows bytes, df -h shows only one decimal place, so e.g. on a
>1.8TiB drive "1.6T" is the free space, but that resolution/ precision
>is insufficient.

Insufficient for what?

[toc] | [prev] | [standalone]


Back to top | Article view | linux.debian.user


csiph-web