Mac OS X uses the UNIX autofs utility familiar from other UNIX or Linux based operating systems. By default, the main configuration file /etc/auto_master contains the following entries:

#
# Automounter master map
#
+auto_master            # Use directory service
/net                    -hosts          -nobrowse,hidefromfinder,nosuid
/home                   auto_home       -nobrowse,hidefromfinder
/Network/Servers        -fstab
/-                      -static

Of particular interest are the first and the last non-# line: The +auto_master keyword tells autofs to search for entries in /Mounts using the directory services configured on the NFS client. This can be the local Open Directory service as well as other directory services.

The line starting with /Network/Servers containing the special map “-fstab” tells autofs to look for fstab entries that have the “net” option, i.e., the VFSOpts property of an OD mount record contains the value “net” (among others). The mount point, specified in the value of the VFSLinkDir property of an OD mount record, is ignored in this case. Instead, to generate the path to the mount point, the value “/Network/Servers” read from /etc/auto_master is concatenated with the server name and path name parts of the OD record name specifying the fstab entry.

For example, the network home directory volume is configured on our OD master and is automatically mounted by autofs with the following record:

# dscl /LDAPv3/xserve01.cpfs.mpg.de -read /Mounts/xserve01.cpfs.mpg.de:/Volumes/Users
dsAttrTypeNative:objectClass: mount top
AppleMetaNodeLocation: /LDAPv3/xserve01.cpfs.mpg.de
AppleMetaRecordName: cn=xserve01.cpfs.mpg.de:/Volumes/Users,cn=mounts,dc=xserve01,dc=cpfs,dc=mpg,dc=de
RecordName: xserve01.cpfs.mpg.de:/Volumes/Users
RecordType: dsRecTypeStandard:Mounts
VFSLinkDir: /Network/Servers/
VFSOpts: net url==afp://;AUTH=NO%20USER%20AUTHENT@xserve01.cpfs.mpg.de/Users
VFSType: url

This will create an automount trigger at /Network/Servers/xserve01.cpfs.mpg.de/Volumes/Users, and autofs will mount the home directory with guest permissions upon first access.

The last line in /etc/auto_master starting with the special path “/-“ triggers automounting direct map entries without the “net” option (VFSOpts property in the example above). They are mounted directly at the place in the local file system specified in the VFSLinkDir property.

To add a static automount entry for the folder /Volumes/RAID/Data exported by the server xserve20 in the location /data, we run the following commands on the NFS client:

# dscl . -create /Mounts/xserve20.cpfs.mpg.de:\\/Volumes\\/RAID\\/Data
# dscl . -append /Mounts/xserve20.cpfs.mpg.de:\\/Volumes\\/RAID\\/Data VFSType nfs
# dscl . -append /Mounts/xserve20.cpfs.mpg.de:\\/Volumes\\/RAID\\/Data VFSLinkDir /data

Note the double-backslash of the folder pathname on the NFS server: One backslash prevents the shell from expanding the second, and the second is needed to avoid dscl interpreting the folder pathname as a LDAP pathname. To verify success, we type

# dscl . -read /Mounts/xserve20.cpfs.mpg.de:/Volumes/RAID/Data
AppleMetaNodeLocation: /Local/Default
GeneratedUID: ADA52991-5A93-41CF-8DEE-F210DCF5F3B3
RecordName: xserve20.cpfs.mpg.de:/Volumes/RAID/Data
RecordType: dsRecTypeStandard:Mounts
VFSLinkDir: /data
VFSType: nfs

Double-backslashes here would lead to an error.

Afterwards, we tell automountd to flush its cache in order to use the new entry and return a list of all configured mount points:

# automount -c
# mount