cancel
Showing results for 
Search instead for 
Did you mean: 

automount

 
Waugh
Frequent Advisor

automount

Hi,

what is the difference between automount and autofs

Regards
Rkumar
3 REPLIES
Dennis Handly
Acclaimed Contributor

Re: automount

You should only be using the latest enhanced autofs.
Tingli
Esteemed Contributor

Re: automount

autofs decides the config for automountd, while automount decides the mount points for automount.
Taifur
Respected Contributor

Re: automount

Hi rkumar,

The difference between automount and autofs as follows,

AutoFS consists of the following components:

1. The automount command, for reading automounter maps into memory.

2. The AutoFS file system.

3. The automountd daemon, which automounts file systems when they are requested by users.

The automount command is invoked at system startup. It reads the automounter master map to create the initial set of AutoFS mount points in the internal mount table, /etc/mnttab. The automounted file systems are not automatically mounted at startup. They are points
under which file systems will be mounted later, when users request access to them.

When AutoFS receives a request to mount a file system that is not currently mounted, it calls the automountd daemon, which actually mounts the requested file system. Once the file system is mounted, further access does not require any action from the automountd daemon. Unlike the old automounter, AutoFS mounts file systems at the configured mount points. It does not maintain its own directory of mount points with symbolic links into it the way the old automounter does.

The automountd daemon is completely independent from the automount command. Because of this separation, it is possible to add, delete, or change automounter map information without having to stop and restart the automountd daemon.

After system startup, when the AutoFS mount points are set up, you can modify the set of mount points by modifying the automounter maps and running the automount command to read them and modify the mount
table accordingly. You do not have to stop and restart AutoFS. If an automounted file system has been idle for 5 minutes, AutoFS unmounts it.

For more information on AutoFS, type man 1M automount or man 1M automountd at the HP-UX prompt.





Autofs
===========
If AUTOFS is set to 1 (one), automount executes /usr/lib/netsvc/fs/autofs/automount, or /usr/lib/netsvc/fs/enh_autofs/automount (if Enhanced AutoFS is installed). See the DESCRIPTION â Autofs section.

Automounter
If AUTOFS is set to 0 (zero) or it does not exist in /etc/rc.config.d/nfsconf, automount executes /usr/lib/netsvc/fs/automount/automount. See the DESCRIPTION â Automounter section.

DESCRIPTION â Autofs
The automount command installs autofs mount points and associates an automount map with each mount point. The autofs filesystem monitors attempts to access directories within it and notifies the automountd daemon (see automountd(1M)). The daemon uses the map to locate a filesystem, which it then mounts at the point of reference within the autofs filesystem. You can assign a map to an autofs mount using an entry in the /etc/auto_master map or a direct map.

If the filesystem is not accessed within an appropriate interval (5 minutes by default, or, for Enhanced AutoFS, 10 minutes by default), the automountd daemon unmounts the file system.

The file /etc/auto_master determines the locations of all autofs mount points. By default, this file contains the following entry:

# Master map for automounter
#
/net -hosts -soft,nosuid,nobrowse The first field in the master file specifies a directory on which an autofs mount will be made, and the second field specifies the automounter map to be associated with it. Mount options may be supplied as an optional third field in the entry. These options are used for any entries in the map that do not specify mount options explicitly. Note that the -nobrowse option is only available with Enhanced AutoFS. The automount command is usually run without arguments. It compares the entries /etc/auto_master with the current list of autofs mounts in /etc/mnttab and adds, removes, or updates autofs mounts to bring the /etc/mnttab up to date with the /etc/auto_master. At boot time, it installs all autofs mounts from the master map. Subsequently, it may be run to install autofs mounts for new entries in the master map or a direct map, or to perform unmounts for entries that have been removed.

If the first field specifies the directory as /-, automount treats the second field as the name of a direct map. In a direct map, each entry associates the full path name of a mount point with a remote file system to mount.

If the first field is a path name, the second field names an indirect map or a special map (described below). An indirect map contains a list of the subdirectories within the indicated directory. With an indirect map, it is these subdirectories that are mounted automatically.

The automounter maps, including the auto_master map, may be distributed by NIS, NIS+, or LDAP (only available with Enhanced AutoFS). The Name Service Switch configuration file, /etc/nsswitch.conf, determines where the automount command will look for the maps.

Options
-f master-file
Specify a local master file for initialization.

When the -f option is used and the master file specified is not found, then automount defaults to /etc/auto_master and then to the NIS auto_master map.


-t duration
Specify a duration, in seconds, that a file system is to remain mounted when not in use. The default is 300 (5 minutes), or, for Enhanced AutoFS, 600 (10 minutes).

-v
Verbose mode. Notify of autofs mounts, unmounts or other non-essential information. Messages are written to standard error.


Map Entry Format
A simple map entry (mapping) takes the form:

key [-mount-options] location...where key is the full pathname of the directory to mount when used in a direct map, or the simple name of a subdirectory in an indirect map. mount-options is a comma-separated list of mount options, and location specifies a file system from which the directory may be mounted. In the case of a simple NFS mount, location takes the form:

host:pathnamehost is the name of the host from which to mount the file system (it may be omitted if the pathname refers to a local device on which the filesystem resides) and pathname is the pathname of the directory to mount.

Default mount options can be assigned to an entire map when specified as an optional third field in the master map. These options apply only to map entries that have no mount options.

Replicated Filesystems
Multiple location fields can be specified for replicated NFS filesystems, in which case automount chooses a server, with preference given to a server on the local subnet or net.

If each location in the list shares the same pathname then a single location may be used with a comma-separated list of hostnames:

hostname,hostname...:pathnameThe multiple location feature for NFS mounts allows the automountd daemon to choose the most appropriate server at mount time. While such a mount is in effect, the daemon does not monitor the status of the server. If the server crashes, automountd will not select an alternative server from the list.

Requests for a server may be weighted, with the weighting factor appended to the server name as an integer in parentheses. Servers without a weighting default to a value of zero (most likely to be selected). Progressively higher values decrease the chance of being selected. In the example,

man -ro alpha,bravo,charlie(1),delta(4):/usr/share/manhosts alpha and bravo have the highest priority; host delta has the lowest priority.

NOTE:
Server proximity takes priority in the selection process. In the example above, if the server delta is on the same network segment as the client, but the others are on different network segments, then delta will be selected; the weighting value is ignored. The weighting has effect only when selecting between servers with the same network proximity.


In cases where each server has a different export point, you can still apply the weighting. For example:

man -ro alpha:/usr/man bravo,charlie(1):/usr/share/man \
delta(3):/export/man A mapping can be continued across input lines by escaping the newline with a backslash (\). Comments begin with a number sign (#) and end at the subsequent newline.

Map Key Substitution
The ampersand (&) character is expanded to the value of the key field for the entry in which it occurs. In this case:

amy rowboatserver:/home/& the & expands to amy.

Wildcard Key
The asterisk (*) character, when supplied as the key field, is recognized as the catch-all entry. Such an entry will match any key not previously matched. For instance, if the following entry appeared in the indirect map for /config:

* &:/export/config/& it would allow automatic mounts in /config of any remote file system whose location could be specified as:

hostname:/export/config/hostnameVariable Substitution
Client specific variables can be used within an automount map. For instance, if $HOST appeared within a map, automount would expand it to its current value for the client's host name. Supported variables are:

CPU
The processor type (only available with Enhanced AutoFS). The possible values are: IA64, PA10, PA11, PA20.

HOST
The output of uname -n. The host name. For example, rowboat.

OSNAME
The output of uname -s. The OS name. For example, HP-UX.

OSREL
The output of uname -r. The OS release name. For example, B.11.00.

OSVERS
The output of uname -v. The OS version. For example, C.

If a reference needs to be protected from neighboring characters, you can surround the variable name with braces ({}).


Multiple Mounts

A multiple mount entry takes the form:

key [- mount-options] [[mountpoint] [- mount-options] location...]...


The initial /[mountpoint] is optional for the first mount and mandatory for all subsequent mounts. The optional mountpoint is taken as a pathname relative to the directory named by key. If mountpoint is omitted in the first occurrence, a mountpoint of / (root) is implied.

Given an entry in the indirect map for /src:

beta -ro \
/ svr1,svr2:/export/src/beta \
/1.0 svr1,svr2:/export/src/beta/1.0 \
/1.0/man svr1,svr2:/export/src/beta/1.0/man All offsets must already exist on the server under beta. automount automatically mounts /src/beta, /src/beta/1.0, and /src/beta/1.0/man, as needed, from either svr1 or svr2, whichever host is nearest and responds first.

The autofs mount points must not be hierarchically related. automount does not allow an autofs mount point to be created within another autofs mount.

Other Filesystem Types
The automounter assumes NFS mounts as a default filesystem type. Other filesystem types can be described using the -fstype mount option. Other mount options specific to this filesystem type can be combined with the -fstype option. The location field must contain information specific to the filesystem type. If the location field begins with a slash, a colon character must be prepended, for instance, to mount a CD filesystem:

cdrom -fstype=hsfs,ro :/dev/sr0 or to perform an autofs mount:

src -fstype=autofs auto_src Mounts using CacheFS are most useful when applied to an entire map as map defaults (see cfsadmin(1M)). The following entry in the master map describes cached home directory mounts. It assumes the default location of the cache directory, /cache.

/home auto_home -fstype=cachefs,backfstype=nfs
Indirect Maps
An indirect map allows you to specify mappings for the subdirectories you wish to mount under the directory indicated in the /etc/auto_master map. In an indirect map, each key consists of a simple name that refers to the subdirectory of one or more filesystems that are to be mounted as needed.

Entries in both direct and indirect maps can be modified at any time. The new information is used when automountd next uses the map entry to do a mount.

Direct Maps
Entries in a direct map are associated directly with autofs mount points. Each key is the full pathname of an autofs mount point. The direct map as a whole is not associated with any single directory.

Since each direct map entry results in a new autofs mount, such maps should be kept short.

If a directory contains direct map mount points, then an ls -l in the directory will force all the direct map mounts to occur.

Entries in both direct and indirect maps can be modified at any time. The new information is used when automountd next uses the map entry to do a mount.

New entries added to a master map or direct map will not be useful until the automount command is run to install them as new autofs mount points. New entries added to an indirect map may be used immediately.

An autofs directory associated with an indirect map shows only currently-mounted entries unless Enhanced AutoFS is being used. This is a deliberate policy to avoid inadvertent mounting of every entry in a map via an ls -l of the directory. However, if Enhanced AutoFS and its browsability feature are being used, all autofs directories of an indirect map will be displayed with an ls -l without any mounting side-effect as mentioned above.

Included Maps
The contents of another map can be included within a map with an entry of the form:

+mapnameIf mapname begins with a slash then it is assumed to be the pathname of a local file. Otherwise the location of the map is determined by the policy of the name service switch according to the entry for the automounter in /etc/nsswitch.conf, such as

automount: nis filesIf the name service is files then the name is assumed to be that of a local file in /etc. If the key being searched for is not found in the included map, the search continues with the next entry.

Special Maps
There are two special maps available: -hosts and -null. The -hosts map is used with the /net directory and assumes that the map key is the hostname of an NFS server. The automountd daemon dynamically constructs a map entry from the server's list of exported filesystems. For instance, a reference to /net/hermes/usr would initiate an automatic mount of all exported file systems from hermes that are mountable by the client unless Enhanced AutoFS is being used. With Enhanced AutoFS and its on-demand mounting feature, only exported file systems from hermes that are being accessed are automatically mounted by the client. References to a directory under /net/hermes will refer to the corresponding directory relative to hermes root.

The -hosts map must mount all of the exported NFS filesystems from a server unless Enhanced AutoFS is being used. If frequent access to just a single filesystem is required without Enhanced AutoFS, it is more efficient to access the filesystem with a map entry that is tailored to mount just the filesystem of interest.

The -null map cancels a map for the directory indicated. This is most useful in the /etc/auto_master map for cancelling entries that would otherwise be inherited from the +auto_master include entry. To be effective, the -null entries must be inserted before the included map entry.

Executable Maps
Local maps that have the execute bit set in their file permissions will be executed by the automounter and provided with a key to be looked up as an argument. The executable map is expected to return the content of an automounter map entry on its standard output or no output if the entry cannot be determined. A direct map cannot be made executable.

Configuration and the auto_master Map
When initiated without arguments, automount consults the master map for a list of autofs mount points and their maps. It mounts any autofs mounts that are not already mounted, and unmounts autofs mounts that have been removed from the master map or direct map.

The master map is assumed to be called auto_master and its location is determined by the name service switch policy. Normally the master map is located initially as a local file, /etc/auto_master.

Browsing
Browsing is only available with Enhanced AutoFS. Browsing of indirect maps allows all of the potential mount points to be visible for that map regardless of whether they are mounted or not. The -nobrowse option can be added to any indirect autofs map to disable browsing. For example:

/net -hosts -nosuid,soft,nobrowse In this case, any host names would only be visible in /net after they are mounted. The -browse option enables browsing of autofs file systems. Browsing is the default for all indirect maps without any browsing option specified, although it is suggested that the -hosts entry contain the -nobrowse option.

Note that, although a listing of the autofs directory associated with an indirect map shows all potential mountable entries, the attributes associated with those entries are temporary until the actual filesystem attributes can be retrieved once the filesystem has been mounted.

Network Information Service (NIS) and Yellow Pages (YP)
The Network Information Service (NIS) was formerly known as Sun Yellow Pages (YP). The functionality of the two remains the same.

RETURN VALUE â Autofs
automount returns:

0
Success

1
Failure

3
Map not found


AUTHOR â Autofs
automount was developed by Sun Microsystems, Inc.

FILES â Autofs
/etc/auto_master
Master automount map.

/etc/nsswitch.conf
Name service switch configuration file.

/usr/lib/netsvc/fs/autofs/automount
Autofs automount command.

/usr/lib/netsvc/fs/enh_autofs/automount
Autofs automount command only available with Enhanced AutoFS

/usr/sbin/automount
Previous automounter automount command.


SEE ALSO â Autofs
automountd(1M), cfsadmin(1M), mount(1M).

DESCRIPTION â Automounter
==================================================

The automount command is a daemon that automatically and transparently mounts NFS file systems as needed. It monitors attempts to access directories that are associated with an automount map, along with any directories or files that reside under them. When a file is to be accessed, the daemon mounts the appropriate NFS file system. Maps can be assigned to a directory by using an entry in a direct automount map, or by specifying an indirect map on the command line.

automount interacts with the kernel in a manner closely resembling an NFS server:

automount uses the map to locate an appropriate NFS file server, exported file system, and mount options.

Then it mounts the file system in a temporary location, and replaces the file system entry for the directory or subdirectory with a symbolic link to the temporary location.

If the file system is not accessed within an appropriate interval (five minutes by default), the daemon unmounts the file system and removes the symbolic link.

If the specified directory has not already been created, the daemon creates it, and then removes it upon exiting.


Since name-to-location binding is dynamic, updates to an automount map are transparent to the user. This obviates the need to mount shared file systems prior to running applications that contain internally hard-coded references to files.

If the dummy directory (/-) is specified, automount treats the map argument that follows as the name of a direct map. In a direct map, each entry associates the full path name of a mount point with a remote file system to mount.

If the directory argument is a path name, the map argument points to an indirect map. An indirect map, contains a list of the subdirectories contained within the indicated directory. With an indirect map, it is these subdirectories that are mounted automatically.

A map can be a file or a NIS/NIS+ map; if a file, the map argument must be a full path name.

The -mount-options argument, when supplied, is a comma-separated list of options to the mount command (see mount(1M)) preceded by a -. However, any conflicting mount options specified in the indicated map take precedence.

Options
automount recognizes the following options:

-m
Option not supported.

-n
Disable dynamic mounts. With this option, references through the automount daemon succeed only when the target filesystem has been previously mounted. This can be used to prevent NFS servers from cross-mounting each other.

-T
Trace. Expand each NFS call and log it in /var/adm/automount.log file.

-v
Verbose. Log status messages to the system log file (see syslogd(1M)).

-D envar = value
Assign value to the indicated automount (environment) variable envar.

-f master-file
Read the local master_file before reading auto_master map.

-M mount-directory
Mount temporary file systems in the named directory instead of in /tmp_mnt.

-tl duration
Specify a duration (in seconds) that a file system is to remain mounted when not in use. The default is 300 (5 minutes).

-tm interval
Specify an interval (in seconds) between attempts to mount a filesystem. The default is 30 seconds.

-tw interval
Specify an interval (in seconds) between attempts to unmount filesystems that have exceeded their cached times. The default is 60 (1 minute).


Map Entry Format
A simple map entry (mapping) takes the form:

directory [-mount-options] location...where directory is the full path name of the directory to mount, when used in a direct map, or the basename of a subdirectory in an indirect map. mount-options is a comma-separated list of mount options, and location specifies a remote filesystem from which the directory may be mounted. In the simple case, location takes the form:

host:pathnameMultiple location fields can be specified, in which case automount pings all servers in the list and then selects the first host that responds to serve that mount point.

If location is specified in the form:

host:path:subdirhost is the name of the host from which to mount the file system, path is the path name of the directory to mount, and subdir, when supplied, is the name of a subdirectory to which the symbolic link is made. This can be used to prevent duplicate mounts when multiple directories in the same remote file system might be accessed. Assume a map for /home resembling:

mike hpserver1:/home/hpserver1:mike
dianna hpserver1:/home/hpserver1:dianna Attempting to access a file in /home/mike causes automount to mount hpserver1:/home/hpserver1 and creates a symbolic link called /home/mike to the mike subdirectory in the temporarily-mounted filesystem. A subsequent file access request in /home/dianna results in automount simply creating a symbolic link that points to the dianna subdirectory because /home/hpserver1 is already mounted. Given the map:

mike hpserver1:/home/hpserver1/mike
dianna hpserver1:/home/hpserver1/dianna automount would have to mount the filesystem twice.

A mapping can be continued across input lines by escaping the newline character with a backslash (\). Comments begin with a number sign (#) and end at the subsequent newline character.

Directory Pattern Matching
The ampersand (&) character is expanded to the value of the directory field for the entry in which it occurs. Given an entry of the form:

mike hpserver1:/home/hpserver1:& the & expands to mike.

The asterisk (*) character, when supplied as the directory field, is recognized as the catch-all entry. Such an entry resolves to any entry not previously matched. For example, if the following entry appeared in the indirect map for /home:

* &:/home/& this would allow automatic mounts in /home of any remote file system whose location could be specified as:

hostname :/home hostname


Hierarchical Mappings
A hierarchical mapping takes the form:

directory [/subdirectory] [-mount-options] location...]...The initial / within the /[subdirectory] is required; the optional subdirectory is taken as a file name relative to the directory. If subdirectory is omitted in the first occurrence, the / refers to the directory itself.

Given the direct map entry:

/usr/local \
/ -ro,intr shasta:/usr/local ranier:/usr/local \
/bin -ro,intr ranier:/usr/local/bin shasta:/usr/local/bin \
/man -ro,intr shasta:/usr/local/man ranier:/usr/local/man automount automatically mounts /usr/local, /usr/local/bin, and /usr/local/man, as needed, from either shasta or ranier, whichever host responded first.

Direct Maps
A direct map contains mappings for any number of directories. Each directory listed in the map is automatically mounted as needed. The direct map as a whole is not associated with any single directory.

Indirect Maps
An indirect map allows specifying mappings for the subdirectories to be mounted under the directory indicated on the command line. It also obscures local subdirectories for which no mapping is specified. In an indirect map, each directory field consists of the basename of a subdirectory to be mounted as needed.

Included Maps
The contents of another map can be included within a map with an entry of the form:

+mapnamemapname can either be a file name, or the name of an NIS/NIS+ map, or one of the special maps described below. If mapname begins with a slash then it is assumed to be the pathname of a local file. Otherwise, the location of the map is determined by the policy of the name service switch according to the entry for the automounter in /etc/nsswitch.conf, such as

automount: nis filesIf the name service is files, then the name is assumed to be that of a local file in /etc. If the key being searched for is not found in the included map, the search continues with the next entry.

Special Maps
Three special maps, -hosts, -passwd, and -null, are currently available. The -hosts map uses the gethostbyname() map to locate a remote host when the hostname is specified (see gethostent(3N)). This map specifies mounts of all exported file systems from any host. For example, if the following automount command is already in effect:

automount /net -hosts a reference to /net/hermes/usr initiates an automatic mount of all file systems from hermes that automount can mount, and any subsequent references to a directory under /net/hermes refer to the corresponding directory on hermes. The -passwd map uses the passwd(4) database to attempt to locate a user's home directory. For example, if the following automount command is already in effect:

automount /homes -passwd if the home directory for a user has the form

/dir/server/usernameand if server matches the host system on which that directory resides, automount mounts the user's home directory as /homes /username.

For this map, the tilde character (~) is recognized as a synonym for username.

The -null map, when indicated on the command line, cancels a previous map for the directory indicated. It can be used to cancel a map given in auto_master.

Configuration and the auto_master Map
automount normally consults the auto_master configuration map for a list of initial automount maps, and sets up automatic mounts for them in addition to those given on the command line. If there are duplications, the command-line arguments take precedence. This configuration database contains arguments to the automount command rather than mappings.

Maps given on the command line, or those given in a local master file specified with -f override those in the auto_master map. For example, given the command

automount /homes /etc/auto.homes /- /etc/auto.direct and the master map file auto_master containing

/homes -passwd automount mounts home directories using the /etc/auto.homes map instead of the special -passwd map in addition to the various directories specified in the /etc/auto.direct map.

EXTERNAL INFLUENCES â Automounter

Environment Variables
Environment variables can be used within an automount map. For example, if $HOME appears within a map, automount expands it to the current value of the HOME environment variable.

To protect a reference from neighboring characters, surround the variable name with braces ({}).

Environment variables cannot appear as a key entry in maps.

WARNINGS â Automounter
Do not send the SIGKILL signal (kill -9, or kill -KILL) to the automount daemon. Doing so causes any processes accessing mount directories served by automount to hang. A system reboot may be required to recover from this state.

Do not start an automount daemon while another is still running. If restarting automount, make sure the first daemon and all of its children are not running.

When automount receives signal SIGHUP, it rereads the /etc/mnttab file to update its internal record of currently mounted file systems. If a file system mounted by automount is unmounted by a umount command, automount should be forced to reread the file by sending the SIGHUP signal (see kill(1)).

Shell file name expansion does not apply to objects not currently mounted.

Since automount is single-threaded, any request that is delayed by a slow or nonresponding NFS server delays all subsequent automatic mount requests until it completes.

Programs that read /etc/mnttab and then touch files that reside under automatic mount points introduce further entries to the file.

Automatically-mounted file systems are mounted with type ignore; they do not appear in the output of either mount or bdf (see mount(1M) and bdf(1M)).

AUTHOR â Automounter
automount was developed by Sun Microsystems, Inc.

FILES â Automounter
/tmp_mnt
Directory under which filesystems are dynamically mounted

/etc/mnttab
Mount table

/etc/nsswitch.conf
The name service switch configuration file.

For more details you can check by below link


http://docs.hp.com/en/B2355-60127/automount.1M.html

Rgds//
Taifur