How to reference an NFS share by UUID in the client's /etc/fstab
I have the following NFS export on my server, with fsid
set to a newly generated UUID.
/etc/exports:
/mnt/data client(ro,fsid=b07f5af6-6b10-11e3-b4c1-00248115724d)
I would then run exportfs -rav
which returns no errors, but I don't know how to mount this on the client.
If fsid
is set to 0
or root
I can mount as follows:
# mount server:/ /mnt/Media
How do I reference the UUID in the mount command or /etc/fstab file?
The following do not work:
server:$uuid
server:/$uuid
server:UUID=$uuid
server:/UUID=$uuid
Failing with the error: mount.nfs: Operation not permitted
Solution 1:
What you're wanting to do is not really what the fsid is intended for.
The fsid is meant to help uniquely identify filesystems which may not have their own unique identifiers, such as clustered filesystems. Among other things, this helps eliminate hung systems due to stale NFS mounts by letting you repair and re-export a failed filesystem from a different device, setting the same fsid for the repaired export.
If a filesystem already has a UUID, it would be used by default. Otherwise NFS uses the major and minor numbers of the device node, which isn't very useful when you are exporting a clustered filesystem. So for these you would need to explicitly set an fsid.
The fsid is set on the NFS server, and while it's used on the wire, it is not necessary or even possible to set it on the client side; the client will pick it up on its own.