All of lore.kernel.org
 help / color / mirror / Atom feed
From: Karel Zak <kzak@redhat.com>
To: Phillip Susi <psusi@ubuntu.com>
Cc: Bruce Dubbs <bruce.dubbs@gmail.com>, util-linux-ng@vger.kernel.org
Subject: Re: findmnt/df discrepancy
Date: Fri, 21 Feb 2014 13:09:46 +0100	[thread overview]
Message-ID: <20140221120946.GD30903@x2.net.home> (raw)
In-Reply-To: <52FEE6E5.7010206@ubuntu.com>

On Fri, Feb 14, 2014 at 11:02:45PM -0500, Phillip Susi wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA512
> 
> On 02/12/2014 10:38 AM, Dave Reisner wrote:
> > It's the reserved space on the filesystem. On an ext4 FS where the 
> > reserved space is 0%, df and findmnt (mostly) agree:
> 
> Why would findmnt report a different value?  It is the kernel that
> adjusts the numbers it returns in statfs(), which both should be using.

I have added a new option --bytes to findmnt(8) (we already have the
same option in lsblk(8)), so now it's more obvious:

        $ df --block-size=1 /dev/sda5
        Filesystem         1B-blocks        Used   Available Use% Mounted on
        /dev/sda5        66650419200 39057010688 24184123392  62% /home

        $ findmnt --df --bytes
        /dev/sda5
        SOURCE    FSTYPE        SIZE        USED       AVAIL USE% TARGET
        /dev/sda5 ext4   66650419200 39057010688 24184123392  59% /home


so yes, both use the same numbers from statvfs(), but findmnt(8)
counts USE% from the USED field, but df(1) counts Use% from the
Available column.

The conversion to human readable sizes is another story:

        $ findmnt --df  /dev/sda5
        SOURCE    FSTYPE  SIZE  USED AVAIL USE% TARGET
        /dev/sda5 ext4   62.1G 36.4G 22.5G  59% /home

        $ df -h /dev/sda5
        master
        Filesystem      Size  Used Avail Use% Mounted on
        /dev/sda5        63G   37G   23G  62% /home


for example available space:

        $ echo "24184123392 / (1024 * 1024 * 1024)" | bc -l
        22.52322006225585937500


    Karel

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

      reply	other threads:[~2014-02-21 12:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-12 15:29 findmnt/df discrepancy Bruce Dubbs
2014-02-12 15:38 ` Dave Reisner
2014-02-15  4:02   ` Phillip Susi
2014-02-21 12:09     ` Karel Zak [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140221120946.GD30903@x2.net.home \
    --to=kzak@redhat.com \
    --cc=bruce.dubbs@gmail.com \
    --cc=psusi@ubuntu.com \
    --cc=util-linux-ng@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.