public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
* workaround for buggy GNU df
@ 2024-06-21  6:57 Ulli Horlacher
  2024-06-25 18:13 ` Phillip Susi
  2026-03-07 11:54 ` Ulli Horlacher
  0 siblings, 2 replies; 6+ messages in thread
From: Ulli Horlacher @ 2024-06-21  6:57 UTC (permalink / raw)
  To: linux-btrfs


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


-- 
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>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: workaround for buggy GNU df
  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
  2026-03-07 11:54 ` Ulli Horlacher
  1 sibling, 1 reply; 6+ messages in thread
From: Phillip Susi @ 2024-06-25 18:13 UTC (permalink / raw)
  To: Ulli Horlacher, linux-btrfs

Ulli Horlacher <framstag@rus.uni-stuttgart.de> writes:

> 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.

How did you get this to happen?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: workaround for buggy GNU df
  2024-06-25 18:13 ` Phillip Susi
@ 2024-06-25 19:12   ` Remi Gauvin
  2024-06-26  6:40     ` Andrei Borzenkov
  0 siblings, 1 reply; 6+ messages in thread
From: Remi Gauvin @ 2024-06-25 19:12 UTC (permalink / raw)
  To: linux-btrfs

On 2024-06-25 2:13 p.m., Phillip Susi 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.
> How did you get this to happen?
>

Very easy to replicate.  If you call df with a path, it prints the
location of the subvolume in the "Mounted As" column.  No other steps
necessary.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: workaround for buggy GNU df
  2024-06-25 19:12   ` Remi Gauvin
@ 2024-06-26  6:40     ` Andrei Borzenkov
  2024-09-03 13:26       ` Ulli Horlacher
  0 siblings, 1 reply; 6+ messages in thread
From: Andrei Borzenkov @ 2024-06-26  6:40 UTC (permalink / raw)
  To: Remi Gauvin, linux-btrfs

On 25.06.2024 22:12, Remi Gauvin wrote:
> On 2024-06-25 2:13 p.m., Phillip Susi 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.
>> How did you get this to happen?
>>
> 
> Very easy to replicate.  If you call df with a path, it prints the
> location of the subvolume in the "Mounted As" column.  No other steps
> necessary.
> 
> 

bor@tw:~> df -T /home
Filesystem     Type  1K-blocks     Used Available Use% Mounted on
/dev/sda2      btrfs  39835648 20799988  16982220  56% /home
bor@tw:~> df -T /home/bor
Filesystem     Type  1K-blocks     Used Available Use% Mounted on
/dev/sda2      btrfs  39835648 20799988  16982220  56% /home
bor@tw:~> df -T /home/bor/bin
Filesystem     Type  1K-blocks     Used Available Use% Mounted on
/dev/sda2      btrfs  39835648 20799988  16982220  56% /home
bor@tw:~>



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: workaround for buggy GNU df
  2024-06-26  6:40     ` Andrei Borzenkov
@ 2024-09-03 13:26       ` Ulli Horlacher
  0 siblings, 0 replies; 6+ messages in thread
From: Ulli Horlacher @ 2024-09-03 13:26 UTC (permalink / raw)
  To: linux-btrfs

On Wed 2024-06-26 (09:40), Andrei Borzenkov wrote:
> On 25.06.2024 22:12, Remi Gauvin wrote:
> 
> > On 2024-06-25 2:13 p.m., Phillip Susi 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.
> >> How did you get this to happen?
> >>
> >
> > Very easy to replicate.  If you call df with a path, it prints the
> > location of the subvolume in the "Mounted As" column.  No other steps
> > necessary.
> >
> >
> 
> bor@tw:~> df -T /home
> Filesystem     Type  1K-blocks     Used Available Use% Mounted on
> /dev/sda2      btrfs  39835648 20799988  16982220  56% /home
> bor@tw:~> df -T /home/bor
> Filesystem     Type  1K-blocks     Used Available Use% Mounted on
> /dev/sda2      btrfs  39835648 20799988  16982220  56% /home
> bor@tw:~> df -T /home/bor/bin
> Filesystem     Type  1K-blocks     Used Available Use% Mounted on
> /dev/sda2      btrfs  39835648 20799988  16982220  56% /home

You have no subvolumes in /home, therefore no problems with df output.
Try:

framstag@watschel:~: btrfs sub create tmp/test
Create subvolume 'tmp/test'

framstag@watschel:~: df -H tmp/test
Filesystem      Size  Used Avail Use% Mounted on
-               199G  154G   44G  78% /local/home/framstag/tmp/test

framstag@watschel:~: fst tmp/test
Path:       /local/home/framstag/tmp/test
Mountpoint: /local
Subvolume:  /local/home/framstag/tmp/test
Volume:     /dev/sdc3
Filesystem: btrfs

-- 
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:<303dee41-7b6e-4a54-be75-acbc3b4da5a5@gmail.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: workaround for buggy GNU df
  2024-06-21  6:57 workaround for buggy GNU df Ulli Horlacher
  2024-06-25 18:13 ` Phillip Susi
@ 2026-03-07 11:54 ` Ulli Horlacher
  1 sibling, 0 replies; 6+ messages in thread
From: Ulli Horlacher @ 2026-03-07 11:54 UTC (permalink / raw)
  To: linux-btrfs

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>

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-03-07 12:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox