Mac OS X Panther for Unix Geeks
automount |
automount -help automount -V automount [-m map_directory map [-mnt mount_directory ] [-1]]... [-a mount_ directory ] [-d] [-D { mount nsl options proc select all }]... [-f] [-s] [-tcp] [-tl timeout ] [-tm timeout ] |
Description
Provides transparent, automated access to NFS and AFP shares. When running, any filesystem access to map_directory is intercepted by automount . Typically, automount will then set up a symbolic link from map_directory or one of its subdirectories to a mount point under mount_directory , automatically creating directories and mounting remote volumes as needed. It will also unmount remote volumes that have been idle for too long. Directories or mounts set up by automount are removed when automount exits.
automount makes use of maps to determine how to mount volumes. When using a file as a map, the format is similar to that used by NFS automounters on other Unix platforms. Each entry in the file consists of a single line, either a comment beginning with a hash mark ( # ), or a mount directive of the form:
subdirectory server:/pathname
If this line were included in a file named /etc/mountmaps , and automount were called like so:
# automount -m /mount_directory /etc/mountmaps
upon accessing /mount_directory , automount would mount the NFS-exported server:/pathname on /private/mount_directory/subdirectory and create a symlink to that mount point from /mount_directory/subdirectory .
At one time it was also possible to use a map stored in a NetInfo database under /mountmaps/ , but that functionality has been deprecated in future versions of Mac OS X.
AFP URLs
The format of the AFP URLs in the automount examples is described in the manpage for mount_afp , but there are certain constraints you should be aware of:
If user authentication is required, then you have two options. The first is to specify the necessary authentication information in the URL like so: afp:// username : password @ server / share_name However, this makes the authentication password available to anyone with access to the configuration stored in Open Directory. The other option is to leave out the authentication parameters: afp:// server / share_name In this case, a user logged into the graphical console is presented with an authentication dialog to enable access to the share. Of course, if no one is logged into the GUI, this won't work, and the mount attempt will fail. |
In addition to map files, there are several special maps available. Foremost among them are those used by default on Mac OS X systems, -fstab , -static , and -nsl . The following commands are run from the NFS startup item:
automount -m /Network -nsl automount -m /automount/Servers -fstab -mnt /private/var/automount/Network/ Servers[RETURN] -m /automount/static -static -mnt /private/var/automount
Both -fstab and -static maps use similar configuration formats, stored in an Open Directory database under /mounts/ . The following configuration line triggers automount when using the -fstab map:
server:/subdirectory /mount_point url[RETURN] net,url==afp://;AUTH=NO%20USER%20AUTHENT@server/share_name 0 0
|
There are several options for getting this configuration into Open Directory; one is to use niload fstab domain , then enter the configuration line, followed by Ctrl-D. The configuration will be stored in Open Directory like this (as displayed by nidump -r /mounts domain ):
{ "name" = ( "mounts" ); CHILDREN = ( { "dir" = ( "/mount_point" ); "dump_freq" = ( "0" ); "name" = ( "server:/subdirectory" ); "opts" = ( "net", "url==afp://;AUTH=NO%20USER%20AUTHENT@server/share_name" ); "passno" = ( "0" ); "vfstype" = ( "url" ); } ) }
The net option is the signal for automount to use this configuration line with the -fstab map. If the net option is not used, this configuration line is picked up by the -static map.
With this configuration, and automount called like so:
# automount -m /automount/Servers -fstab
upon accessing /automount/Servers , automount mounts share_name from server on /private/var/automount/Network/Servers/server/subdirectory , and creates a symlink from /automount/Servers/server . (Alternatively, the mount may be accessed via /Network/Servers/server , thanks to a symlink created by the NFS startup item.) The configured mount point (the value of the dir property) is ignored by the -fstab map.
|
While the -static map uses a configuration very much like this for -fstab , its mounting and linking behavior is significantly different. With a configuration like this ( viewed as the output of nidump fstab domain ):
server:/subdirectory /mount_point url [RETURN] url==afp://;AUTH=NO%20USER%20AUTHENT@server/share_name 0 0
and automount called like so:
# automount -m /automount/static -static -mnt /private/var/automount
upon accessing /mount_point , automount mounts share_name from server on /private/var/automount/mount_point , creates a symlink to this directory from /automount/static/mount_point , and then makes another from /mount_point to /automount/static/mount_point . The configured server:/subdirectory (the value of the name property) is ignored by the -static map for AFP shares. (Incidentally, the term "static" is a misnomer. Mounts are made dynamically when they're accessed, just as with the -fstab map.)
|
The -nsl map uses the Network Services Location service discovery API to automatically find available shares on the network (just as the Finder's Connect to Server... menu item does) and create mounts for them. With automount invoked like this:
# automount -m /Network -nsl
discovered shares are mounted on subdirectories of /private/var/automount/Network/server , with a symlink created from /Network/server .
|
Another special map is the -user map, which doesn't actually cause any remote filesystems to be mounted on its own. It merely sets up symlinks to every user account's home directory from the map_directory , which may be useful if you want a single place to look in for everyone's home directory. But proceed cautiously if you have a very large number of user accounts.
The -host map is meant to automatically mount NFS exports from hosts listed in a NIS hosts map when accessing a subdirectory of the map_directory with the same name as the host. For example, accessing /net/hostname/export should mount hostname:/export if /net is the map_directory . This is similar to the - hosts map of other NFS automounters.
The -null map mounts... well, nothing. It will, however, intercept filesystem calls for the map_directory , thus effectively mounting an empty directory over whatever might have been there before. In the original automount , from which NeXT's and Apple's versions are descended, this was meant to nullify configuration entries included from a network-wide NIS map.
When running in daemon mode, automount stores its process ID in /var/run/automount.pid , and responds to SIGHUP by reloading its configuration.
Options/Usage
-
- -1
-
Creates directories on the path to a -fstab mount point one at a time, as they're traversed, rather than creating the entire path to a mount point when the mount is accessed. However, using this option leads to I/O errors when trying to access the mount.
-
- -a
-
Specifies the directory in which mounts are made. Symbolic links from the directory specified in the - m option are used to access these mounts. The default directory is /private/var/automount .
-
- -d
-
Sends debugging output to standard error, and prevents daemonization.
-
- -D
-
Outputs debugging messages of the specified type. If the - d option is used, output is to standard error; otherwise it's via syslog . Multiple occurrences of this option may be used to specify multiple types.
-
- -f
-
Used internally by automount to indicate that the process has already forked during daemonization. (You can see in the output of ps -ax that the automount daemon runs with the - f flag, even though it isn't invoked that way from the NFS startup item.)
-
- -help
-
Prints a usage statement to standard output.
-
- -m
-
Uses the specified map to mount shares and create symlinks from the specified directory to the mount points. The map argument can be an absolute pathname to a file, a map in the /mountmaps/ directory of an Open Directory domain, or one of the special values -fstab , -host , -nsl , -null , -static , or -user . Multiple - m options enable the use of multiple maps. In the absence of a - m option, automount attempts to find maps in Open Directory.
-
- -mnt
-
Like - a , but specific to a single map.
-
- -s
-
Supposedly creates all mounts at startup, and never unmounts them. However, mounts are still attempted only upon access when using this option, at which point automount prints a bus error and dumps core .
-
- -tcp
-
Attempts to mount NFS volumes over TCP, instead of the default UDP.
-
- -tl
-
Specifies a time-to-live (TTL) value for mount names , in seconds. After the timeout expires , mounts are rechecked. A timeout of sets an infinite TTL. The default TTL is 10000 .
-
- -tm
-
Specifies a timeout to retry failing mounts, in seconds. The timeout roughly doubles with each mount attempt, until giving up after a few tries . The default timeout is 20 .
-
- -V
-
Prints version number and host information to standard output.
Location
/usr/ sbin