6198 Let's EOL cachefs
[illumos-gate.git] / usr / src / man / man1m / automount.1m
blob6a3ad25e41817d784c574dde1f148e2465f66313
1 '\" te
2 .\" Copyright 1989 AT&T
3 .\" Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved
4 .\" Copyright 2015 Nexenta Systems, Inc. All rights reserved.
5 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
6 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
7 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
8 .TH AUTOMOUNT 1M "Sep 8, 2015"
9 .SH NAME
10 automount \- install automatic mount points
11 .SH SYNOPSIS
12 .LP
13 .nf
14 \fB/usr/sbin/automount\fR [\fB-t\fR \fIduration\fR] [\fB-v\fR]
15 .fi
17 .SH DESCRIPTION
18 .LP
19 The \fBautomount\fR utility installs \fBautofs\fR mount points and associates
20 an automount map with each mount point. It starts the \fBautomountd\fR(1M)
21 daemon if it finds any non-trivial entries in either local or distributed
22 automount maps and if the daemon is not already running. The \fBautofs\fR file
23 system monitors attempts to access directories within it and notifies the
24 \fBautomountd\fR(1M) daemon. The daemon uses the map to locate a file system,
25 which it then mounts at the point of reference within the \fBautofs\fR file
26 system. A map can be assigned to an \fBautofs\fR mount using an entry in the
27 \fB/etc/auto_master\fR map or a direct map.
28 .sp
29 .LP
30 If the file system is not accessed within an appropriate interval (\fB10\fR
31 minutes by default), the \fBautomountd\fR daemon unmounts the file system.
32 .sp
33 .LP
34 The file \fB/etc/auto_master\fR determines the locations of all \fBautofs\fR
35 mount points. By default, this file contains three entries:
36 .sp
37 .in +2
38 .nf
39 # Master map for automounter
41 +auto_master
42 /net          -hosts    -nosuid
43 /home         auto_home
44 .fi
45 .in -2
46 .sp
48 .sp
49 .LP
50 The \fB+auto_master\fR entry is a reference to an external \fBNIS\fR or
51 \fBNIS+\fR master map. If one exists, then its entries are read as if they
52 occurred in place of the \fB+auto_master\fR entry. The remaining entries in the
53 master file specify a directory on which an \fBautofs\fR mount will be made
54 followed by the automounter map to be associated with it. Optional mount
55 options may be supplied as an optional third field in the each entry. These
56 options are used for any entries in the map that do not specify mount options
57 explicitly. The \fBautomount\fR command is usually run without arguments. It
58 compares the entries \fB/etc/auto_master\fR with the current list of
59 \fBautofs\fR mounts in \fB/etc/mnttab\fR and adds, removes or updates
60 \fBautofs\fR mounts to bring the \fB/etc/mnttab\fR up to date with the
61 \fB/etc/auto_master\fR. At boot time it installs all \fBautofs\fR mounts from
62 the master map. Subsequently, it may be run to install \fBautofs\fR mounts for
63 new entries in the master map or the direct map, or to perform unmounts for
64 entries that have been removed from these maps.
65 .SS "Automount with Solaris Trusted Extensions"
66 .LP
67 If a system is configured with Solaris Trusted Extensions, additional
68 processing is performed to facilitate multilevel home directory access. A list
69 of zones whose labels are dominated by the current zone is generated and
70 default \fBauto_home\fR automount maps are generated if they do not currently
71 exist. These automount maps are named \fBauto_home_\fR\fI<zonename>\fR, where
72 \fI<zonename>\fR is the name of each zone's lower-level zone. An \fBautofs\fR
73 mount of each such \fBauto_home\fR map is then performed, regardless of whether
74 it is explicitly or implicitly listed in the master map. Instead of
75 \fBautofs\fR mounting the standard \fBauto_home\fR map, the zone uses an
76 \fBauto_home\fR file appended with its own zone name. Each zone's
77 \fBauto_home\fR map is uniquely named so that it can be maintained and shared
78 by all zones using a common name server.
79 .LP
80 By default, the home directories of lower-level zones are mounted read-only
81 under \fB/zone/\fI<zonename>\fR/export/home\fR when each zone is booted. The
82 default \fBauto_home_\fR\fI<zonename>\fR automount map specifies that path as
83 the source directory for an \fBlofs\fR remount onto
84 \fB/zone/\fI<zonename>\fR/home/\fI<username>\fR\fR. For example, the file
85 \fBauto_home_public\fR, as generated from a higher level zone would contain:
86 .sp
87 .LP
88 +auto_home_public
89 .sp
90 .LP
91 *       -fstype=lofs    :/zone/public/export/home/&
92 .sp
93 .LP
94 When a home directory is referenced and the name does not match any other keys
95 in the \fBauto_home_public\fR map, it will match this loopback mount
96 specification. If this loopback match occurs and the name corresponds to a
97 valid user whose home directory does not exist in the public zone, the
98 directory is automatically created on behalf of the user.
99 .SH OPTIONS
101 The following options are supported:
103 .ne 2
105 \fB\fB-t\fR \fIduration\fR\fR
107 .RS 15n
108 Specifies a \fIduration\fR, in seconds, that a file system is to remain mounted
109 when not in use. The default is \fB10\fR minutes.
113 .ne 2
115 \fB\fB-v\fR\fR
117 .RS 15n
118 Verbose mode. Notifies of \fBautofs\fR mounts, unmounts, or other non-essential
119 information.
122 .SH USAGE
123 .SS "Map Entry Format"
125 A simple map entry (mapping) takes the form:
127 .in +2
129 key [ -\fImount-options\fR ] \fIlocation\fR .\|.\|.
131 .in -2
135 where \fBkey\fR is the full pathname of the directory to mount when used in a
136 direct map, or the simple name of a subdirectory in an indirect map.
137 \fImount-options\fR is a comma-separated list of \fBmount\fR options, and
138 \fIlocation\fR specifies a file system from which the directory may be mounted.
139 In the case of a simple \fBNFS\fR mount, the options that can be used are
140 specified in \fBmount_nfs\fR(1M), and \fIlocation\fR takes the form:
142 .in +2
144 \fIhost\fR\fB:\|\fR\fIpathname\fR
146 .in -2
150 \fIhost\fR is the name of the host from which to mount the file system, and
151 \fIpathname\fR is the absolute pathname of the directory to mount.
153 Options to other file systems are documented in the other \fBmount_*\fR
154 reference manual pages.
155 .SS "Replicated File Systems"
157 Multiple \fIlocation\fR fields can be specified for replicated \fBNFS\fR file
158 systems, in which case \fBautomount\fR and the kernel will each try to use that
159 information to increase availability. If the read-only flag is set in the map
160 entry, \fBautomountd\fR mounts a list of locations that the kernel may use,
161 sorted by several criteria. Only locations available at mount time will be
162 mounted, and thus be available to the kernel. When a server does not respond,
163 the kernel will switch to an alternate server. The sort ordering of
164 \fBautomount\fR is used to determine how the next server is chosen. If the
165 read-only flag is not set, \fBautomount\fR will mount the best single location,
166 chosen by the same sort ordering, and new servers will only be chosen when an
167 unmount has been possible, and a remount is done. Servers on the same local
168 subnet are given the strongest preference, and servers on the local net are
169 given the second strongest preference. Among servers equally far away, response
170 times will determine the order if no weighting factors (see below) are used.
172 If the list includes server locations using both the \fBNFS\fR Version 2
173 Protocol and the \fBNFS\fR Version 3 Protocol, \fBautomount\fR will choose only
174 a subset of the server locations on the list, so that all entries will be the
175 same protocol. It will choose servers with the \fBNFS\fR Version 3 Protocol so
176 long as an \fBNFS\fR Version 2 Protocol server on a local subnet will not be
177 ignored. See the \fI\fR for additional details.
179 If each \fIlocation\fR in the list shares the same \fIpathname\fR then a single
180 \fIlocation\fR may be used with a comma-separated list of hostnames:
182 .in +2
184 \fBhostname\fR\fB,\fR\fBhostname\fR\|.\|.\|.\|\fB:\fR\|\fIpathname\fR
186 .in -2
190 Requests for a server may be weighted, with the weighting factor appended to
191 the server name as an integer in parentheses. Servers without a weighting are
192 assumed to have a value of zero (most likely to be selected). Progressively
193 higher values decrease the chance of being selected. In the example,
195 .in +2
197 \fBman\fR -ro \fBalpha,bravo,charlie(1),delta(4)\|:\|/usr/man\fR
199 .in -2
203 hosts \fBalpha\fR and \fBbravo\fR have the highest priority; host \fBdelta\fR
204 has the lowest.
206 Server proximity takes priority in the selection process. In the example above,
207 if the server \fBdelta\fR is on the same network segment as the client, but the
208 others are on different network segments, then \fBdelta\fR will be selected;
209 the weighting value is ignored. The weighting has effect only when selecting
210 between servers with the same network proximity. The automounter always selects
211 the localhost over other servers on the same network segment, regardless of
212 weighting.
214 In cases where each server has a different export point, the weighting can
215 still be applied. For example:
217 .in +2
219 man -ro alpha:/usr/man  bravo,charlie(1):/usr/share/man
220      delta(3):/export/man
222 .in -2
226 A mapping can be continued across input lines by escaping the \fBNEWLINE\fR
227 with a backslash (\e) Comments begin with a number sign (\fB#\fR) and end at
228 the subsequent NEWLINE.
229 .SS "Map Key Substitution"
231 The ampersand (\fB&\fR) character is expanded to the value of the \fBkey\fR
232 field for the entry in which it occurs. In this case:
234 .in +2
236 \fBjane\fR \fBsparcserver\|:\|/home/&\fR
238 .in -2
242 the \fB&\fR expands to \fBjane\fR.
243 .SS "Wildcard Key"
245 The asterisk (\fB*\fR) character, when supplied as the \fBkey\fR field, is
246 recognized as the catch-all entry. Such an entry will match any key not
247 previously matched. For instance, if the following entry appeared in the
248 indirect map for \fB/config\fR:
250 .in +2
252 *         &\|:\|/export/config/&
254 .in -2
258 this would allow automatic mounts in \fB/config\fR of any remote file system
259 whose location could be specified as:
261 .in +2
263 hostname\|:\|/export/config/hostname
265 .in -2
269 Note that the wildcard key does not work in conjunction with the \fB-browse\fR
270 option.
271 .SS "Variable Substitution"
273 Client specific variables can be used within an \fBautomount\fR map. For
274 instance, if \fB$HOST\fR appeared within a map, \fBautomount\fR would expand it
275 to its current value for the client's host name. Supported variables are:
280 l l l
281 l l l .
282 \fBARCH\fR      The output of \fBarch\fR        T{
283 The architecture name. For example, \fBsun4\fR on a sun4u machine.
285 \fBCPU\fR       The output of \fBuname\fR \fB-p\fR      The processor type.
286                 For example, "sparc"
287 \fBHOST\fR      The output of \fBuname\fR \fB-n\fR      The host name.
288                 For example, \fBmyhost\fR.
289 \fBKARCH\fR     The output of \fBarch -k\fR or \fBuname -m\fR   T{
290 The kernel architecture name or machine hardware name. For example, \fBsun4u\fR.
292                 
293 \fBOSNAME\fR    The output of \fBuname\fR \fB-s\fR      The OS name.
294                 For example, "SunOS"
295 \fBOSREL\fR     The output of \fBuname\fR \fB-r\fR      The OS release name.
296                 For example "5.3"
297 \fBOSVERS\fR    The output of \fBuname\fR \fB-v\fR      The OS version.
298                 For example, "beta1.0"
299 \fBNATISA\fR    The output of \fBisainfo\fR \fB-n\fR    T{
300 The native instruction set architecture for the system.
302                 For example, "sparcv9"
303 \fBPLATFORM\fR  The output of \fBuname -i\fR    T{
304 The platform name. For example,  \fBSUNW,Sun-Fire-V240\fR.
306                 
310 If a reference needs to be protected from affixed characters, you can surround
311 the variable name with curly braces (\fB\|{\|}\|\fR).
312 .SS "Multiple Mounts"
314 A multiple mount entry takes the form:
316 .in +2
318 key [\fI-mount-options\fR] [\|[\fImountpoint\fR] [\fI-mount-options\fR] \fIlocation\fR.\|.\|.\|]\|.\|.\|.
320 .in -2
324 The initial \fB/\fR[\fImountpoint\fR\|] is optional for the first mount and
325 mandatory for all subsequent mounts. The optional \fImountpoint\fR is taken as
326 a pathname relative to the directory named by \fBkey\fR. If \fImountpoint\fR is
327 omitted in the first occurrence, a \fImountpoint\fR of \fB/\fR (root) is
328 implied.
330 Given an entry in the indirect map for \fB/src\fR
332 .in +2
334 beta     -ro\e
335   /           svr1,svr2:/export/src/beta  \e
336   /1.0        svr1,svr2:/export/src/beta/1.0  \e
337   /1.0/man    svr1,svr2:/export/src/beta/1.0/man
339 .in -2
343 All offsets must exist on the server under \fBbeta\fR. \fBautomount\fR will
344 automatically mount \fB/src/beta\fR, \fB/src/beta/1.0\fR, and
345 \fB/src/beta/1.0/man\fR, as needed, from either \fBsvr1\fR or \fBsvr2\fR,
346 whichever host is nearest and responds first.
347 .SS "Other File System Types"
349 The automounter assumes \fBNFS\fR mounts as a default file system type. Other
350 file system types can be described using the \fBfstype\fR mount option. Other
351 mount options specific to this file system type can be combined with the
352 \fBfstype\fR option. The location field must contain information specific to
353 the file system type. If the location field begins with a slash, a colon
354 character must be prepended, for instance, to mount a CD file system:
356 .in +2
358 \fBcdrom -fstype=hsfs,ro   :\|/dev/sr0\fR
360 .in -2
364 or to perform an \fBautofs\fR mount:
366 .in +2
368 \fBsrc\fR \fB-fstype\fR\fB=autofs    auto_src\fR
370 .in -2
374 Use this procedure only if you are not using Volume Manager.
376 See the  \fBNOTES\fR section for information on option inheritance.
377 .SS "Indirect Maps"
379 An indirect map allows you to specify mappings for the subdirectories you wish
380 to mount under the \fBdirectory\fR indicated on the command line. In an
381 indirect map, each \fBkey\fR consists of a simple name that refers to one or
382 more file systems that are to be mounted as needed.
383 .SS "Direct Maps"
385 Entries in a direct map are associated directly with \fBautofs\fR mount points.
386 Each \fIkey\fR is the full pathname of an \fBautofs\fR mount point. The direct
387 map as a whole is not associated with any single directory.
389 Direct maps are distinguished from indirect maps by the \fB/-\fR key. For
390 example:
392 .in +2
394 # Master map for automounter
396 +auto_master
397 /net            -hosts          -nosuid,nobrowse
398 /home           auto_home       -nobrowse
399 /-              auto_direct
401 .in -2
404 .SS "Included Maps"
406 The contents of another map can be included within a map with an entry of the
407 form
409 .in +2
411 +\fImapname\fR
413 .in -2
417 If \fImapname\fR begins with a slash, it is assumed to be the pathname of a
418 local file. Otherwise, the location of the map is determined by the policy of
419 the name service switch according to the entry for the automounter in
420 \fB/etc/nsswitch.conf\fR, such as
422 .in +2
424 automount: files nis
426 .in -2
430 If the name service is \fBfiles\fR, then the name is assumed to be that of a
431 local file in \fB/etc\fR. If the key being searched for is not found in the
432 included map, the search continues with the next entry.
433 .SS "Special Maps"
435 There are two special maps available: \fB-hosts\fR and \fB-null\fR. The
436 \fB-hosts\fR map is used with the \fB/net\fR directory and assumes that the map
437 key is the hostname of an \fBNFS\fR server. The \fBautomountd\fR daemon
438 dynamically constructs a map entry from the server's list of exported file
439 systems. References to a directory under \fB/net/hermes\fR will refer to the
440 corresponding directory relative to \fBhermes\fR root.
442 The \fB-null\fR map cancels a previous map for the directory indicated. This is
443 most useful in the \fB/etc/auto_master\fR for cancelling entries that would
444 otherwise be inherited from the \fB+auto_master\fR include entry. To be
445 effective, the \fB-null\fR entries must be inserted before the included map
446 entry.
447 .SS "Executable Maps"
449 Local maps that have the execute bit set in their file permissions will be
450 executed by the automounter and provided with a key to be looked up as an
451 argument. The executable map is expected to return the content of an
452 automounter map entry on its stdout or no output if the entry cannot be
453 determined. A direct map cannot be made executable.
454 .SS "Configuration and the auto_master Map"
456 When initiated without arguments, \fBautomount\fR consults the master map for a
457 list of \fBautofs\fR mount points and their maps. It mounts any \fBautofs\fR
458 mounts that are not already mounted, and unmounts \fBautofs\fR mounts that have
459 been removed from the master map or direct map.
461 The master map is assumed to be called \fBauto_master\fR and its location is
462 determined by the name service switch policy. Normally the master map is
463 located initially as a local file \fB/etc/auto_master\fR.
464 .SS "Browsing"
466 The \fBautomount\fR daemon supports browsability of indirect maps. This allows
467 all of the potential mount points to be visible, whether or not they are
468 mounted. The \fB-nobrowse\fR option can be added to any indirect \fBautofs\fR
469 map to disable browsing. For example:
471 .in +2
473 /net     -hosts      -nosuid,nobrowse
474 /home    auto_home
476 .in -2
480 In this case, any \fIhostnames\fR would only be visible in \fB/net\fR after
481 they are mounted, but all potential mount points would be visible under
482 \fB/home\fR. The \fB-browse\fR option enables browsability of \fBautofs\fR file
483 systems. This is the default for all indirect maps.
485 The \fB-browse\fR option does not work in conjunction with the wildcard key.
486 .SS "Restricting Mount Maps"
488 Options specified for a map are used as the default options for all the entries
489 in that map. They are ignored when map entries specify their own mount options.
491 In some cases, however, it is desirable to force \fBnosuid\fR, \fBnodevices\fR,
492 \fBnosetuid\fR, or \fBnoexec\fR for a complete mount map and its submounts.
493 This can be done by specifying the additional mount option, \fB-restrict\fR.
495 .in +2
497  /home     auto_home       -restrict,nosuid,hard
499 .in -2
503 The \fB-restrict\fR option forces the inheritance of all the restrictive
504 options \fBnosuid\fR, \fBnodevices\fR, \fBnosetuid\fR, and \fBnoexec\fR as well
505 as the restrict option itself. In this particular example, the \fBnosuid\fR and
506 \fBrestrict\fR option are inherited but the \fBhard\fR option is not. The
507 \fBrestrict\fR option also prevents the execution of "executable maps" and is
508 enforced for auto mounts established by programs with fewer than all privileges
509 available in their zone.
510 .SH EXIT STATUS
512 The following exit values are returned:
514 .ne 2
516 \fB\fB0\fR\fR
518 .RS 5n
519 Successful completion.
523 .ne 2
525 \fB\fB1\fR\fR
527 .RS 5n
528 An error occurred.
531 .SH FILES
532 .ne 2
534 \fB\fB/etc/auto_master\fR\fR
536 .RS 23n
537 Master automount map.
541 .ne 2
543 \fB\fB/etc/auto_home\fR\fR
545 .RS 23n
546 Map to support automounted home directories.
550 .ne 2
552 \fB\fB/etc/default/autofs\fR\fR
554 .RS 23n
555 Supplies default values for parameters for \fBautomount\fR and
556 \fBautomountd\fR. See \fBautofs\fR(4).
560 .ne 2
562 \fB\fB/etc/nsswitch.conf\fR\fR
564 .RS 23n
565 Name service switch configuration file. See \fBnsswitch.conf\fR(4).
568 .SH SEE ALSO
570 \fBisainfo\fR(1), \fBls\fR(1), \fBsvcs\fR(1), \fBuname\fR(1),
571 \fBautomountd\fR(1M), \fBmount\fR(1M), \fBmount_nfs\fR(1M),
572 \fBsvcadm\fR(1M), \fBautofs\fR(4), \fBattributes\fR(5),
573 \fBnfssec\fR(5), \fBsmf\fR(5)
575 \fI\fR
576 .SH NOTES
578 \fBautofs\fR mount points must not be hierarchically related. \fBautomount\fR
579 does not allow an \fBautofs\fR mount point to be created within another
580 \fBautofs\fR mount.
582 Since each direct map entry results in a new \fBautofs\fR mount such maps
583 should be kept short.
585 Entries in both direct and indirect maps can be modified at any time. The new
586 information is used when \fBautomountd\fR next uses the map entry to do a
587 mount.
589 New entries added to a master map or direct map will not be useful until the
590 automount command is run to install them as new \fBautofs\fR mount points. New
591 entries added to an indirect map may be used immediately.
593 As of the Solaris 2.6 release, a listing (see \fBls\fR(1)) of the \fBautofs\fR
594 directory associated with an indirect map shows all potential mountable
595 entries. The attributes associated with the potential mountable entries are
596 temporary. The real file system attributes will only be shown once the file
597 system has been mounted.
599 Default mount options can be assigned to an entire map when specified as an
600 optional third field in the master map. These options apply only to map entries
601 that have no mount options. Note that map entities with options override the
602 default options, as at this time, the options do not concatenate. The
603 concatenation feature is planned for a future release.
605 When operating on a map that invokes an NFS mount, the default number of
606 retries for the automounter is 0, that is, a single mount attempt, with no
607 retries. Note that this is significantly different from the default (10000) for
608 the \fBmount_nfs\fR(1M) utility.
610 The Network Information Service (NIS) was formerly known as Sun Yellow Pages
611 (YP). The functionality of the two remains the same.
613 The \fBautomount\fR service is managed by the service management facility,
614 \fBsmf\fR(5), under the service identifier:
616 .in +2
618 svc:/system/filesystem/autofs:default
620 .in -2
624 Administrative actions on this service, such as enabling, disabling, or
625 requesting restart, can be performed using \fBsvcadm\fR(1M). The service's
626 status can be queried using the \fBsvcs\fR(1) command.