public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Ulli Horlacher <framstag@rus.uni-stuttgart.de>
To: linux-btrfs@vger.kernel.org
Subject: Re: workaround for buggy GNU df
Date: Sat, 7 Mar 2026 12:54:37 +0100	[thread overview]
Message-ID: <20260307115437.GA796190@tik.uni-stuttgart.de> (raw)
In-Reply-To: <20240621065709.GA598391@tik.uni-stuttgart.de>

On Fri 2024-06-21 (08:57), Ulli Horlacher wrote:
> 
> The GNU tool df does not work correctly on btrfs, example:
> 
> root@fex:/test/test/test# df -T phoon.png
> Filesystem     Type 1K-blocks     Used Available Use% Mounted on
> -              -     67107840 16458828  47946692  26% /test/test
> 
> root@fex:/test/test/test# grep /test /proc/mounts || echo nope
> nope
> 
> The mountpoint is wrong, the kernel knows the truth.
> 
> Therefore I have written fst:
> 
> root@fex:/test/test/test# fst phoon.png
> path:       /test/test/test/phoon.png
> mountpoint: /
> subvolume:  /test/test
> volume:     /dev/sdd1
> filesystem: btrfs
> 
> 
> https://fex.belwue.de/linuxtools/index.html#fst

I have now extended fst to fstat :

framstag@fex:/local/test/.snapshot/.latest/test: fstat zz
      File: "zz"
 Directory: /local/test/.snapshot/2025-09-05_1917.test/test
      Size: 40 B
Allocation: 4 kB
      Type: regular file
      Mode: rw-r--r--
       UID: root
       GID: root
    Device: /dev/sde1
   FS-Type: btrfs
Mountpoint: /local (rw)
 Subvolume: /local/test/.snapshot/2025-09-05_1917.test (ro)
     Inode: 5107
     Links: 1
    Access: 2025-06-18 10:22:51
    Modify: 2024-05-20 02:02:08
    Change: 2024-06-03 10:58:22
     Birth: 2024-06-03 10:58:22

fstat also shows the btrfs subvolume and its rw/ro status.


framstag@fex:/local/test/.snapshot/.latest/test: df --version
df (GNU coreutils) 9.4

framstag@fex:/local/test/.snapshot/.latest/test: df -T .
Filesystem     Type  1K-blocks     Used Available Use% Mounted on
-              -    1073740800 82884012 989711428   8% /local/test/.snapshot/2025-09-05_1917.test

framstag@fex:/local/test/.snapshot/.latest/test: grep /local /proc/mounts
/dev/sde1 /local btrfs rw,relatime,space_cache,user_subvol_rm_allowed,subvolid=5,subvol=/ 0 0

==> df cannot handle btrfs!


https://fex.belwue.de/fstools/fstat.html

-- 
Ullrich Horlacher              Server und Virtualisierung
Rechenzentrum TIK
Universitaet Stuttgart         E-Mail: horlacher@tik.uni-stuttgart.de
Allmandring 30a                Tel:    ++49-711-68565868
70569 Stuttgart (Germany)      WWW:    https://www.tik.uni-stuttgart.de/
REF:<20240621065709.GA598391@tik.uni-stuttgart.de>

      parent reply	other threads:[~2026-03-07 12:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-21  6:57 workaround for buggy GNU df Ulli Horlacher
2024-06-25 18:13 ` Phillip Susi
2024-06-25 19:12   ` Remi Gauvin
2024-06-26  6:40     ` Andrei Borzenkov
2024-09-03 13:26       ` Ulli Horlacher
2026-03-07 11:54 ` Ulli Horlacher [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=20260307115437.GA796190@tik.uni-stuttgart.de \
    --to=framstag@rus.uni-stuttgart.de \
    --cc=linux-btrfs@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