From Segfault
Jump to: navigation, search


Add a map file to /etc/auto.master:


/mnt/smb /etc/auto.cifs
/mnt/nfs /etc/auto.nfs

Add the file systems to be mounted to respective map file:

$ cat /etc/auto.nfs
foo  -fstype=nfs,rw,nodev,nosuid,noexec,bg,intr,sec=sys  host1:/mnt/foo
bar  -fstype=nfs,ro,nodev,nosuid,noexec,bg,intr,sec=sys  host2:/mnt/bar

With that in place, autofs should just work:

$ ls -go /mnt/nfs
total 0

$ ls -go /mnt/nfs/foo
total 92
drwx--x--x 11  4096 Dec  7 00:10 dir0
drwxr-xr-x  8  4096 Jan  2 16:11 dir1
drwxr-xr-x 88  4096 Dec 31  2013 dir2


We can use the auto_master file or DiskUtility to get automount(8) working.


Let's create the mount points first, both for SMB and NFS:

$ mkdir /mnt/{nfs,smb}/{a,b}

Then we create automount maps for each protocol:

$ cat /etc/auto_nfs 
/mnt/nfs/a -fstype=nfs,rw,resvport
/mnt/nfs/b -fstype=nfs,ro,resvport

$ cat /etc/auto_smb 
/mnt/smb/a -fstype=smbfs,rw ://
/mnt/smb/b -fstype=smbfs,ro ://

With that in place, we have to include both files in auto_master(5):

$ grep -v ^\# /etc/auto_master
+auto_master            # Use directory service
/-                      auto_smb
/-                      auto_nfs

Tell automountd(8) to flush any cached information:

automount -v -c

Sometimes it's necessary to restart automountd:

launchctl stop
launchctl stop
launchctl start
launchctl start


We can try the same with Disk Utility. Let's create the mount point first:

$ mkdir /mnt/nfs/a

Open DiskUtility:

$ open -a Disk\ Utility
  1. Click FileNFS Mounts'
  2. Click + to add a new NFS mount
  3. Remote NFS URL should be something like nfs://
  4. Mount Location should be something like /mnt/nfs/a
  5. We might have to add resvport to the Advanced Mount Parameters
  6. Click Verify
  7. Click Close

The new mounts should be available immediately.