How Linux sets NFS filesystem ID on the wire
These tests were peformed by capturing NFS traffic with Wireshark and looking for the fsid major and minor numbers.
# tshark -T fields -e nfs.fsid4.major -e nfs.fsid4.minor port 2049
Errors and omissions excepted. All mistakes my own. If you don’t know what I’m talking about or why this would be useful to know then this post will not be very interesting.
knfsd
With UUID fsid
You have an export like this:
/export -rw,fsid=01234567-89ab-cdef-dead-beefcafebabe 192.168.0.0/24
The fsid is found by considering the UUID as two unsigned 64-bit hexadecimal integers. In the example above they would be 0x123456789abcdef and 0xdeadbeefcafebabe. The major number is therefore 81985529216486895 and the minor number is 16045690984503098046.
With numeric fsid
You have an export like this:
/export -rw,fsid=1234 192.168.0.0/24
The fsid is found by setting the major number to the number specified and zeroing the minor number. In the example above the major number is 1234 and the minor number is 0.
The rule holds for the pseudo-root filesystem with fsid=0 – alternatively specified as fsid=root.
With no explicit fsid
If your export doesn’t specify fsid the kernel will look for the exported filesystem UUID and apply the same logic above.
For example on my test machine I exported the root filesystem.
# xfs_admin -l /dev/dm-0 UUID = e2f1c059-e6c2-403d-9c80-ab7a9f86b91f
So the major number is 16353063214315094077 and the minor number is 11277202010086488351.
Ganesha
With Filesystem_Id
No prizes for guessing what the Filesystem_Id parameter does.
EXPORT { Filesystem_Id = 1234.5678; ... }
In the example above the major number is 1234 and the minor number is 5678.
Yes, you can make the fsid for an export the same as given by knfsd.
Filesystem_Id = 81985529216486895.16045690984503098046;
With no explicit Filesystem_Id
The documentation states that the fsid defaults to 666.666 if Filesystem_Id is not explicitly configured. In my testing that statement didn’t appear to hold true. Since my goal was to figure out how to set the fsid to be consistent – so I could fail over the IP providing NFS service – I didn’t delve too deeply into this case.