How to fill in the fsid for file systems?
Rick Macklem
rmacklem at uoguelph.ca
Mon Oct 29 15:56:08 UTC 2018
Hi,
I have been working with Josh Paetzel on a patch to add support for the "fsid=N"
option (like what Linux has) to /etc/exports. (It is used to ensure that the fsid
for a file system doesn't change when migrated to a different machine, so that
file handles don't change.)
We have code that seems to work, but it is not obvious what should be filled
in to f_fsid.val[1]?
- cd9660 and msdosfs just set it to vfc_typenum
- ZFS sets the low order 8bits to vfc_typenum and the high order 24 bits to the
high order bits of its "56bit objset unique ID"
- UFS uses a value fs_id[1] in the superblock that appears to be filled in with a
random value at fs creation time by newnfs(8).
It seems "fsid=N" does need to set f_fsid.val[1]. I can think of two possibilities:
1 - Do what ZFS does and set the low order 8bits to vfc_typenum and the high
order 24bits from bits 32->55 of "N".
or
2 - Just fill the 32bits in with the high order (32->63) bits of "N" and forget about
vfc_typenum.
The only reason I can see for using vfc_typenum is to avoid collisions (same fsid value)
with fsids for mounts of other file system types.
What do others think? rick
More information about the freebsd-fs
mailing list