1automount(1M) System Administration Commands automount(1M)
2
3
4
6 automount - install automatic mount points
7
9 /usr/sbin/automount [-t duration] [-v]
10
11
13 The automount utility installs autofs mount points and associates an
14 automount map with each mount point. It starts the automountd(1M) dae‐
15 mon if it finds any non-trivial entries in either local or distributed
16 automount maps and if the daemon is not already running. The autofs
17 file system monitors attempts to access directories within it and noti‐
18 fies the automountd(1M) daemon. The daemon uses the map to locate a
19 file system, which it then mounts at the point of reference within the
20 autofs file system. A map can be assigned to an autofs mount using an
21 entry in the /etc/auto_master map or a direct map.
22
23
24 If the file system is not accessed within an appropriate interval (10
25 minutes by default), the automountd daemon unmounts the file system.
26
27
28 The file /etc/auto_master determines the locations of all autofs mount
29 points. By default, this file contains three entries:
30
31 # Master map for automounter
32 #
33 +auto_master
34 /net -hosts -nosuid
35 /home auto_home
36
37
38
39
40 The +auto_master entry is a reference to an external NIS or NIS+ master
41 map. If one exists, then its entries are read as if they occurred in
42 place of the +auto_master entry. The remaining entries in the master
43 file specify a directory on which an autofs mount will be made followed
44 by the automounter map to be associated with it. Optional mount options
45 may be supplied as an optional third field in the each entry. These
46 options are used for any entries in the map that do not specify mount
47 options explicitly. The automount command is usually run without argu‐
48 ments. It compares the entries /etc/auto_master with the current list
49 of autofs mounts in /etc/mnttab and adds, removes or updates autofs
50 mounts to bring the /etc/mnttab up to date with the /etc/auto_master.
51 At boot time it installs all autofs mounts from the master map. Subse‐
52 quently, it may be run to install autofs mounts for new entries in the
53 master map or the direct map, or to perform unmounts for entries that
54 have been removed from these maps.
55
56 Automount with Solaris Trusted Extensions
57 If a system is configured with Solaris Trusted Extensions, additional
58 processing is performed to facilitate multilevel home directory access.
59 A list of zones whose labels are dominated by the current zone is gen‐
60 erated and default auto_home automount maps are generated if they do
61 not currently exist. These automount maps are named auto_home_<zone‐
62 name>, where <zonename> is the name of each zone's lower-level zone. An
63 autofs mount of each such auto_home map is then performed, regardless
64 of whether it is explicitly or implicitly listed in the master map.
65 Instead of autofs mounting the standard auto_home map, the zone uses an
66 auto_home file appended with its own zone name. Each zone's auto_home
67 map is uniquely named so that it can be maintained and shared by all
68 zones using a common name server.
69
70
71 By default, the home directories of lower-level zones are mounted read-
72 only under /zone/<zonename>/export/home when each zone is booted. The
73 default auto_home_<zonename> automount map specifies that path as the
74 source directory for an lofs remount onto /zone/<zonename>/home/<user‐
75 name>. For example, the file auto_home_public, as generated from a
76 higher level zone would contain:
77
78
79 +auto_home_public
80
81
82 * -fstype=lofs :/zone/public/export/home/&
83
84
85 When a home directory is referenced and the name does not match any
86 other keys in the auto_home_public map, it will match this loopback
87 mount specification. If this loopback match occurs and the name corre‐
88 sponds to a valid user whose home directory does not exist in the pub‐
89 lic zone, the directory is automatically created on behalf of the user.
90
92 The following options are supported:
93
94 -t duration Specifies a duration, in seconds, that a file system is
95 to remain mounted when not in use. The default is 10
96 minutes.
97
98
99 -v Verbose mode. Notifies of autofs mounts, unmounts, or
100 other non-essential information.
101
102
104 Map Entry Format
105 A simple map entry (mapping) takes the form:
106
107 key [ -mount-options ] location ...
108
109
110
111
112 where key is the full pathname of the directory to mount when used in a
113 direct map, or the simple name of a subdirectory in an indirect map.
114 mount-options is a comma-separated list of mount options, and location
115 specifies a file system from which the directory may be mounted. In the
116 case of a simple NFS mount, the options that can be used are as speci‐
117 fied in mount_nfs(1M), and location takes the form:
118
119 host:pathname
120
121
122
123
124 host is the name of the host from which to mount the file system, and
125 pathname is the absolute pathname of the directory to mount.
126
127
128 Options to other file systems are documented on the other mount_* ref‐
129 erence manual pages, for example, mount_cachefs(1M).
130
131 Replicated File Systems
132 Multiple location fields can be specified for replicated NFS file sys‐
133 tems, in which case automount and the kernel will each try to use that
134 information to increase availability. If the read-only flag is set in
135 the map entry, automountd mounts a list of locations that the kernel
136 may use, sorted by several criteria. Only locations available at mount
137 time will be mounted, and thus be available to the kernel. When a
138 server does not respond, the kernel will switch to an alternate server.
139 The sort ordering of automount is used to determine how the next server
140 is chosen. If the read-only flag is not set, automount will mount the
141 best single location, chosen by the same sort ordering, and new servers
142 will only be chosen when an unmount has been possible, and a remount is
143 done. Servers on the same local subnet are given the strongest prefer‐
144 ence, and servers on the local net are given the second strongest pref‐
145 erence. Among servers equally far away, response times will determine
146 the order if no weighting factors (see below) are used.
147
148
149 If the list includes server locations using both the NFS Version 2 Pro‐
150 tocol and the NFS Version 3 Protocol, automount will choose only a sub‐
151 set of the server locations on the list, so that all entries will be
152 the same protocol. It will choose servers with the NFS Version 3 Proto‐
153 col so long as an NFS Version 2 Protocol server on a local subnet will
154 not be ignored. See the for additional details.
155
156
157 If each location in the list shares the same pathname then a single
158 location may be used with a comma-separated list of hostnames:
159
160 hostname,hostname...:pathname
161
162
163
164
165 Requests for a server may be weighted, with the weighting factor
166 appended to the server name as an integer in parentheses. Servers with‐
167 out a weighting are assumed to have a value of zero (most likely to be
168 selected). Progressively higher values decrease the chance of being
169 selected. In the example,
170
171 man -ro alpha,bravo,charlie(1),delta(4):/usr/man
172
173
174
175
176 hosts alpha and bravo have the highest priority; host delta has the
177 lowest.
178
179
180 Server proximity takes priority in the selection process. In the exam‐
181 ple above, if the server delta is on the same network segment as the
182 client, but the others are on different network segments, then delta
183 will be selected; the weighting value is ignored. The weighting has
184 effect only when selecting between servers with the same network prox‐
185 imity. The automounter always selects the localhost over other servers
186 on the same network segment, regardless of weighting.
187
188
189 In cases where each server has a different export point, the weighting
190 can still be applied. For example:
191
192 man -ro alpha:/usr/man bravo,charlie(1):/usr/share/man
193 delta(3):/export/man
194
195
196
197
198 A mapping can be continued across input lines by escaping the NEWLINE
199 with a backslash (\) Comments begin with a number sign (#) and end at
200 the subsequent NEWLINE.
201
202 Map Key Substitution
203 The ampersand (&) character is expanded to the value of the key field
204 for the entry in which it occurs. In this case:
205
206 jane sparcserver:/home/&
207
208
209
210
211 the & expands to jane.
212
213 Wildcard Key
214 The asterisk (*) character, when supplied as the key field, is recog‐
215 nized as the catch-all entry. Such an entry will match any key not pre‐
216 viously matched. For instance, if the following entry appeared in the
217 indirect map for /config:
218
219 * &:/export/config/&
220
221
222
223
224 this would allow automatic mounts in /config of any remote file system
225 whose location could be specified as:
226
227 hostname:/export/config/hostname
228
229
230
231
232 Note that the wildcard key does not work in conjunction with the
233 -browse option.
234
235 Variable Substitution
236 Client specific variables can be used within an automount map. For
237 instance, if $HOST appeared within a map, automount would expand it to
238 its current value for the client's host name. Supported variables are:
239
240
241
242
243 ARCH The output of arch The architecture name.
244 For example, sun4 on a
245 sun4u machine.
246 CPU The output of uname -p The processor type.
247 For example, "sparc"
248 HOST The output of uname -n The host name.
249 For example, myhost.
250 KARCH The output of arch -k or uname -m The kernel architec‐
251 ture name or machine
252 hardware name. For
253 example, sun4u.
254
255 OSNAME The output of uname -s The OS name.
256 For example, "SunOS"
257 OSREL The output of uname -r The OS release name.
258 For example "5.3"
259 OSVERS The output of uname -v The OS version.
260 For example, "beta1.0"
261 NATISA The output of isainfo -n The native instruction
262 set architecture for
263 the system.
264 For example, "sparcv9"
265
266
267
268 PLATFORM The output of uname -i The platform name. For
269 example, SUNW,Sun-
270 Fire-V240.
271
272
273
274
275 If a reference needs to be protected from affixed characters, you can
276 surround the variable name with curly braces ({}).
277
278 Multiple Mounts
279 A multiple mount entry takes the form:
280
281 key [-mount-options] [[mountpoint] [-mount-options] location...]...
282
283
284
285
286 The initial /[mountpoint] is optional for the first mount and mandatory
287 for all subsequent mounts. The optional mountpoint is taken as a path‐
288 name relative to the directory named by key. If mountpoint is omitted
289 in the first occurrence, a mountpoint of / (root) is implied.
290
291
292 Given an entry in the indirect map for /src
293
294 beta -ro\
295 / svr1,svr2:/export/src/beta \
296 /1.0 svr1,svr2:/export/src/beta/1.0 \
297 /1.0/man svr1,svr2:/export/src/beta/1.0/man
298
299
300
301
302 All offsets must exist on the server under beta. automount will auto‐
303 matically mount /src/beta, /src/beta/1.0, and /src/beta/1.0/man, as
304 needed, from either svr1 or svr2, whichever host is nearest and
305 responds first.
306
307 Other File System Types
308 The automounter assumes NFS mounts as a default file system type. Other
309 file system types can be described using the fstype mount option. Other
310 mount options specific to this file system type can be combined with
311 the fstype option. The location field must contain information specific
312 to the file system type. If the location field begins with a slash, a
313 colon character must be prepended, for instance, to mount a CD file
314 system:
315
316 cdrom -fstype=hsfs,ro :/dev/sr0
317
318
319
320
321 or to perform an autofs mount:
322
323 src -fstype=autofs auto_src
324
325
326
327
328 Use this procedure only if you are not using Volume Manager.
329
330
331 Mounts using CacheFS are most useful when applied to an entire map as
332 map defaults. The following entry in the master map describes cached
333 home directory mounts. It assumes the default location of the cache
334 directory, /cache.
335
336 /home auto_home -fstype =cachefs,backfstype=nfs
337
338
339
340
341 See the NOTES section for information on option inheritance.
342
343 Indirect Maps
344 An indirect map allows you to specify mappings for the subdirectories
345 you wish to mount under the directory indicated on the command line. In
346 an indirect map, each key consists of a simple name that refers to one
347 or more file systems that are to be mounted as needed.
348
349 Direct Maps
350 Entries in a direct map are associated directly with autofs mount
351 points. Each key is the full pathname of an autofs mount point. The
352 direct map as a whole is not associated with any single directory.
353
354
355 Direct maps are distinguished from indirect maps by the /- key. For
356 example:
357
358 # Master map for automounter
359 #
360 +auto_master
361 /net -hosts -nosuid,nobrowse
362 /home auto_home -nobrowse
363 /- auto_direct
364
365
366
367 Included Maps
368 The contents of another map can be included within a map with an entry
369 of the form
370
371 +mapname
372
373
374
375
376 If mapname begins with a slash, it is assumed to be the pathname of a
377 local file. Otherwise, the location of the map is determined by the
378 policy of the name service switch according to the entry for the auto‐
379 mounter in /etc/nsswitch.conf, such as
380
381 automount: files nis
382
383
384
385
386 If the name service is files, then the name is assumed to be that of a
387 local file in /etc. If the key being searched for is not found in the
388 included map, the search continues with the next entry.
389
390 Special Maps
391 There are two special maps available: -hosts and -null. The -hosts map
392 is used with the /net directory and assumes that the map key is the
393 hostname of an NFS server. The automountd daemon dynamically constructs
394 a map entry from the server's list of exported file systems. References
395 to a directory under /net/hermes will refer to the corresponding direc‐
396 tory relative to hermes root.
397
398
399 The -null map cancels a previous map for the directory indicated. This
400 is most useful in the /etc/auto_master for cancelling entries that
401 would otherwise be inherited from the +auto_master include entry. To be
402 effective, the -null entries must be inserted before the included map
403 entry.
404
405 Executable Maps
406 Local maps that have the execute bit set in their file permissions will
407 be executed by the automounter and provided with a key to be looked up
408 as an argument. The executable map is expected to return the content of
409 an automounter map entry on its stdout or no output if the entry cannot
410 be determined. A direct map cannot be made executable.
411
412 Configuration and the auto_master Map
413 When initiated without arguments, automount consults the master map for
414 a list of autofs mount points and their maps. It mounts any autofs
415 mounts that are not already mounted, and unmounts autofs mounts that
416 have been removed from the master map or direct map.
417
418
419 The master map is assumed to be called auto_master and its location is
420 determined by the name service switch policy. Normally the master map
421 is located initially as a local file /etc/auto_master.
422
423 Browsing
424 The automount daemon supports browsability of indirect maps. This
425 allows all of the potential mount points to be visible, whether or not
426 they are mounted. The -nobrowse option can be added to any indirect
427 autofs map to disable browsing. For example:
428
429 /net -hosts -nosuid,nobrowse
430 /home auto_home
431
432
433
434
435 In this case, any hostnames would only be visible in /net after they
436 are mounted, but all potential mount points would be visible under
437 /home. The -browse option enables browsability of autofs file systems.
438 This is the default for all indirect maps.
439
440
441 The -browse option does not work in conjunction with the wildcard key.
442
443 Restricting Mount Maps
444 Options specified for a map are used as the default options for all the
445 entries in that map. They are ignored when map entries specify their
446 own mount options.
447
448
449 In some cases, however, it is desirable to force nosuid, nodevices,
450 nosetuid, or noexec for a complete mount map and its submounts. This
451 can be done by specifying the additional mount option, -restrict.
452
453 /home auto_home -restrict,nosuid,hard
454
455
456
457
458 The -restrict option forces the inheritance of all the restrictive
459 options nosuid, nodevices, nosetuid, and noexec as well as the restrict
460 option itself. In this particular example, the nosuid and restrict
461 option are inherited but the hard option is not. The restrict option
462 also prevents the execution of "executable maps" and is enforced for
463 auto mounts established by programs with fewer than all privileges
464 available in their zone.
465
467 The following exit values are returned:
468
469 0 Successful completion.
470
471
472 1 An error occurred.
473
474
476 /etc/auto_master Master automount map.
477
478
479 /etc/auto_home Map to support automounted home directories.
480
481
482 /etc/default/autofs Supplies default values for parameters for auto‐
483 mount and automountd. See autofs(4).
484
485
486 /etc/nsswitch.conf Name service switch configuration file. See nss‐
487 witch.conf(4).
488
489
491 See attributes(5) for descriptions of the following attributes:
492
493
494
495
496 ┌─────────────────────────────┬─────────────────────────────┐
497 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
498 ├─────────────────────────────┼─────────────────────────────┤
499 │Availability │SUNWcsu │
500 └─────────────────────────────┴─────────────────────────────┘
501
503 isainfo(1), ls(1), svcs(1), uname(1), automountd(1M), mount(1M),
504 mount_cachefs( 1M), mount_nfs(1M), svcadm(1M), autofs(4),
505 attributes(5), nfssec(5), smf(5)
506
507
508
509
511 autofs mount points must not be hierarchically related. automount does
512 not allow an autofs mount point to be created within another autofs
513 mount.
514
515
516 Since each direct map entry results in a new autofs mount such maps
517 should be kept short.
518
519
520 Entries in both direct and indirect maps can be modified at any time.
521 The new information is used when automountd next uses the map entry to
522 do a mount.
523
524
525 New entries added to a master map or direct map will not be useful
526 until the automount command is run to install them as new autofs mount
527 points. New entries added to an indirect map may be used immediately.
528
529
530 As of the Solaris 2.6 release, a listing (see ls(1)) of the autofs
531 directory associated with an indirect map shows all potential mountable
532 entries. The attributes associated with the potential mountable entries
533 are temporary. The real file system attributes will only be shown once
534 the file system has been mounted.
535
536
537 Default mount options can be assigned to an entire map when specified
538 as an optional third field in the master map. These options apply only
539 to map entries that have no mount options. Note that map entities with
540 options override the default options, as at this time, the options do
541 not concatenate. The concatenation feature is planned for a future
542 release.
543
544
545 When operating on a map that invokes an NFS mount, the default number
546 of retries for the automounter is 0, that is, a single mount attempt,
547 with no retries. Note that this is significantly different from the
548 default (10000) for the mount_nfs(1M) utility.
549
550
551 The Network Information Service (NIS) was formerly known as Sun Yellow
552 Pages (YP). The functionality of the two remains the same.
553
554
555 The automount service is managed by the service management facility,
556 smf(5), under the service identifier:
557
558 svc:/system/filesystem/autofs:default
559
560
561
562
563 Administrative actions on this service, such as enabling, disabling, or
564 requesting restart, can be performed using svcadm(1M). The service's
565 status can be queried using the svcs(1) command.
566
567
568
569SunOS 5.11 28 Mar 2008 automount(1M)