Re: Understanding "Used" in df

Chris Murphy
2020-07-27T19:30:29Z

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. If I fallocate a
file equal to Avail, Avail is not zero. 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.

--
Chris Murphy