Saturday, December 14, 2013

Auto Mounting NFS Shares in Mountain Lion

Network File System (NFS) is the most common way for file sharing on Network-attached storage (NAS) server in *NIX systems like, Mac OS X (Darwin), Linux distributions, FreeBSD, etc.
Mountain Lion, can be setup as an NFS client to access shared files across the network.

By default, Autofs mounts network files systems are defined via Directory Services, using /etc/fstab and NFS file systems, all accordingly to its master table, /etc/auto_master.

If you want to define mount points not covered by Autofs default configuration, without resorting to Directory Services or the deprecated /etc/fstab, you will have to add a mapping (via a auto_* file) to auto_master.

This is the way we found to best suit our needs.

1. Create the folder "/etc/automounts"
sudo mkdir -p /etc/automounts

2. Create the file "nfs"
cd /etc/automounts
 sudo touch nfs
sudo vi nfs

3. Add your NFS shared servers, options and mounting paths, for example:

   /chitara/videos             fstype=nfs,soft,intr,rw,tcp
   /chitara/Musica  fstype=nfs,soft,intr,acl,tcp
   /chitara/Tutoriales fstype=nfs,soft,intr,acl,tcp
   /leonidas/datos fstype=nfs,soft,intr,acl,tcp
   /leonidas/proyectos      fstype=nfs,soft,intr,acl,tcp
    /mummra/remisiones   fstype=nfs,soft,intr,acl,tcp

4. Edit the file "/etc/auto_master"
Add the path where nfs file is

This way, we can have a much better control on the workstations running OS X Mountain Lion.