* findmnt/df discrepancy
@ 2014-02-12 15:29 Bruce Dubbs
2014-02-12 15:38 ` Dave Reisner
0 siblings, 1 reply; 4+ messages in thread
From: Bruce Dubbs @ 2014-02-12 15:29 UTC (permalink / raw)
To: util-linux-ng
I've noticed a discrepancy in percent free between findmnt and df:
$ df -h|grep /tmp
/dev/sdb5 9.8G 8.3G 967M 90% /tmp
$ findmnt --df|grep /tmp
/dev/sdb5 ext4 9.7G 8.3G 967M 85% /tmp
Actually, the discrepancy seems to be df as 8.3/9.8 is 84.7%.
Can anyone here explain the difference? Should it be submitted to
coreutils as a bug?
-- Bruce
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: findmnt/df discrepancy
2014-02-12 15:29 findmnt/df discrepancy Bruce Dubbs
@ 2014-02-12 15:38 ` Dave Reisner
2014-02-15 4:02 ` Phillip Susi
0 siblings, 1 reply; 4+ messages in thread
From: Dave Reisner @ 2014-02-12 15:38 UTC (permalink / raw)
To: Bruce Dubbs; +Cc: util-linux-ng
On Wed, Feb 12, 2014 at 09:29:25AM -0600, Bruce Dubbs wrote:
> I've noticed a discrepancy in percent free between findmnt and df:
>
> $ df -h|grep /tmp
> /dev/sdb5 9.8G 8.3G 967M 90% /tmp
> $ findmnt --df|grep /tmp
> /dev/sdb5 ext4 9.7G 8.3G 967M 85% /tmp
>
> Actually, the discrepancy seems to be df as 8.3/9.8 is 84.7%.
> Can anyone here explain the difference? Should it be submitted to
> coreutils as a bug?
It's the reserved space on the filesystem. On an ext4 FS where the
reserved space is 0%, df and findmnt (mostly) agree:
$ df -h | grep Gluttony
/dev/sdb2 1.8T 701G 1.1T 39% /mnt/Gluttony
$ findmnt --df | grep Gluttony
/dev/sdb2 ext4 1.8T 700.1G 1.1T 39% /mnt/Gluttony
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: findmnt/df discrepancy
2014-02-12 15:38 ` Dave Reisner
@ 2014-02-15 4:02 ` Phillip Susi
2014-02-21 12:09 ` Karel Zak
0 siblings, 1 reply; 4+ messages in thread
From: Phillip Susi @ 2014-02-15 4:02 UTC (permalink / raw)
To: Bruce Dubbs, util-linux-ng
-----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.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.14 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iQEcBAEBCgAGBQJS/ublAAoJEI5FoCIzSKrwhYwH/RQeM8f0vTACy6bRGzCtFyPy
YJL4/GAJk2B4tTPGqcAUFaByu5XR760unjMvk6TRUjgvPtJN35oaF0SwYqA68o7Q
GviH5+21hztANKQz/JO6RZPbzueEttSlCsAjNbhuFmY/+ysMkxGA9inlNyE14MU0
pGOfTtpw0vAAJFX0+7gjGZZkOsm8yYH4yhb0ERoQACYZxrcFLRaqxV+V3eKhtZuo
tFvP2mNXCPk4AyP9oXaepPESBaZmmPNh81FvZBAarZURKefPJDw5TJslZmeLAO1O
fWUmEa+xBexX7jSwqgdeIYk0Inci+X2kTx5dckkQM9LcnVqJ67nYufb+IDzQoow=
=USil
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: findmnt/df discrepancy
2014-02-15 4:02 ` Phillip Susi
@ 2014-02-21 12:09 ` Karel Zak
0 siblings, 0 replies; 4+ messages in thread
From: Karel Zak @ 2014-02-21 12:09 UTC (permalink / raw)
To: Phillip Susi; +Cc: Bruce Dubbs, util-linux-ng
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
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-02-21 12:09 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).