4

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!

  • Does sudo mount -t nfs -o vers=4 <server-ip>:/export/share NFS/Server_Media/work? – ridgy Apr 23 '17 at 21:07
  • @ridgy I'm sorry for taking so long to respond (didn't get a notification email, fixed that now). No, it does not work. It was a typo that implied I ever tried to mount <server-ip>:/export by itself, I'm only trying to mount <server-ip>:/export/share. I have edited the question to reflect that. The error says that no such directory exists (and the local directory definitely does, so it must be the server's). Could there be a different path convention between nfs3 and nfs4? – sgbrown Apr 27 '17 at 0:43
  • @ridgy Thank you for your help! I finally solved the problem. It had to do with differences in how the directory expected to be mounted between the two protocols (as seen in the answers). – sgbrown Apr 27 '17 at 1:47
1

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 allow sudo mount <...> <server-ip>:/export/share <...>, nfs4 seems to require sudo 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 using sudo 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 client NFS/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.

  • FYI: I recently found this interesting article – ridgy Apr 27 '17 at 11:07
  • Yeah, I found that article, but I think I didn't read it very well. Turns out I needed to not include the /export portion of the export path, only the exported subdirectory. Thanks for showing it to me again, though! – sgbrown Apr 29 '17 at 19:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.