public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Newall <davidn@davidnewall.com>
To: Arkadiusz Miskiewicz <a.miskiewicz@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: df -h shows ~10 times bigger size when umounting pendrive
Date: Mon, 23 Mar 2009 01:22:24 +1030	[thread overview]
Message-ID: <49C650A8.60308@davidnewall.com> (raw)
In-Reply-To: <200903221125.16860.a.miskiewicz@gmail.com>

Arkadiusz Miskiewicz wrote:
> /etc/mtab contains:
>
> /dev/sdb1 /media/floppy vfat rw 0 0
>
> statfs() returns:
>
> statfs("/media/floppy", {f_type=0x58465342, f_bsize=4096, f_blocks=2497555, 
> f_bfree=1410716, f_bavail=1410716, f_files=10000448, f_ffree=9842679, 
> f_fsid={2051, 0}, f_namelen=255, f_frsize=4096}) = 0
>   

The statfs(), above, is not a stat for the file system at /media/floppy,
it's a stat for the file system which *contains* /media/floppy.  If
/dev/sdb1 has been unmounted (which was in fact in occurring at the
time) the stat refers to (in your case) the root filesystem.  And look
at the returned information: 2497555 4K blocks, 1410716 of them
available; that's 9.6GB file system with 5.5GB available, same as /dev/sda3.

Truly, this is what I said it was; and it's normal, and it's reasonable.

> /dev/sdb1             9,6G  4,2G  5,4G  44% /media/floppy
>
> So why statfs() lies on a being unmounted filesystem?

There is a lie, which is that /media/floppy is on /dev/sdb1.  That
ceases to be true as soon as the umount starts.  The reason df lies is
because it trusts the mtab, which has not yet had the entry for
/dev/sdb1 removed.

      reply	other threads:[~2009-03-22 14:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-22  0:50 df -h shows ~10 times bigger size when umounting pendrive Arkadiusz Miskiewicz
2009-03-22  6:47 ` David Newall
2009-03-22 10:25   ` Arkadiusz Miskiewicz
2009-03-22 14:52     ` David Newall [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=49C650A8.60308@davidnewall.com \
    --to=davidn@davidnewall.com \
    --cc=a.miskiewicz@gmail.com \
    --cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox