You are not logged in.
Pages: 1
I've unsuccessfully searched for an answer, so I thought I'd ask here...
I've run across a filesystem ID using the stat -f command. How is the filesystem ID provided by the stat -f command different than the filesystem's UUID provided in lsblk? Does it remain static for the lifetime of the filesystem, or does it change?
Offline
From my limited knowledge I would say that stat reports the id of the file system and lsblk shows the id of the partition. As such, they seem unrelated.
Offline
The following lsblk command will display the name each partition (name), uuid of each partition (partuuid), and, if the partition has been formatted with a filesystem, the uuid of the filesystem on the partition (uuid). I use a handful of different filesystems: fat, ext4, xfs, and btrfs. The uuids are all 32 hex-digits-long and are formatted with hyphens, except for the fat filesystems, which have 8 hex-digit uuids formatted with a hyphen.
lsblk -o name,partuuid,uuidThe following stat command displays the id of the filesystem on which the file resides. This filesystem id is only 16 hex-digits long, with no hyphens or formatting.
stat -f <filename>From what I can tell, there is more than one filesystem identifier. I am writing a bash script where it would be more efficient to use the stat command to get a filesystem identifier, so long as it is static. I hoping someone knows whether it is static or not.
Offline
See statfs.2
Offline
THANK YOU! It looks like it is a static filesystem identifier. From statfs.2:
The general idea is that f_fsid contains some random stuff such that the pair (f_fsid,ino) uniquely determines a file. Some operating systems use (a variation on) the device number, or the device number combined with the filesystem type.
Offline
Pages: 1