How do I configure the fsid option in an NFS server's /etc/exports file?
Environment
- Red Hat Enterprise Linux 6
- Red Hat Enterprise Linux 7
- Red Hat Enterprise Linux 8
- Red Hat Enterprise Linux 9
- NFSv3 and NFSv4 exports
Issue
- How do I configure the
fsidparameter in an NFS server's/etc/exportsfile? - What does the
fsidoption do in NFS?
Resolution
NFSv3 and NFSv4
-
The
fsidoption is used to uniquely identify a given export to the NFS server. -
Usually the UUID or device number is used and this is done transparently, however there may be situations where a filesystem does not have a UUID or does not reside on a device, so the NFS server must be given a unique number to identify the export.
-
An example of usage would be:
/example1 *(rw,fsid=10001)
/example2 *(rw,fsid=10002)
- It is not correct to have two exports defined with the same
fsid.
NFSv4
-
Under NFSv4, the special
fsid=0is used to identify the root of the NFS share. A good example of this usage is given within What happens if two NFS shares are exported with the fsid=0 option?. -
It is not correct to have two exports defined with
fsid=0.
Related
Root Cause
- From
man exports:
fsid=num|root|uuid
NFS needs to be able to identify each filesystem that it exports. Normally it
will use a UUID for the filesystem (if the filesystem has such a thing) or the
device number of the device holding the filesystem (if the filesystem is
stored on the device).
As not all filesystems are stored on devices, and not all filesystems have
UUIDs, it is sometimes necessary to explicitly tell NFS how to identify a
filesystem. This is done with the fsid= option.
For NFSv4, there is a distinguished filesystem which is the root of all
exported filesystem. This is specified with fsid=root or fsid=0 both of which
mean exactly the same thing.
Other filesystems can be identified with a small integer, or a UUID which
should contain 32 hex digits and arbitrary punctuation.
Linux kernels version 2.6.20 and earlier do not understand the UUID setting so
a small integer must be used if an fsid option needs to be set for such
kernels. Setting both a small number and a UUID is supported so the same
configuration can be made to work on old and new kernels alike.
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.