On Sat, Nov 28, 2020 at 4:20 AM Richard Kimberly Heck rikiheck@lyx.org wrote:
On 11/26/20 3:26 PM, Tom H wrote:
You have to be careful when using "fsid=0".
- If you don't set it for any of the shares:
a) "/" is the "fsid=0" filesystem by default (this wasn't the case in early nfsv4 implementations; verify with "cat /proc/fs/nfsd/exports")
b) If you have "/srv/nfs/share1 nfs_client(nfs_options)" in "/etc/exports", you mount this share with "mount nfs_server:/srv/nfs/share1 nfs_mountpoint1"
- If you set it for "/srv/nfs":
a) If you have "/srv/nfs/share1 nfs_client(nfs_options)" in "/etc/exports", you mount this share with "mount nfs_server:/share1 nfs_mountpoint1"
b) If you want to share "/home/user/files":
you bind-mount "/home/user/files" to "/srv/nfs/share2"
you add "/srv/nfs/share2 nfs_client(nfs_options)" to
"/etc/exports"
- you mount this share with "mount nfs_server:/share2
nfs_mountpoint2"
Thanks. I appreciate the info.
You're most welcome. But I made a mistake. "cat /proc/fs/nfsd/exports" will be empty unless at least one share's been mounted. "cat /var/lib/nfs/etab" (or "exportfs" or "showmount -e") will list the shares set up by "exportfs -r" in "nfs-server.service".
In the nfsv4 case, "cat /proc/fs/nfsd/exports" varies:
NFSv4 only - fsid=0 set
root ~ # rpcinfo -s | grep 'nfs ' 100003 4 tcp6,tcp nfs superuser
root ~ # cat /etc/exports.d/nfs.exports /srv/nfs 127.0.0.1/8(ro,...,fsid=0) /srv/nfs/share 127.0.0.1/8(rw,...)
root ~ # cat /var/lib/nfs/etab /srv/nfs/share 127.0.0.1/8(rw,...) /srv/nfs 127.0.0.1/8(ro,...,fsid=0,...)
root ~ # mount 127.0.0.1:/share /mnt
root ~ # cat /proc/fs/nfsd/exports # Version 1.1 # Path Client(Flags) # IPs /srv/nfs 127.0.0.1/8(ro,...,fsid=0,...)
root ~ #
NFSv4 only - fsid=0 unset
root ~ # rpcinfo -s | grep 'nfs ' 100003 4 tcp6,tcp nfs superuser
root ~ # cat /etc/exports.d/nfs.exports /srv/nfs/share 127.0.0.1/8(rw,...)
root ~ # cat /var/lib/nfs/etab /srv/nfs/share 127.0.0.1/8(rw,...)
root ~ # mount 127.0.0.1:/srv/nfs/share /mnt
root ~ # cat /proc/fs/nfsd/exports # Version 1.1 # Path Client(Flags) # IPs /srv/nfs/share 127.0.0.1/8(rw,...) /srv 127.0.0.1/8(ro,...,v4root,...) / 127.0.0.1/8(ro,...,v4root,fsid=0,...) /srv/nfs 127.0.0.1/8(ro,...,v4root,...)
root ~ #
NFSv3 only
root ~ # rpcinfo -s | grep 'nfs ' 100003 3 tcp6,tcp nfs superuser
root ~ # cat /etc/exports.d/nfs.exports /srv/nfs/share 127.0.0.1/8(rw,...)
root ~ # cat /var/lib/nfs/etab /srv/nfs/share 127.0.0.1/8(rw,...)
root ~ # mount 127.0.0.1:/srv/nfs/share /mnt
root ~ # cat /proc/fs/nfsd/exports # Version 1.1 # Path Client(Flags) # IPs /srv/nfs/share 127.0.0.1/8(rw,...)
root ~ #