macOS Sierra: mounting NFS volumes
I have a Linux server with a number of NFS exports. I have been mounting them on my Mac by setting up an auto_nfs
file, and mounting them in /nfs/…
folders.
I think this may the cause of some peculiar behaviour with some applications, which don’t seem to be able to fully traverse these volumes (see Applications Not Working Properly with Networked volumes for details on what I mean by peculiar).
When I mount a SMB share, it appears as a separate volume under my computer, but not so with NFS.
I conclude that things would work better for me if I mount the NFS shares in the /Volumes
directory. But I can’t:
- The settings in
auto_nfs
require existing directories, and in Sierra, I can’t create one. - I cannot mount an NFS share using the
nfs:
protocol, since apparently this isn’t supported.
Apparently Sierra changed a few rules regarding the /Volumes
directory.
How can I mount an NFS share as an ordinary volume? Mount NFS share in /Volumes as a drive, but:
- It’s an old one and not applicable to Sierra
- The suggestions don’t work here
Solution 1:
In Finder, press cmd + k and enter the path to the NFS server/share:
For me this mounted as /Volumes/users-1 (but I already had /Volumes/Users mounted).
iMac21:~ user$ df -h /Volumes/users-1
Filesystem Size Used Avail Capacity iused ifree %iused Mounted on
192.168.7.5:/nas/users 5.4Ti 4.8Ti 292Gi 95% 261121 366027775 0% /Volumes/users-1
iMac21:~ user$
If you wanted this to happen on boot you can add it into the login items for your user.
Solution 2:
The accepted answer only works when the NFS server allows connections on non-reserved ports (i.e. >1024).
The exports man pages say it:
exportfs understands the following export options: secure
This option requires that requests originate on an Internet port less than IPPORT_RESERVED (1024). This option is on by default. To turn it off, specify insecure.
For my CentOS 7.3 box this is not the case by default and I had to add insecure to the mount.
So for MACOS client to work you'll have to add the insecure
option to your nfs server in your export
E.g.: /my/export 192.168.5.0/24(insecure)
If that's not possible: using mount
you can supply an option to allow reserved ports from the Mac side:
sudo mount -t nfs -o resvport server:/my/export nfs