Discussion:
bug#33303: hex id for file system is incorrect or non-standard using uil 'id'
(too old to reply)
L A Walsh
2018-11-07 16:07:50 UTC
Permalink
Was looking to see when the underlying filesystem
changed in a path.
stat -f -c%f /
82100000000
stat -f -c%i /var
82200000000

There are way too many zeros, not to mention being left justfied
with zeros.

What I might expect to see is more like this:
821
or
822
mountpoint -d /
8:33
mountpoint -d /tmp
8:34
Bernhard Voelker
2018-11-07 16:58:39 UTC
Permalink
tag 33303 notabug
close 33303
thanks
Post by L A Walsh
Was looking to see when the underlying filesystem
changed in a path.
 stat -f -c%f /
82100000000
stat -f -c%i /var
82200000000
There are way too many zeros, not to mention being left justfied
with zeros.
821
or
822
I think you didn't notice that -f changes the functionality of the "%f" format.

From 'stat --help':

-f, --file-system display file system status instead of file status

...
Valid format sequences for file systems:
...
%f free blocks in file system

You can see with strace that the printed value comes from 'f_bfree':

$ strace -ve statfs stat -f -c '%f' /
...
statfs("/", {..., f_bfree=1561242, ...}, ...) = 0
1561242
+++ exited with 0 +++

As such, I'm marking this as "not a bug" in our bug tracker.
Of course, discussion may continue, and we can re-open the issue if needed.

Have a nice day,
Berny
Bernhard Voelker
2018-11-07 19:22:13 UTC
Permalink
Post by Bernhard Voelker
tag 33303 notabug
close 33303
thanks
Post by L A Walsh
Was looking to see when the underlying filesystem
changed in a path.
 stat -f -c%f /
82100000000
stat -f -c%i /var
82200000000
sorry, I overlooked the %i example:

%i comes from the f_sid member of the returned structure from statfs(),
just printed in hex format:

statfs("/", {..., f_fsid={val=[3357913161, 1752493561]}, ...}) = 0
...
write(1, "c825b0496874edf9\n", 17) = 17
c825b0496874edf9
close(1) = 0
close(2) = 0
exit_group(0) = ?
+++ exited with 0 +++

$ printf '%x' 3357913161 1752493561
c825b0496874edf9

So it seems to be a quite some strange incident that your f_bfree value
is so eye-catchingly close to f_fsid.

Have a nice day,
Berny
L A Walsh
2018-11-08 10:53:46 UTC
Permalink
Post by L A Walsh
Was looking to see when the underlying filesystem
changed in a path.
stat -f -c%f /
82100000000
stat -f -c%i /var
82200000000
---
Both should be %i for the file system ID in hex.
How is it that the fs ID is the same as the device
number of the file system?

i.e.
8:34 = 8:21 in hex
8:33 = 8:22 in hex
Bernhard Voelker
2018-11-08 14:19:34 UTC
Permalink
    Both should be %i for the file system ID in hex.
How is it that the fs ID is the same as the device
number of the file system?
i.e.
8:34 =  8:21 in hex
8:33 =  8:22 in hex
dunno - I assume this is the secret of the implementation of the file system.
Did you verify with strace? I'm quite sure 'stat' only forwards the
values from the system call.

Have a nice day,
Berny
L A Walsh
2018-11-29 10:05:53 UTC
Permalink
This post might be inappropriate. Click to display it.
Loading...