I am attempting to mount an NFS4 export from an Ubuntu server onto a Mac client connected to the local network. The Mac client can mount the nfs export using nfs3, however it appears unable to do so using nfs4.
Server (Ubuntu)
The directory to be shared has been fstab
bound to /export/share
, and that directory exported via /etc/exports
.
user@<server>:~$ tail -n 2 /etc/exports
/export *(insecure,no_subtree_check,rw,sync,fsid=0)
/export/share *(insecure,no_subtree_check,rw,nohide,sync)
Client (Mac OS 10.11)
The client is able to see both exports from the server
Macintosh:~ user$ showmount -e <server-ip>
Exports list on <server-ip>:
/export/share *
/export *
The client is able to mount the drive using nfs3 (onto a local mount-point ~/NFS/Server_Media/
)
Macintosh:~ user$ sudo mount -t nfs <server-ip>:/export/share NFS/Server_Media/
or (both yield identical results)
Macintosh:~ user$ sudo mount -t nfs -o vers=3 <server-ip>:/export/share NFS/Server_Media/
Proof of nfs3 (under the NFS Parameters: vers=3)
Macintosh:~ user$ nfsstat -m
/Users/user/NFS/Server_Media from <server-ip>:/export/share
-- Original mount options:
General mount flags: 0x0
NFS parameters:
File system locations:
/export/share @ <server-ip> (<server-ip>)
-- Current mount parameters:
General mount flags: 0x4000000 multilabel
NFS parameters: vers=3,tcp,port=2049,nomntudp,hard,nointr,noresvport,negnamecache,callumnt,locks,quota,rsize=32768,wsize=32768,readahead=16,dsize=4096,nordirplus,nodumbtimr,timeo=10,maxgroups=16,acregmin=5,acregmax=60,acdirmin=5,acdirmax=60,nomutejukebox,nonfc,sec=sys
File system locations:
/export/share @ <server-ip> (<server-ip>)
Status flags: 0x0
Export is unmounted to test nfs4
Macintosh:~ user$ sudo umount NFS/Server_Media/
Client attempts to mount nfs4
Macintosh:~ user$ sudo mount -t nfs -o vers=4 <server-ip>:/export/share NFS/Server_Media/
mount_nfs: can't mount /export/share from <server-ip> onto /Users/user/NFS/Server_Media: No such file or directory
Curiously, Finder's Connect to Server...
operation (Cmd
+ k
) is able to connect using nfs4 by entering into the Server Address
:
nfs://vers=4,<server-ip>:/export/share
However, this cannot be automated without knowing the Terminal commands, and it only mounts to /Volumes/share/
, instead of the intended client mount-point.
The literature is surprisingly bare when it comes to Mac and NFS4, at least as far as I could tell. Any help with this would greatly appreciated!
Best Answer
After experimenting and searching for a while longer, I was finally able to solve it.
As found in this thread (about Fedora, but close enough to Mac), it seems that, while
nfs3
will allowsudo mount <...> <server-ip>:/export/share <...>
,nfs4
seems to requiresudo mount <...>
<server-ip>:/
<...>
(mounting the "root" directory of the export, as opposed to the exported directory itself). After correcting that, my directories mount fine, although it appears to tether the/export
directory instead of the/export/share
directory (adding one more directory level). Not a big deal, but worth noting if there happens to be a fix for that. EDIT: I was wrong, turns out you can export the/share
directory specifically by usingsudo mount <...>
<server-ip>:/share
<...>
, basically just skipping the root directory of the exported directory.As an interesting side-note, if I change the
/etc/export
line on the server from/export/share *(insecure,no_subtree_check,rw,nohide,sync)
to/export/share *(insecure,
fsid=0
,no_subtree_check,rw,nohide,sync)
, the target directory on the clientNFS/Share_Media
seems to become infinitely self-nested once mounted, for some reason. Just figured I'd include that observation incase someone from the future has the same problem with their flying car.