Move /var/svc/log to /var/log/svc
[unleashed/lotheac.git] / share / man / man8 / automount.8
blobd8b46a6cba806a86eadd86265bf361ed7f46a9f8
1 .\"
2 .\" The contents of this file are subject to the terms of the
3 .\" Common Development and Distribution License (the "License").
4 .\" You may not use this file except in compliance with the License.
5 .\"
6 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
7 .\" or http://www.opensolaris.org/os/licensing.
8 .\" See the License for the specific language governing permissions
9 .\" and limitations under the License.
10 .\"
11 .\" When distributing Covered Code, include this CDDL HEADER in each
12 .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
13 .\" If applicable, add the following below this CDDL HEADER, with the
14 .\" fields enclosed by brackets "[]" replaced with your own identifying
15 .\" information: Portions Copyright [yyyy] [name of copyright owner]
16 .\"
17 .\"
18 .\" Copyright 1989 AT&T
19 .\" Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved
20 .\" Copyright 2016 Nexenta Systems, Inc.
21 .\"
22 .Dd July 16, 2018
23 .Dt AUTOMOUNT 8
24 .Os
25 .Sh NAME
26 .Nm automount
27 .Nd install automatic mount points
28 .Sh SYNOPSIS
29 .Nm
30 .Op Fl v
31 .Op Fl t Ar duration
32 .Sh DESCRIPTION
33 The
34 .Nm
35 utility installs
36 .Nm autofs
37 mount points and associates an automount map with each mount point. It starts
38 the
39 .Xr automountd 8
40 daemon if it finds any non-trivial entries in either local or distributed
41 automount maps and if the daemon is not already running. The
42 .Nm autofs
43 file system monitors attempts to access directories within it and notifies the
44 .Xr automountd 8
45 daemon. The daemon uses the map to locate a file system, which it then mounts at
46 the point of reference within the
47 .Nm autofs
48 file system. A map can be assigned to an
49 .Nm autofs
50 mount using an entry in the
51 .Pa /etc/auto_master
52 map or a direct map.
53 .Pp
54 If the file system is not accessed within an appropriate interval
55 .Pq 10 minutes by default ,
56 the
57 .Nm automountd
58 daemon unmounts the file system.
59 .Pp
60 The file
61 .Pa /etc/auto_master
62 determines the locations of all
63 .Nm autofs
64 mount points.
65 .Pp
66 The
67 .Nm
68 command is usually run without arguments. It compares the entries
69 .Pa /etc/auto_master
70 with the current list of
71 .Nm autofs
72 mounts in
73 .Pa /etc/mnttab
74 and adds, removes or updates
75 .Nm autofs
76 mounts to bring the
77 .Pa /etc/mnttab
78 up to date with the
79 .Pa /etc/auto_master .
80 At boot time it installs all
81 .Nm autofs
82 mounts from the master map. Subsequently, it may be run to install
83 .Nm autofs
84 mounts for new entries in the master map or the direct map, or to perform
85 unmounts for entries that have been removed from these maps.
86 .Sh OPTIONS
87 The following options are supported:
88 .Bl -tag -width Ds
89 .It Fl v
90 Verbose mode. Notifies of
91 .Nm autofs
92 mounts, unmounts, or other non-essential information.
93 .It Fl t Ar duration
94 Specifies a
95 .Ar duration ,
96 in seconds, that a file system is to remain mounted when not in use. The default
98 .Sy 10
99 minutes.
101 .Sh USAGE
102 .Ss Map Entry Format
103 A simple map entry
104 .Pq mapping
105 takes the form:
106 .Bd -literal -offset indent
107 .Ar key Oo Fl Ns Ar mount-options Oc Ar location Ns ...
110 where
111 .Ar key
112 is the full pathname of the directory to mount when used in a direct map, or the
113 simple name of a subdirectory in an indirect map.
114 .Ar mount-options
115 is a comma-separated list of
116 .Nm mount
117 options, and
118 .Ar location
119 specifies a file system from which the directory may be mounted. In the case of
120 a simple NFS mount, the options that can be used are specified in
121 .Xr mount_nfs 8 ,
123 .Ar location
124 takes the form:
126 .Dl Ar host Ns : Ns Ar pathname
128 .Ar host
129 is the name of the host from which to mount the file system, and
130 .Ar pathname
131 is the absolute pathname of the directory to mount.
133 Options to other file systems are documented in the other
134 .Nm mount_*
135 reference manual pages.
136 .Ss Replicated File Systems
137 Multiple
138 .Ar location
139 fields can be specified for replicated NFS file systems, in which case
141 and the kernel will each try to use that information to increase availability.
142 If the read-only flag is set in the map entry,
143 .Nm automountd
144 mounts a list of locations that the kernel may use, sorted by several criteria.
145 Only locations available at mount time will be mounted, and thus be available to
146 the kernel. When a server does not respond, the kernel will switch to an
147 alternate server. The sort ordering of
149 is used to determine how the next server is chosen. If the read-only flag is not
150 set,
152 will mount the best single location, chosen by the same sort ordering, and new
153 servers will only be chosen when an unmount has been possible, and a remount is
154 done. Servers on the same local subnet are given the strongest preference, and
155 servers on the local net are given the second strongest preference. Among
156 servers equally far away, response times will determine the order if no
157 weighting factors
158 .Pq see below
159 are used.
161 If the list includes server locations using both the NFS Version 2 Protocol and
162 the NFS Version 3 Protocol,
164 will choose only a subset of the server locations on the list, so that all
165 entries will be the same protocol. It will choose servers with the NFS Version 3
166 Protocol so long as an NFS Version 2 Protocol server on a local subnet will not
167 be ignored. See the FIXME for additional details.
169 If each
170 .Ar location
171 in the list shares the same
172 .Ar pathname
173 then a single
174 .Ar location
175 may be used with a comma-separated list of hostnames:
176 .Bd -literal -offset indent
177 .Ar hostname Ns , Ns Ar hostname Ns ...: Ns Ar pathname
180 Requests for a server may be weighted, with the weighting factor appended to
181 the server name as an integer in parentheses. Servers without a weighting are
182 assumed to have a value of zero
183 .Pq most likely to be selected .
184 Progressively higher values decrease the chance of being selected. In the
185 example,
186 .Bd -literal -offset indent
187 man -ro alpha,bravo,charlie(1),delta(4):/usr/man
190 hosts
191 .Sy alpha
193 .Sy bravo
194 have the highest priority; host
195 .Sy delta
196 has the lowest.
198 Server proximity takes priority in the selection process. In the example above,
199 if the server
200 .Sy delta
201 is on the same network segment as the client, but the others are on different
202 network segments, then
203 .Sy delta
204 will be selected; the weighting value is ignored. The weighting has effect only
205 when selecting between servers with the same network proximity. The automounter
206 always selects the localhost over other servers on the same network segment,
207 regardless of weighting.
209 In cases where each server has a different export point, the weighting can
210 still be applied. For example:
211 .Bd -literal -offset indent
212 man     -ro     alpha:/usr/man bravo,charlie(1):/usr/share/man \e
213                 delta(3):/export/man
216 A mapping can be continued across input lines by escaping the NEWLINE with a
217 backslash
218 .Pq Qq Sy \e .
219 Comments begin with a number sign
220 .Pq Qq Sy #
221 and end at the subsequent NEWLINE.
222 .Ss Map Key Substitution
223 The ampersand
224 .Pq Qq Sy \*(Am
225 character is expanded to the value of the
226 .Ar key
227 field for the entry in which it occurs. In this case:
228 .Bd -literal -offset indent
229 jane    sparcserver:/home/&
233 .Sy \*(Am
234 expands to
235 .Sy jane .
236 .Ss Wildcard Key
237 The asterisk
238 .Pq Qq Sy *
239 character, when supplied as the
240 .Ar key
241 field, is recognized as the catch-all entry. Such an entry will match any key
242 not previously matched. For instance, if the following entry appeared in the
243 indirect map for
244 .Pa /config :
245 .Bd -literal -offset indent
246 *       &:/export/config/&
249 this would allow automatic mounts in
250 .Pa /config
251 of any remote file system whose location could be specified as:
252 .Bd -literal -offset indent
253 .Ar hostname Ns : Ns Pa /export/config/ Ns Ar hostname
256 Note that the wildcard key does not work in conjunction with the
257 .Fl browse
258 option.
259 .Ss Variable Substitution
260 Client specific variables can be used within an
262 map. For instance, if
263 .Sy $HOST
264 appeared within a map,
266 would expand it to its current value for the client's host name. Supported
267 variables are:
268 .Bl -column "PLATFORM" "arch -k or uname -m"
269 .It Sy NAME Ta Sy OUTPUT OF Ta Sy DESCRIPTION (EXAMPLE)
270 .It Ev ARCH
271 .Ta Nm arch
272 .Ta architecture name
273 .Pq Qq Sy sun4
274 .It Ev CPU
275 .Ta Nm uname Fl p
276 .Ta processor type
277 .Pq Qq Sy sparc
278 .It Ev HOST
279 .Ta Nm uname Fl n
280 .Ta host name
281 .Pq Qq Sy myhost
282 .It Ev KARCH
283 .Ta Nm arch Fl k No or Nm uname Fl m
284 .Ta kernel architecture name or machine hardware name
285 .Pq Qq Sy sun4u
286 .It Ev OSNAME
287 .Ta Nm uname Fl s
288 .Ta OS name
289 .Pq Qq Sy SunOS
290 .It Ev OSREL
291 .Ta Nm name Fl r
292 .Ta OS release name
293 .Pq Qq Sy 5.3
294 .It Ev OSVERS
295 .Ta Nm uname Fl v
296 .Ta OS version
297 .Pq Qq Sy beta1.0
298 .It Ev NATISA
299 .Ta Nm isainfo Fl n
300 .Ta native instruction set architecture for the system
301 .Pq Qq Sy sparcv9
302 .It Ev PLATFORM
303 .Ta Nm uname Fl i
304 .Ta platform name
305 .Pq Qq Sy SUNW,Sun-Fire-V240
308 If a reference needs to be protected from affixed characters, you can surround
309 the variable name with curly braces
310 .Pq Qq Sy \(lC Ns Sy \(rC .
311 .Ss Multiple Mounts
312 A multiple mount entry takes the form:
313 .Bd -literal -offset indent
314 .Ar key Oo Fl Ns Ar mount-options Oc Oo Oo Ar mountpoint Oc
315 .Oo Fl Ns Ar mount-options Oc  Ar location Ns ... Oc Ns ...
318 The initial
319 .Ar mountpoint
320 is optional for the first mount and mandatory for all subsequent mounts. The
321 optional
322 .Ar mountpoint
323 is taken as a pathname relative to the directory named by
324 .Ar key .
326 .Ar mountpoint
327 is omitted in the first occurrence, a
328 .Ar mountpoint
330 .Pa /
331 .Pq root
332 is implied.
334 Given an entry in the indirect map for
335 .Pa /src :
336 .Bd -literal -offset indent
337 beta    -ro \e
338         /               svr1,svr2:/export/src/beta  \e
339         /1.0            svr1,svr2:/export/src/beta/1.0 \e
340         /1.0/man        svr1,svr2:/export/src/beta/1.0/man
343 All offsets must exist on the server under
344 .Sy beta .
346 will automatically mount
347 .Pa /src/beta ,
348 .Pa /src/beta/1.0 ,
350 .Pa /src/beta/1.0/man ,
351 as needed, from either
352 .Sy svr1
354 .Sy svr2 ,
355 whichever host is nearest and responds first.
356 .Ss Other File System Types
357 The automounter assumes NFS mounts as a default file system type. Other file
358 system types can be described using the
359 .Sy fstype
360 mount option. Other mount options specific to this file system type can be
361 combined with the
362 .Sy fstype
363 option. The location field must contain information specific to the file system
364 type. If the location field begins with a slash, a colon character must be
365 prepended, for instance, to mount a CD file system:
366 .Bd -literal -offset indent
367 cdrom   -fstype=hsfs,ro :/dev/sr0
370 or to perform an
371 .Nm autofs
372 mount:
373 .Bd -literal -offset indent
374 src     -fstype=autofs  auto_src
377 Use this procedure only if you are not using Volume Manager.
379 See the
380 .Sx NOTES
381 section for information on option inheritance.
382 .Ss Indirect Maps
383 An indirect map allows you to specify mappings for the subdirectories you wish
384 to mount under the
385 .Ar directory
386 indicated on the command line. In an indirect map, each
387 .Ar key
388 consists of a simple name that refers to one or more file systems that are to be
389 mounted as needed.
390 .Ss Direct Maps
391 Entries in a direct map are associated directly with
392 .Nm autofs
393 mount points. Each
394 .Ar key
395 is the full pathname of an
396 .Nm autofs
397 mount point. The direct map as a whole is not associated with any single
398 directory.
400 Direct maps are distinguished from indirect maps by the
401 .Sy \-
402 key. For example:
403 .Bd -literal -offset indent
404 # Master map for automounter
406 +auto_master
407 /net    -hosts          -nosuid,nobrowse
408 /home   auto_home       -nobrowse
409 /-      auto_direct
411 .Ss Included Maps
412 The contents of another map can be included within a map with an entry of the
413 form
414 .Bd -literal -offset indent
415 .No + Ns Ar mapname
419 .Ar mapname
420 begins with a slash, it is assumed to be the pathname of a local file.
421 Otherwise, the location of the map is determined by the policy of the name
422 service switch according to the entry for the automounter in
423 .Pa /etc/nsswitch.conf ,
424 such as
425 .Bd -literal -offset indent
426 automount: files nis
429 If the name service is
430 .Sy files ,
431 then the name is assumed to be that of a local file in
432 .Pa /etc .
433 If the key being searched for is not found in the included map, the search
434 continues with the next entry.
435 .Ss Special Maps
436 There are two special maps available:
437 .Sy -hosts
439 .Sy -null .
441 .Sy -hosts
442 map is used with the
443 .Pa /net
444 directory and assumes that the map key is the hostname of an NFS server. The
445 .Nm automountd
446 daemon dynamically constructs a map entry from the server's list of exported
447 file systems. References to a directory under
448 .Pa /net/hermes
449 will refer to the corresponding directory relative to
450 .Sy hermes
451 root.
454 .Sy -null
455 map cancels a previous map for the directory indicated. This is most useful in
457 .Pa /etc/auto_master
458 for cancelling entries that would otherwise be inherited from the
459 .Sy +auto_master
460 include entry. To be effective, the
461 .Sy -null
462 entries must be inserted before the included map entry.
463 .Ss Executable Maps
464 Local maps that have the execute bit set in their file permissions will be
465 executed by the automounter and provided with a key to be looked up as an
466 argument. The executable map is expected to return the content of an
467 automounter map entry on its stdout or no output if the entry cannot be
468 determined. A direct map cannot be made executable.
469 .Ss Configuration and the auto_master Map
470 When initiated without arguments,
472 consults the master map for a list of
473 .Nm autofs
474 mount points and their maps. It mounts any
475 .Nm autofs
476 mounts that are not already mounted, and unmounts
477 .Nm autofs
478 mounts that have been removed from the master map or direct map.
480 The master map is assumed to be called
481 .Sy auto_master
482 and its location is determined by the name service switch policy. Normally the
483 master map is located initially as a local file
484 .Pa /etc/auto_master .
485 .Ss Browsing
487 .Nm automountd
488 daemon supports browsability of indirect maps. This allows all of the potential
489 mount points to be visible, whether or not they are mounted. The
490 .Sy -nobrowse
491 option can be added to any indirect
492 .Nm autofs
493 map to disable browsing. For example:
494 .Bd -literal -offset indent
495 /net    -hosts          -nosuid,nobrowse
496 /home   auto_home
499 In this case, any
500 .Ar hostname Ns s
501 would only be visible in
502 .Pa /net
503 after they are mounted, but all potential mount points would be visible under
504 .Pa /home .
506 .Sy -browse
507 option enables browsability of
508 .Nm autofs
509 file systems. This is the default for all indirect maps.
512 .Sy -browse
513 option does not work in conjunction with the wildcard key.
514 .Ss Restricting Mount Maps
515 Options specified for a map are used as the default options for all the entries
516 in that map. They are ignored when map entries specify their own mount options.
518 In some cases, however, it is desirable to force
519 .Sy nosuid , nodevices , nosetuid ,
521 .Sy noexec
522 for a complete mount map and its submounts. This can be done by specifying the
523 additional mount option,
524 .Sy -restrict .
525 .Bd -literal -offset indent
526 /home   auto_home       -restrict,nosuid,hard
530 .Sy -restrict
531 option forces the inheritance of all the restrictive options
532 .Sy nosuid , nodevices , nosetuid ,
534 .Sy noexec
535 as well as the restrict option itself. In this particular example, the
536 .Sy nosuid
538 .Sy restrict
539 option are inherited but the
540 .Sy hard
541 option is not. The
542 .Sy restrict
543 option also prevents the execution of
544 .Qq executable maps
545 and is enforced for auto mounts established by programs with fewer than all
546 privileges available in their zone.
547 .Sh FILES
548 .Bl -tag -width Ds
549 .It Pa /etc/auto_master
550 Master automount map.
551 .It Pa /etc/auto_home
552 Map to support automounted home directories.
553 .It Pa /etc/nsswitch.conf
554 Name service switch configuration file. See
555 .Xr nsswitch.conf 4 .
557 .Sh EXIT STATUS
558 .Ex -std
559 .Sh SEE ALSO
560 .Xr isainfo 1 ,
561 .Xr ls 1 ,
562 .Xr svcs 1 ,
563 .Xr uname 1 ,
564 .Xr automountd 8 ,
565 .Xr mount 8 ,
566 .Xr mount_nfs 8 ,
567 .Xr svcadm 8 ,
568 .Xr autofs 4 ,
569 .Xr attributes 5 ,
570 .Xr nfssec 5 ,
571 .Xr smf 5
572 .Sh NOTES
573 .Nm autofs
574 mount points must not be hierarchically related.
576 does not allow an
577 .Nm autofs
578 mount point to be created within another
579 .Nm autofs
580 mount.
582 Since each direct map entry results in a new
583 .Nm autofs
584 mount such maps should be kept short.
586 Entries in both direct and indirect maps can be modified at any time. The new
587 information is used when
588 .Nm automountd
589 next uses the map entry to do a mount.
591 New entries added to a master map or direct map will not be useful until the
592 automount command is run to install them as new
593 .Nm autofs
594 mount points. New entries added to an indirect map may be used immediately.
596 As of the Solaris 2.6 release, a listing
597 .Po see
598 .Xr ls 1
600 of the
601 .Nm autofs
602 directory associated with an indirect map shows all potential mountable
603 entries. The attributes associated with the potential mountable entries are
604 temporary. The real file system attributes will only be shown once the file
605 system has been mounted.
607 Default mount options can be assigned to an entire map when specified as an
608 optional third field in the master map. These options apply only to map entries
609 that have no mount options. Note that map entities with options override the
610 default options, as at this time, the options do not concatenate. The
611 concatenation feature is planned for a future release.
613 When operating on a map that invokes an NFS mount, the default number of
614 retries for the automounter is 0, that is, a single mount attempt, with no
615 retries. Note that this is significantly different from the default
616 .Pq 10000
617 for the
618 .Xr mount_nfs 8
619 utility.
621 The Network Information Service
622 .Pq NIS
623 was formerly known as Sun Yellow Pages
624 .Pq YP .
625 The functionality of the two remains the same.
629 service is managed by the service management facility,
630 .Xr smf 5 ,
631 under the service identifier:
632 .Bd -literal -offset indent
633 svc:/system/filesystem/autofs:default
636 Administrative actions on this service, such as enabling, disabling, or
637 requesting restart, can be performed using
638 .Xr svcadm 8 .
639 The service's status can be queried using the
640 .Xr svcs 1
641 command.