Want to highlight a helpful answer? Upvote!

Did someone help you, or did an answer or User Tip resolve your issue? Upvote by selecting the upvote arrow. Your feedback helps others! Learn more about when to upvote >

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Persistent NFS mounts on OSX Lion, Issues with automount

We're having an issue with OS X and persistent NFS mounts.


The system will mount these under /Network/Servers and the symptoms are similar to when someone uses automounter (Linux) whereby a simple "ls -la" will not show anything until you address a file specifically.


I come from the Linx world, so pardon my ignorance here in how OS X is handling this :-)


If we manually mount the NFS directory under /Volumes (or anywhere else) it's fine.


Taking a look around the system, I see /etc/auto_master:


#

# Automounter master map

#

+auto_master # Use directory service

/net -hosts -nobrowse,hidefromfinder,nosuid

/home auto_home -nobrowse,hidefromfinder

/Network/Servers -fstab

/- -static


Normally for this, I would just put a simple /etc/fstab entry in there and be done with it.


The manpage for auto_master says about the "-fstab" item:



-fstab This map would normally be mounted on /Network/Servers. The key is the host name of
a server; the contents of the map entry are generated from corresponding entries in
fstab(5) data (as provided by getfsent(3)) that have the net option and that specify
mounts from that server. An entry of the form


server:/path mountpoint fstype options 0 0


will be mounted in server/path under the mount point of the -fstab map, using the
specified fstype file system type and the specified options. The mountpoint is
ignored.


(Okay, I don't know why this form insists on making a table, when I don't want one, so just ignore the formatting)



But if a user configures an NFS mount through the GUI and asks this to be mounted at login or as a part of system startup, that data is stored elsewhere -- presumably in the opendirectory?


I suspect the solution to this problem is very simple, I'm just overlooking it. All we want is a plain-Jane NFS mount with some options to it that is persistent across reboots.... not hooked in to the automounting processes.



Thanks!

Mac Pro, Mac OS X (10.7)

Posted on Feb 10, 2012 8:53 PM

Reply
2 replies

Jan 29, 2014 11:46 AM in response to Forrest

I have spent quite a bit of time figuring out automounts of NFS shares in OS X...


Somewhere along the line, Apple decided allowing mounts directly into /Volumes should not be possible:


/etc/auto_master **(see last line)**:


#

# Automounter master map

#

+auto_master # Use directory service

/net -hosts -nobrowse,hidefromfinder,nosuid

/home auto_home -nobrowse,hidefromfinder

/Network/Servers -fstab

/- -static

/- auto_nfs -nobrowse,nosuid


/etc/auto_nfs **(this is all one line)**:


/Volumes/my_mount -fstype=nfs,noowners,nolockd,noresvport,hard,bg,intr,rw,tcp,nfc nfs://192.168.1.1:/exports/my_share



This will not work (anymore!) though it "should".


$ sudo automount -cv

...

automount: /Volumes/my_mount: mountpoint unavailable



## What's the solution?

It's so easy my jaw dropped when I figured it out.

Basically, we trick OS X into thinking we're mounting * somewhere else. *


When you're talking about paths in just about any environment, the root folder is the highest path you can reach, whether it's `C:\` (windows) or `/` (*nix)


When you're at this path, attempting to reach the parent path, via `..` will keep you at the root path.


For example: `/../../../../` is still just `/`


By now, a few of you have already figured it out.


## TL;DR / Solution:


Change your `/etc/auto_nfs` config from **(this is all one line)**:


/Volumes/my_mount -fstype=nfs,noowners,nolockd,noresvport,hard,bg,intr,rw,tcp,nfc nfs://192.168.1.1:/exports/my_share


To **(this is all one line)**:


/../Volumes/my_mount -fstype=nfs,noowners,nolockd,noresvport,hard,bg,intr,rw,tcp,nfc nfs://192.168.1.1:/exports/my_share



And re-run the automounter:



$ sudo automount -cv

...

automount: /Volumes/my_mount: mounted


..... there you go! Technically `/../Volumes` is still `/Volumes`, but the automounter does not see things that way 😉


This configuration persists the mount across restarts, and creates the mountpoint automatically.


# I KNOW, RIGHT?


Feel free to send me large checks and/or high five the screen.

Persistent NFS mounts on OSX Lion, Issues with automount

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.