workaround for buggy GNU df
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
Signature · 6 lines
Ullrich Horlacher Server und Virtualisierung Rechenzentrum TIK Universitaet Stuttgart E-Mail: [email protected] Allmandring 30a Tel: ++49-711-68565868 70569 Stuttgart (Germany) WWW: https://www.tik.uni-stuttgart.de/ REF:<[email protected]>
Quoted 10 lines · Ulli Horlacher
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/testroot@fex:/test/test/test# grep /test /proc/mounts || echo nope nopeThe mountpoint is wrong, the kernel knows the truth.
How did you get this to happen?
Quoted 6 lines · Phillip Susi
Quoted 6 lines
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
Quoted 6 lines
Quoted 4 lines
root@fex:/test/test/test# grep /test /proc/mounts || echo nope nopeThe 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.
Quoted 10 lines · Remi Gauvin
Quoted 9 lines · Phillip Susi
Quoted 9 lines
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/testroot@fex:/test/test/test# grep /test /proc/mounts || echo nope nope
Quoted 9 lines
Quoted 3 lines
Quoted 1 line
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:~>
Quoted 22 lines · Andrei Borzenkov
Quoted 10 lines · Remi Gauvin
Quoted 9 lines · Phillip Susi
Quoted 9 lines
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/testroot@fex:/test/test/test# grep /test /proc/mounts || echo nope nopeQuoted 9 lines
Quoted 3 lines
Quoted 1 line
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.
Quoted 9 lines
bor@tw:~> df -T /home
Filesystem Type 1K-blocks Used Available Use% Mounted on/dev/sda2btrfs 39835648 20799988 16982220 56% /home
bor@tw:~> df -T/home/bor
Filesystem Type 1K-blocks Used Available Use% Mounted on/dev/sda2btrfs 39835648 20799988 16982220 56% /home
bor@tw:~> df -T/home/bor/bin
Filesystem Type 1K-blocks Used Available Use% Mounted on/dev/sda2btrfs 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
Signature · 6 lines
Ullrich Horlacher Server und Virtualisierung Rechenzentrum TIK Universitaet Stuttgart E-Mail: [email protected] Allmandring 30a Tel: ++49-711-68565868 70569 Stuttgart (Germany) WWW: https://www.tik.uni-stuttgart.de/ REF:<[email protected]>
Quoted 22 lines · Ulli Horlacher
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/testroot@fex:/test/test/test# grep /test /proc/mounts || echo nope nopeThe 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
Quoted 1 line
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 BAllocation: 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:22fstat 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
Signature · 6 lines
Ullrich Horlacher Server und Virtualisierung Rechenzentrum TIK Universitaet Stuttgart E-Mail: [email protected] Allmandring 30a Tel: ++49-711-68565868 70569 Stuttgart (Germany) WWW: https://www.tik.uni-stuttgart.de/ REF:<[email protected]>