From: Andrei Borzenkov <arvidjaar@gmail.com>
To: Chris Murphy <lists@colorremedies.com>
Cc: Martin Steigerwald <martin@lichtvoll.de>,
Zygo Blaxell <ce3g8jdj@umail.furryterror.org>,
Btrfs BTRFS <linux-btrfs@vger.kernel.org>
Subject: Re: Understanding "Used" in df
Date: Mon, 27 Jul 2020 22:48:18 +0300 [thread overview]
Message-ID: <8034c0e6-a1d2-5ba9-fdcf-d9b355fd34d1@gmail.com> (raw)
In-Reply-To: <CAJCQCtRgug3uTLBuraWmCiCoAY9VV94nQ0TBXz9jkUyuRhLnzQ@mail.gmail.com>
27.07.2020 22:30, Chris Murphy пишет:
> On Mon, Jul 27, 2020 at 10:43 AM Andrei Borzenkov <arvidjaar@gmail.com> wrote:
>>
>> Unfortunately, "df" does not display "free" (I was wrong in other post).
>> But using stat ...
>>
>>
>> $ LANGUAGE=en stat -f .
>> ...
>> Block size: 4096 Fundamental block size: 4096
>> Blocks: Total: 115164174 Free: 49153062 Available: 43297293
>>
>> $ LANGUAGE=en df -B 4K .
>> Filesystem 4K-blocks Used Available Use% Mounted on
>> /dev/sda4 115164174 66011112 43297293 61% /
>>
>> 115164174 - 49153062 == 66011112
>>
>> But there is no way you can compute Available from other values - it is
>> whatever filesystem returns.
>>
>
> It's definitely goofy in the odd device raid1 case.
Well, I already explained why it happens. Yes, it looks like a bug, the
question is how to do better estimation without performing exhaustive
single-chunk allocation every time. Three equal size devices looks
simple, but consider general case of multiple devices of different size
or different amount of free space.
> If I fallocate a
> file equal to Avail, Avail is not zero.
Yes, because real allocator breaks large file into chunks and estimation
in statfs "allocates" large size as single operation. So end result is
different.
> The fallocated file + new
> Avail != old Avail, which is just not at all correct behavior. So I
> keep fallocating files to get to 0 Avail, and instead I'm only chasing
> zero Avail condition. Once I'm close enough, and delete all six
> fallocated files, I end up for a short period of time, an Avail that
> seems reasonable but is way bigger than it was at the start. And then
> a minute later, without any additional action on my part, returns to
> reporting nonsense.
>
> It's pretty confusing.
>
>
next prev parent reply other threads:[~2020-07-27 19:48 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-22 15:10 Understanding "Used" in df Martin Steigerwald
2020-07-22 19:07 ` A L
2020-07-23 4:51 ` Zygo Blaxell
2020-07-27 11:38 ` Martin Steigerwald
2020-07-27 16:42 ` Andrei Borzenkov
2020-07-27 19:30 ` Chris Murphy
2020-07-27 19:48 ` Andrei Borzenkov [this message]
2020-07-27 20:47 ` Hugo Mills
2020-07-28 21:20 ` Zygo Blaxell
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=8034c0e6-a1d2-5ba9-fdcf-d9b355fd34d1@gmail.com \
--to=arvidjaar@gmail.com \
--cc=ce3g8jdj@umail.furryterror.org \
--cc=linux-btrfs@vger.kernel.org \
--cc=lists@colorremedies.com \
--cc=martin@lichtvoll.de \
/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