GNU bug report logs -
#64588
BUG: stat -f incorrectly reports a BTRFS device as a tmpfs
Previous Next
Full log
Message #12 received at control <at> debbugs.gnu.org (full text, mbox):
tag 64588 notabug
close 64588
stop
On 12/07/2023 23:46, support wrote:
> coreutils version 9.1-1 on Debian testing, but also exists in previous
> versions.
>
>
> Example:
>
> stat -f /dev/sdb
> File: "/dev/sdb"
> ID: eb91af7d7bda02dd Namelen: 255 Type: tmpfs
> Block size: 4096 Fundamental block size: 4096
> Blocks: Total: 2012292 Free: 2012292 Available: 2012292
> Inodes: Total: 2012292 Free: 2011839
>
>
> stat -f /dev/disk/by-uuid/6abaa68a-2670-4d8b-8d2a-fd7321df9242
> File: "/dev/disk/by-uuid/6abaa68a-2670-4d8b-8d2a-fd7321df9242"
> ID: eb91af7d7bda02dd Namelen: 255 Type: tmpfs
> Block size: 4096 Fundamental block size: 4096
> Blocks: Total: 2012292 Free: 2012292 Available: 2012292
> Inodes: Total: 2012292 Free: 2011839
>
>
> blkid /dev/sdb
> /dev/sdb: UUID="6abaa68a-2670-4d8b-8d2a-fd7321df9242"
> UUID_SUB="d15f1846-8f18-4ba0-9e2a-a6aaa7bbf83b" BLOCK_SIZE="4096"
> TYPE="btrfs"
>
>
> Not sure why the reported fstype is wrong but obviously it is a bug.
This is expected. From the info docs:
"stat does not search for specified device nodes in the file system list,
instead operating on them directly"
I.e. /dev/sdb is a device node in the /dev file system, which is tmpfs.
You can confirm this with:
strace -e statfs stat -f -c %T /dev/sdb
strace -e statfs df --output=fstype /dev/sdb
If you wanted to operate on a file system mounted on the device node you could:
stat -f $(df --output=target /dev/sdb | tail -n1)
cheers,
Pádraig
This bug report was last modified 1 year and 313 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.