Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

10.5: Create NFS mounts via symbolic links Network
As a long-time user of FreeBSD, one of the many little things I like about that system is the way in which the automounter daemon is configured by default to allow the creation of dynamic NFS mounts through symlinking. To my delight, I've discovered that Leopard's AutoFS subsystem ships with the same capability enabled by default.

If you have an NFS server called hostname providing a filesystem /path/to/share with permissions such that it's NFS-mountable by your Leopard box, you can simply change directory to /net/hostname/path/to/share on your Mac, and you will auto-magically see the shared filesystem.

To create a permanent pseudo-mount point for this share, just use a symlink: Go to the location where you want your "mount point" to appear and create the link with ln -s /net/hostname/path/to/share. This will create a symbolic link named share, which will now provide easy access to the remote filesystem. (You can, of course, give your link a different name by using a second parameter to ln -s.)

Mounts created in this way by AutoFS are dynamic; they're created when you access them, and are automatically unmounted after a while. Your Mac will be unaffected should the NFS server "go away" for any reason. While the above should "just work" in many cases, some NFS servers (particularly Linux) require you to initiate the NFS connection from a reserved port number. You can configure AutoFS to accomplish this in one of two ways:
  • Edit the file /etc/auto_master, and add resvport to the comma-separated list of options at the end of the line that starts with /net. This will affect only automatic mounts under /net.
  • Edit the file /etc/autofs.conf and add resvport to the comma-separated list of values for the configuration parameter AUTOMOUNTD_MNTOPTS. This will globally affect all AutoFS mounts.
Finally, note that this only represents the tip of the iceberg as far as AutoFS's capabilities are concerned. Read the relevant manpages for more ideas!
    •    
  • Currently 2.73 / 5
  You rated: 2 / 5 (11 votes cast)
 
[31,460 views]  

10.5: Create NFS mounts via symbolic links | 5 comments | Create New Account
Click here to return to the '10.5: Create NFS mounts via symbolic links' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.5: Create NFS mounts via symbolic links
Authored by: bcamp1973 on Dec 22, '07 11:23:16AM

Question...this applies to an "NFS" share. I'm assuming an AFP share on the network doesn't qualify for this? If so, is it possible to set up a dynamic AFP link? I'm using my workstation as a "server" to share external HDs so i can back up my laptop and my wife's Mini. If i could dynamically mount those AFP shares it would really make my life easier!



[ Reply to This | # ]
10.5: Create NFS mounts via symbolic links
Authored by: brettgross on Dec 28, '07 05:05:33AM

You can do that using a plain-old Finder alias. It will automatically mount the server when you double-click - or single-click in column view.



[ Reply to This | # ]
10.5: Create NFS mounts via symbolic links
Authored by: brettgross on Dec 28, '07 05:09:13AM

That was supposed to be a response to the first commenter. As someone is bound to point out, you can't use aliases with Unix apps because they don't understand aliases. This tip is great for them!



[ Reply to This | # ]
10.5: Create NFS mounts via symbolic links
Authored by: Doobla on Jan 14, '08 01:55:22PM

I kept getting an Input/Output error when trying to mount the share using this tip. The problem was simply that I needed to add the server's hostname into leopard's /etc/hosts file.

I registered an account so that I could save somebody else the headache I have had over the last couple of days (off and on) when trying to make this work. I hope you find it useful.



[ Reply to This | # ]
10.5: Create NFS mounts via symbolic links
Authored by: smudger-smith on Jun 12, '08 12:47:47PM

I'd love to be able to access an NFS share on my server but all I get is Operation not permitted as in:
imac:~ chris$ cd /net/server/home/chris
-bash: cd: /net/server/home/chris: Operation not permitted
I've followed all the advice in this thread without any luck. The Samba shares on the same server are accessible without any problems - what's the score?



[ Reply to This | # ]