xref: /openbsd/usr.sbin/amd/doc/amdref.texinfo (revision fc61954a)
1\input texinfo		@c -*-texinfo-*-
2@c
3@c Copyright (c) 1989 Jan-Simon Pendry
4@c Copyright (c) 1989 Imperial College of Science, Technology & Medicine
5@c Copyright (c) 1989 The Regents of the University of California.
6@c All rights reserved.
7@c
8@c This code is derived from software contributed to Berkeley by
9@c Jan-Simon Pendry at Imperial College, London.
10@c
11@c Redistribution and use in source and binary forms, with or without
12@c modification, are permitted provided that the following conditions
13@c are met:
14@c 1. Redistributions of source code must retain the above copyright
15@c    notice, this list of conditions and the following disclaimer.
16@c 2. Redistributions in binary form must reproduce the above copyright
17@c    notice, this list of conditions and the following disclaimer in the
18@c    documentation and/or other materials provided with the distribution.
19@c 3. All advertising materials mentioning features or use of this software
20@c    must display the following acknowledgement:
21@c      This product includes software developed by the University of
22@c      California, Berkeley and its contributors.
23@c 4. Neither the name of the University nor the names of its contributors
24@c    may be used to endorse or promote products derived from this software
25@c    without specific prior written permission.
26@c
27@c THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
28@c ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
29@c IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
30@c ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
31@c FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
32@c DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
33@c OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
34@c HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
35@c LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
36@c OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
37@c
38@c	from: @(#)amdref.texinfo	8.1 (Berkeley) 6/6/93
39@c	$Id: amdref.texinfo,v 1.13 2015/01/21 09:47:15 guenther Exp $
40@c
41@setfilename amdref.info
42@c @setfilename /usr/local/emacs/info/amd
43@tex
44\overfullrule=0pt
45@end tex
46
47@settitle 4.4 BSD Automounter Reference Manual
48@dircategory Miscellaneous
49@direntry
50* Amdref: (amdref).                 4.4 BSD Automounter Reference Manual
51@end direntry
52
53@titlepage
54@sp 6
55@center @titlefont{Amd}
56@sp 2
57@center @titlefont{The 4.4 BSD Automounter}
58@sp 2
59@center @titlefont{Reference Manual}
60@sp 2
61@center @authorfont{Jan-Simon Pendry}
62@sp
63@center @i{and}
64@sp
65@center @authorfont{Nick Williams}
66@sp 4
67@center Last updated March 1991
68@center Documentation for software revision 5.3 Alpha
69@page
70Copyright @copyright{} 1989 Jan-Simon Pendry
71@sp -1
72Copyright @copyright{} 1989 Imperial College of Science, Technology & Medicine
73@sp -1
74Copyright @copyright{} 1989 The Regents of the University of California.
75@sp 0
76All Rights Reserved.
77@vskip 1ex
78Permission to copy this document, or any portion of it, as
79necessary for use of this software is granted provided this
80copyright notice and statement of permission are included.
81@end titlepage
82@page
83@ifinfo
84@node Top, License, , (DIR)
85
86Amd - The 4.4 BSD Automounter
87*****************************
88
89Amd is the 4.4 BSD Automounter.  This Info file describes how
90to use and understand Amd.
91@end ifinfo
92
93@menu
94* License::                  Explains the terms and conditions for using
95                             and distributing Amd.
96* Distrib::                  How to get the latest Amd distribution.
97* Intro::                    An introduction to Automounting concepts.
98* Overview::                 An overview of Amd.
99* Supported Platforms::      Machines and Systems supported by Amd.
100* Mount Maps::               Details of mount maps
101* Amd Command Line Options:: All the Amd command line options explained.
102* Filesystem Types::         The different mount types supported by Amd.
103* Run-time Administration::  How to start, stop and control Amd.
104* Examples::                 Some examples showing how Amd might be used.
105* Internals::                Implementation details.
106* Acknowledgements & Trademarks:: Legal notes.
107
108Indexes
109* Index::                    An item for each concept.
110@end menu
111
112@iftex
113@unnumbered Preface
114
115This manual documents the use of the 4.4 BSD automounter---@i{Amd}.
116This is primarily a reference manual.  Unfortunately, no tutorial
117exists.
118
119This manual comes in two forms: the published form and the Info form.
120The Info form is for on-line perusal with the INFO program which is
121distributed along with GNU Emacs.  Both forms contain substantially the
122same text and are generated from a common source file, which is
123distributed with the @i{Amd} source.
124@end iftex
125
126@node License, Distrib, Top, Top
127@unnumbered License
128@cindex License Information
129
130@i{Amd} is not in the public domain; it is copyrighted and there are
131restrictions on its distribution.
132
133Redistribution and use in source and binary forms are permitted provided
134that: (1) source distributions  retain this entire  copyright notice and
135comment, and (2) distributions including  binaries display the following
136acknowledgement: ``This product  includes  software  developed  by   The
137University  of California,   Berkeley  and its  Contributors''  in   the
138documentation  or other materials provided with  the distribution and in
139all advertising materials mentioning  features  or use of this software.
140neither the name of the University nor the names of its Contributors may
141be  used   to endorse or promote   products  derived from  this software
142without specific prior written permission.
143
144THIS SOFTWARE IS  PROVIDED ``AS IS''  AND WITHOUT ANY EXPRESS OR IMPLIED
145WARRANTIES, INCLUDING,  WITHOUT  LIMITATION,  THE IMPLIED  WARRANTIES OF
146MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
147
148@node Distrib, Intro, License, Top
149@unnumbered Source Distribution
150@cindex Source code distribution
151@cindex Obtaining the source code
152
153If you have access to the Internet, you can get the latest distribution
154version of @i{Amd} from host @file{usc.edu} using anonymous FTP.  Move to
155the directory @file{/pub/amd} on that host and fetch the file @file{amd.tar.Z}.
156
157If you are in the UK, you can get the latest distribution version of
158@i{Amd} from the UKnet info-server.  Start by sending email to
159@file{info-server@@doc.ic.ac.uk}.
160
161Sites on the UK JANET network can get the latest distribution by using
162anonymous NIFTP to fetch the file @samp{<AMD>amd.tar.Z} from host
163@samp{uk.ac.imperial.doc.src}.
164
165Revision 5.2 was part of the 4.3 BSD Reno distribution.
166
167Revision 5.3bsdnet, a late alpha version of 5.3, was part
168of the BSD network version 2 distribution
169
170@unnumberedsec Bug Reports
171@cindex Bug reports
172
173Send all bug reports to @file{jsp@@doc.ic.ac.uk} quoting the details of
174the release and your configuration.  These can be obtained by running
175the command @samp{amd -v}.
176
177@unnumberedsec Mailing List
178@cindex Mailing list
179
180There is a mailing list for people interested in keeping uptodate with
181developments.  To subscribe, send a note to @file{amd-workers-request@@acl.lanl.gov}.
182
183@node Intro, Overview, Distrib, Top
184@unnumbered Introduction
185@cindex Introduction
186
187An @dfn{automounter} maintains a cache of mounted filesystems.
188Filesystems are mounted on demand when they are first referenced,
189and unmounted after a period of inactivity.
190
191@i{Amd} may be used as a replacement for Sun's automounter.  The choice
192of which filesystem to mount can be controlled dynamically with
193@dfn{selectors}.  Selectors allow decisions of the form ``hostname is
194@var{this},'' or ``architecture is not @var{that}.''  Selectors may be
195combined arbitrarily.  @i{Amd} also supports a variety of filesystem
196types, including NFS, UFS and the novel @dfn{program} filesystem.  The
197combination of selectors and multiple filesystem types allows identical
198configuration files to be used on all machines so reducing the
199administrative overhead.
200
201@i{Amd} ensures that it will not hang if a remote server goes down.
202Moreover, @i{Amd} can determine when a remote server has become
203inaccessible and then mount replacement filesystems as and when they
204become available.
205
206@i{Amd} contains no proprietary source code and has been ported to
207numerous flavours of Unix.
208
209@node Overview, Supported Platforms, Intro, Top
210@chapter Overview
211
212@i{Amd} maintains a cache of mounted filesystems.  Filesystems are
213@dfn{demand-mounted} when they are first referenced, and unmounted after
214a period of inactivity.  @i{Amd} may be used as a replacement for Sun's
215@b{automount}(8) program.  It contains no proprietary source code and
216has been ported to numerous flavours of Unix.  @xref{Supported Operating
217Systems}.@refill
218
219@i{Amd} was designed as the basis for experimenting with filesystem
220layout and management.  Although @i{Amd} has many direct applications it
221is loaded with additional features which have little practical use.  At
222some point the infrequently used components may be removed to streamline
223the production system.
224
225@c @i{Amd} supports the notion of @dfn{replicated} filesystems by evaluating
226@c each member of a list of possible filesystem locations in parallel.
227@c @i{Amd} checks that each cached mapping remains valid.  Should a mapping be
228@c lost -- such as happens when a fileserver goes down -- @i{Amd} automatically
229@c selects a replacement should one be available.
230@c
231@menu
232* Fundamentals::
233* Filesystems and Volumes::
234* Volume Naming::
235* Volume Binding::
236* Operational Principles::
237* Mounting a Volume::
238* Automatic Unmounting::
239* Keep-alives::
240* Non-blocking Operation::
241@end menu
242
243@node     Fundamentals, Filesystems and Volumes, Overview, Overview
244@comment  node-name,  next,  previous,  up
245@section Fundamentals
246@cindex Automounter fundamentals
247
248The fundamental concept behind @i{Amd} is the ability to separate the
249name used to refer to a file from the name used to refer to its physical
250storage location.  This allows the same files to be accessed with the
251same name regardless of where in the network the name is used.  This is
252very different from placing @file{/n/hostname} in front of the pathname
253since that includes location dependent information which may change if
254files are moved to another machine.
255
256By placing the required mappings in a centrally administered database,
257filesystems can be re-organised without requiring changes to
258configuration files, shell scripts and so on.
259
260@node     Filesystems and Volumes, Volume Naming, Fundamentals, Overview
261@comment  node-name,  next,  previous,  up
262@section Filesystems and Volumes
263@cindex Filesystem
264@cindex Volume
265@cindex Fileserver
266@cindex sublink
267
268@i{Amd} views the world as a set of fileservers, each containg one or
269more filesystems where each filesystem contains one or more
270@dfn{volumes}.  Here the term @dfn{volume} is used to refer to a
271coherent set of files such as a user's home directory or a @TeX{}
272distribution.@refill
273
274In order to access the contents of a volume, @i{Amd} must be told in
275which filesystem the volume resides and which host owns the filesystem.
276By default the host is assumed to be local and the volume is assumed to
277be the entire filesystem.  If a filesystem contains more than one
278volume, then a @dfn{sublink} is used to refer to the sub-directory
279within the filesystem where the volume can be found.
280
281@node     Volume Naming, Volume Binding, Filesystems and Volumes, Overview
282@comment  node-name,  next,  previous,  up
283@section Volume Naming
284@cindex Volume names
285@cindex Network-wide naming
286@cindex Replicated volumes
287@cindex Duplicated volumes
288@cindex Replacement volumes
289
290Volume names are defined to be unique across the entire network.  A
291volume name is the pathname to the volume's root as known by the users
292of that volume.  Since this name uniquely identifies the volume
293contents, all volumes can be named and accessed from each host, subject
294to administrative controls.
295
296Volumes may be replicated or duplicated.  Replicated volumes contain
297identical copies of the same data and reside at two or more locations in
298the network.  Each of the replicated volumes can be used
299interchangeably.  Duplicated volumes each have the same name but contain
300different, though functionally identical, data.  For example,
301@samp{/vol/tex} might be the name of a @TeX{} distribution which varied
302for each machine architecture.@refill
303
304@i{Amd} provides facilities to take advantage of both replicated and
305duplicated volumes.  Configuration options allow a single set of
306configuration data to be shared across an entire network by taking
307advantage of replicated and duplicated volumes.
308
309@i{Amd} can take advantage of replacement volumes by mounting them as
310required should an active fileserver become unavailable.
311
312@node     Volume Binding, Operational Principles, Volume Naming, Overview
313@comment  node-name,  next,  previous,  up
314@section Volume Binding
315@cindex Volume binding
316@cindex Unix namespace
317@cindex Namespace
318@cindex Binding names to filesystems
319
320Unix implements a namespace of hierarchically mounted filesystems.  Two
321forms of binding between names and files are provided.  A @dfn{hard
322link} completes the binding when the name is added to the filesystem.  A
323@dfn{soft link} delays the binding until the name is accessed.  An
324@dfn{automounter} adds a further form in which the binding of name to
325filesystem is delayed until the name is accessed.@refill
326
327The target volume, in its general form, is a tuple (host, filesystem,
328sublink) which can be used to name the physical location of any volume
329in the network.
330
331When a target is referenced, @i{Amd} ignores the sublink element and
332determines whether the required filesystem is already mounted.  This is
333done by computing the local mount point for the filesystem and checking
334for an existing filesystem mounted at the same place.  If such a
335filesystem already exists then it is assumed to be functionally
336identical to the target filesystem.  By default there is a one-to-one
337mapping between the pair (host, filesystem) and the local mount point so
338this assumption is valid.
339
340@node     Operational Principles, Mounting a Volume, Volume Binding, Overview
341@comment  node-name,  next,  previous,  up
342@section Operational Principles
343@cindex Operational principles
344
345@i{Amd} operates by introducing new mount points into the namespace.
346These are called @dfn{automount} points.  The kernel sees these
347automount points as NFS filesystems being served by @i{Amd}.  Having
348attached itself to the namespace, @i{Amd} is now able to control the
349view the rest of the system has of those mount points.  RPC calls are
350received from the kernel one at a time.
351
352When a @dfn{lookup} call is received @i{Amd} checks whether the name is
353already known.  If it is not, the required volume is mounted.  A
354symbolic link pointing to the volume root is then returned.  Once the
355symbolic link is returned, the kernel will send all other requests
356direct to the mounted filesystem.
357
358If a volume is not yet mounted, @i{Amd} consults a configuration
359@dfn{mount-map} corresponding to the automount point.  @i{Amd} then
360makes a runtime decision on what and where to mount a filesystem based
361on the information obtained from the map.
362
363@i{Amd} does not implement all the NFS requests; only those relevant
364to name binding such as @dfn{lookup}, @dfn{readlink} and @dfn{readdir}.
365Some other calls are also implemented but most simply return an error
366code; for example @dfn{mkdir} always returns ``read-only filesystem''.
367
368@node     Mounting a Volume, Automatic Unmounting, Operational Principles, Overview
369@comment  node-name,  next,  previous,  up
370@section Mounting a Volume
371@cindex Mounting a volume
372@cindex Location lists
373@cindex Alternate locations
374@cindex Mount retries
375@cindex Background mounts
376
377Each automount point has a corresponding mount map.  The mount map
378contains a list of key--value pairs.  The key is the name of the volume
379to be mounted.  The value is a list of locations describing where the
380filesystem is stored in the network.  In the source for the map the
381value would look like
382
383@display
384location1  location2  @dots{}  locationN
385@end display
386
387@i{Amd} examines each location in turn.  Each location may contain
388@dfn{selectors} which control whether @i{Amd} can use that location.
389For example, the location may be restricted to use by certain hosts.
390Those locations which cannot be used are ignored.
391
392@i{Amd} attempts to mount the filesystem described by each remaining
393location until a mount succeeds or @i{Amd} can no longer proceed.  The
394latter can occur in three ways:
395
396@itemize @bullet
397@item
398If none of the locations could be used, or if all of the locations
399caused an error, then the last error is returned.
400
401@item
402If a location could be used but was being mounted in the background then
403@i{Amd} marks that mount as being ``in progress'' and continues with
404the next request; no reply is sent to the kernel.
405
406@item
407Lastly, one or more of the mounts may have been @dfn{deferred}.  A mount
408is deferred if extra information is required before the mount can
409proceed.  When the information becomes available the mount will take
410place, but in the mean time no reply is sent to the kernel.  If the
411mount is deferred, @i{Amd} continues to try any remaining locations.
412@end itemize
413
414Once a volume has been mounted, @i{Amd} establishes a @dfn{volume
415mapping} which is used to satisfy subsequent requests.@refill
416
417@node     Automatic Unmounting, Keep-alives, Mounting a Volume, Overview
418@comment  node-name,  next,  previous,  up
419@section Automatic Unmounting
420
421To avoid an ever increasing number of filesystem mounts, @i{Amd} removes
422volume mappings which have not been used recently.  A time-to-live
423interval is associated with each mapping and when that expires the
424mapping is removed.  When the last reference to a filesystem is removed,
425that filesystem is unmounted.  If the unmount fails, for example the
426filesystem is still busy, the mapping is re-instated and its
427time-to-live interval is extended.  The global default for this grace
428period is controlled by the ``-w'' command-line option (@pxref{-w
429Option, -w}).  It is also possible to set this value on a per-mount
430basis (@pxref{opts Option, opts, opts}).@refill
431
432Filesystems can be forcefully timed out using the @i{Amq} command.
433@xref{Run-time Administration}.
434
435@node     Keep-alives, Non-blocking Operation, Automatic Unmounting, Overview
436@comment  node-name,  next,  previous,  up
437@section Keep-alives
438@cindex Keep-alives
439@cindex Server crashes
440@cindex NFS ping
441
442Use of some filesystem types requires the presence of a server on
443another machine.  If a machine crashes then it is of no concern to
444processes on that machine that the filesystem is unavailable.  However,
445to processes on a remote host using that machine as a fileserver this
446event is important.  This situation is most widely recognised when an
447NFS server crashes and the behaviour observed on client machines is that
448more and more processes hang.  In order to provide the possibility of
449recovery, @i{Amd} implements a @dfn{keep-alive} interval timer for some
450filesystem types.  Currently only NFS makes use of this service.
451
452The basis of the NFS keep-alive implementation is the observation that
453most sites maintain replicated copies of common system data such as
454manual pages, most or all programs, system source code and so on.  If
455one of those servers goes down it would be reasonable to mount one of
456the others as a replacement.
457
458The first part of the process is to keep track of which fileservers are
459up and which are down.  @i{Amd} does this by sending RPC requests to the
460servers' NFS @code{NullProc} and checking whether a reply is returned.
461While the server state is uncertain the requests are re-transmitted at
462three second intervals and if no reply is received after four attempts
463the server is marked down.  If a reply is received the fileserver is
464marked up and stays in that state for 30 seconds at which time another
465NFS ping is sent.
466
467Once a fileserver is marked down, requests continue to be sent every 30
468seconds in order to determine when the fileserver comes back up.  During
469this time any reference through @i{Amd} to the filesystems on that
470server fail with the error ``Operation would block''.  If a replacement
471volume is available then it will be mounted, otherwise the error is
472returned to the user.
473
474@c @i{Amd} keeps track of which servers are up and which are down.
475@c It does this by sending RPC requests to the servers' NFS {\sc NullProc} and
476@c checking whether a reply is returned.  If no replies are received after a
477@c short period, @i{Amd} marks the fileserver @dfn{down}.
478@c RPC requests continue to be sent so that it will notice when a fileserver
479@c comes back up.
480@c ICMP echo packets \cite{rfc:icmp} are not used because it is the availability
481@c of the NFS service that is important, not the existence of a base kernel.
482@c Whenever a reference to a fileserver which is down is made via @i{Amd}, an alternate
483@c filesystem is mounted if one is available.
484@c
485Although this action does not protect user files, which are unique on
486the network, or processes which do not access files via @i{Amd} or
487already have open files on the hung filesystem, it can prevent most new
488processes from hanging.
489
490By default, fileserver state is not maintained for NFS/TCP mounts.  The
491remote fileserver is always assumed to be up.
492@c
493@c With a suitable combination of filesystem management and mount-maps,
494@c machines can be protected against most server downtime.  This can be
495@c enhanced by allocating boot-servers dynamically which allows a diskless
496@c workstation to be quickly restarted if necessary.  Once the root filesystem
497@c is mounted, @i{Amd} can be started and allowed to mount the remainder of
498@c the filesystem from whichever fileservers are available.
499
500@node     Non-blocking Operation, , Keep-alives, Overview
501@comment  node-name,  next,  previous,  up
502@section Non-blocking Operation
503@cindex Non-blocking operation
504@cindex Multiple-threaded server
505@cindex RPC retries
506
507Since there is only one instance of @i{Amd} for each automount point,
508and usually only one instance on each machine, it is important that it
509is always available to service kernel calls.  @i{Amd} goes to great
510lengths to ensure that it does not block in a system call.  As a last
511resort @i{Amd} will fork before it attempts a system call that may block
512indefinitely, such as mounting an NFS filesystem.  Other tasks such as
513obtaining filehandle information for an NFS filesystem, are done using a
514purpose built non-blocking RPC library which is integrated with
515@i{Amd}'s task scheduler.  This library is also used to implement NFS
516keep-alives (@pxref{Keep-alives}).
517
518Whenever a mount is deferred or backgrounded, @i{Amd} must wait for it
519to complete before replying to the kernel.  However, this would cause
520@i{Amd} to block waiting for a reply to be constructed.  Rather than do
521this, @i{Amd} simply @dfn{drops} the call under the assumption that the
522kernel RPC mechanism will automatically retry the request.
523
524@node     Supported Platforms, Mount Maps, Overview, Top
525@comment  node-name,  next,  previous,  up
526@chapter Supported Platforms
527
528@i{Amd} has been ported to a wide variety of machines and operating systems.
529The table below lists those platforms supported by the current release.
530
531@menu
532* Supported Operating Systems::
533* Supported Machine Architectures::
534@end menu
535
536@node     Supported Operating Systems, Supported Machine Architectures, Supported Platforms, Supported Platforms
537@comment  node-name,  next,  previous,  up
538@section Supported Operating Systems
539@cindex Operating system names
540@cindex Operating systems supported by Amd
541@cindex Supported operating systems
542
543The following operating systems are currently supported by @i{Amd}.
544@i{Amd}'s conventional name for each system is given.
545
546@table @code
547@item acis43
5484.3 BSD for IBM RT.  Contributed by Jan-Simon Pendry @t{<jsp@@doc.ic.ac.uk>}
549@item aix3
550AIX 3.1.  Contributed by Jan-Simon Pendry @t{<jsp@@doc.ic.ac.uk>}
551@item aux
552System V for Mac-II.  Contributed by Julian Onions @t{<jpo@@cs.nott.ac.uk>}
553@item bsd44
5544.4 BSD.  Contributed by Jan-Simon Pendry @t{<jsp@@doc.ic.ac.uk>}
555@item concentrix
556Concentrix 5.0.  Contributed by Sjoerd Mullender @t{<sjoerd@@cwi.nl>}
557@item convex
558Convex OS 7.1.  Contributed by Eitan Mizrotsky @t{<eitan@@shumuji.ac.il>}
559@item dgux
560Data General DG/UX.  Contributed by Mark Davies @t{<mark@@comp.vuw.ac.nz>}
561@item fpx4
562Celerity FPX 4.1/2.  Contributed by Stephen Pope @t{<scp@@grizzly.acl.lanl.gov>}
563@item hcx
564Harris HCX/UX.  Contributed by Chris Metcalf @t{<metcalf@@masala.lcs.mit.edu>}
565@item hlh42
566HLH OTS 1.@i{x} (4.2 BSD).  Contributed by Jan-Simon Pendry @t{<jsp@@doc.ic.ac.uk>}
567@item hpux
568HP-UX 6.@i{x} or 7.0.  Contributed by Jan-Simon Pendry @t{<jsp@@doc.ic.ac.uk>}
569@item irix
570SGI Irix.  Contributed by Scott R. Presnell @t{<srp@@cgl.ucsf.edu>}
571@item next
572Mach for NeXT.  Contributed by Bill Trost @t{<trost%reed@@cse.ogi.edu>}
573@item pyrOSx
574Pyramid OSx.  Contributed by Stefan Petri @t{<petri@@tubsibr.UUCP>}
575@item riscix
576Acorn RISC iX.  Contributed by Piete Brooks @t{<pb@@cam.cl.ac.uk>}
577@item sos3
578SunOS 3.4 & 3.5.  Contributed by Jan-Simon Pendry @t{<jsp@@doc.ic.ac.uk>}
579@item sos4
580SunOS 4.@i{x}.  Contributed by Jan-Simon Pendry @t{<jsp@@doc.ic.ac.uk>}
581@item u2_2
582Ultrix 2.2.  Contributed by Piete Brooks @t{<pb@@cam.cl.ac.uk>}
583@item u3_0
584Ultrix 3.  Contributed by Piete Brooks @t{<pb@@cam.cl.ac.uk>}
585@item u4_0
586Ultrix 4.0.  Contributed by Chris Lindblad @t{<cjl@@ai.mit.edu>}
587@item umax43
588Umax 4.3 BSD.  Contributed by Sjoerd Mullender @t{<sjoerd@@cwi.nl>}
589@item utek
590Utek 4.0.  Contributed by Bill Trost @t{<trost%reed@@cse.ogi.edu>}
591@item xinu43
592mt Xinu MORE/bsd.  Contributed by Jan-Simon Pendry @t{<jsp@@doc.ic.ac.uk>}
593@end table
594
595@node     Supported Machine Architectures, , Supported Operating Systems, Supported Platforms
596@comment  node-name,  next,  previous,  up
597@section Supported Machine Architectures
598@cindex Supported machine architectures
599@cindex Machine architecture names
600@cindex Machine architectures supported by Amd
601
602@table @code
603@item alliant
604Alliant FX/4
605@item arm
606Acorn ARM
607@item aviion
608Data General AViiON
609@item encore
610Encore
611@item fps500
612FPS Model 500
613@item hp9000
614HP 9000/300 family
615@item hp9k8
616HP 9000/800 family
617@item ibm032
618IBM RT
619@item ibm6000
620IBM RISC System/6000
621@item iris4d
622SGI Iris 4D
623@item macII
624Apple Mac II
625@item mips
626MIPS RISC
627@item multimax
628Encore Multimax
629@item orion105
630HLH Orion 1/05
631@item sun3
632Sun-3 family
633@item sun4
634Sun-4 family
635@item tahoe
636Tahoe family
637@item vax
638DEC Vax
639@end table
640
641@node     Mount Maps, Amd Command Line Options, Supported Platforms, Top
642@comment  node-name,  next,  previous,  up
643@chapter Mount Maps
644@cindex Mount maps
645@cindex Automounter configuration maps
646@cindex Mount information
647
648@i{Amd} has no built-in knowledge of machines or filesystems.
649External @dfn{mount-maps} are used to provide the required information.
650Specifically, @i{Amd} needs to know when and under what conditions it
651should mount filesystems.
652
653The map entry corresponding to the requested name contains a list of
654possible locations from which to resolve the request.  Each location
655specifies filesystem type, information required by that filesystem (for
656example the block special device in the case of UFS), and some
657information describing where to mount the filesystem (@pxref{fs Option}).  A
658location may also contain @dfn{selectors} (@pxref{Selectors}).@refill
659
660@menu
661* Map Types::
662* Key Lookup::
663* Location Format::
664@end menu
665
666@node     Map Types, Key Lookup, Mount Maps, Mount Maps
667@comment  node-name,  next,  previous,  up
668@section Map Types
669@cindex Mount map types
670@cindex Map types
671@cindex Configuration map types
672@cindex Types of mount map
673@cindex Types of configuration map
674@cindex Determining the map type
675
676A mount-map provides the run-time configuration information to @i{Amd}.
677Maps can be implemented in many ways.  Some of the forms supported by
678@i{Amd} are regular files, NIS maps the @dfn{Hesiod} name server and
679even the password file.
680
681A mount-map @dfn{name} is a sequence of characters.  When an automount
682point is created a handle on the mount-map is obtained.  For each map
683type configured @i{Amd} attempts to reference the a map of the
684appropriate type.  If a map is found, @i{Amd} notes the type for future
685use and deletes the reference, for example closing any open file
686descriptors.  The available maps are configure when @i{Amd} is built and
687can be displayed by running the command @samp{amd -v}.
688
689By default, @i{Amd} caches data in a mode dependent on the type of map.
690This is the same as specifying @samp{cache:=mapdefault} and selects a
691suitable default cache mode depending on the map type.  The individual
692defaults are described below.  The @var{cache} option can be specified
693on automount points to alter the caching behaviour (@pxref{Automount
694Filesystem}).@refill
695
696The following map types have been implemented, though some are not
697available on all machines.  Run the command @samp{amd -v} to obtain a
698list of map types configured on your machine.
699
700@menu
701* File maps::
702* NIS maps::
703* Hesiod maps::
704* Password maps::
705* Union maps::
706@end menu
707
708@node     File maps, NIS maps, Map Types, Map Types
709@comment  node-name,  next,  previous,  up
710@subsection File maps
711@cindex File maps
712@cindex Flat file maps
713@cindex File map syntactic conventions
714
715When @i{Amd} searches a file for a map entry it does a simple scan of
716the file and supports both comments and continuation lines.
717
718Continuation lines are indicated by a backslash character (@samp{\}) as
719the last character of a line in the file.  The backslash, newline character
720@emph{and any leading white space on the following line} are discarded.  A maximum
721line length of 2047 characters is enforced after continuation lines are read
722but before comments are stripped.  Each line must end with
723a newline character; that is newlines are terminators, not separators.
724The following examples illustrate this:
725
726@example
727key     valA   valB;   \
728          valC
729@end example
730
731specifies @emph{three} locations, and is identical to
732
733@example
734key     valA   valB;   valC
735@end example
736
737However,
738
739@example
740key     valA   valB;\
741          valC
742@end example
743
744specifies only @emph{two} locations, and is identical to
745
746@example
747key     valA   valB;valC
748@end example
749
750After a complete line has been read from the file, including
751continuations, @i{Amd} determines whether there is a comment on the
752line.  A comment begins with a hash (``@samp{#}'') character and
753continues to the end of the line.  There is no way to escape or change
754the comment lead-in character.
755
756Note that continuation lines and comment support @dfn{only} apply to
757file maps.
758
759When caching is enabled, file maps have a default cache mode of
760@code{all} (@pxref{Automount Filesystem}).
761
762@node     NIS maps, Hesiod maps, File maps, Map Types
763@comment  node-name,  next,  previous,  up
764@subsection NIS maps
765@cindex NIS (YP) maps
766
767When using NIS (formerly YP), an @i{Amd} map is implemented directly
768by the underlying NIS map.  Comments and continuation lines are
769@emph{not} supported in the automounter and must be stripped when
770constructing the NIS server's database.
771
772NIS maps do not support cache mode @code{all} and, when caching is
773enabled, have a default cache mode of @code{inc} (@pxref{Automount Filesystem}).
774
775The following rule illustrates what could be added to your NIS @file{Makefile},
776in this case causing the @file{amd.home} map to be rebuilt:
777@example
778$(YPTSDIR)/amd.home.time: $(ETCDIR)/amd.home
779        -@@sed -e "s/#.*$$//" -e "/^$$/d" $(ETCDIR)/amd.home | \
780          awk '@{  \
781                 for (i = 1; i <= NF; i++) \
782                     if (i == NF) @{ \
783                         if (substr($$i, length($$i), 1) == "\\") \
784                             printf("%s", substr($$i, 1, length($$i) - 1)); \
785                         else \
786                             printf("%s\n", $$i); \
787                     @} \
788                     else \
789                         printf("%s ", $$i); \
790             @}' | \
791        $(MAKEDBM) - $(YPDBDIR)/amd.home; \
792        touch $(YPTSDIR)/amd.home.time; \
793        echo "updated amd.home"; \
794        if [ ! $(NOPUSH) ]; then \
795                $(YPPUSH) amd.home; \
796                echo "pushed amd.home"; \
797        else \
798                : ; \
799        fi
800@end example
801
802Here @code{$(YPTSDIR)} contains the time stamp files, and @code{$(YPDBDIR)} contains
803the dbm format NIS files.
804
805@node     Hesiod maps, Password maps, NIS maps, Map Types
806@comment  node-name,  next,  previous,  up
807@subsection Hesiod maps
808@cindex Hesiod maps
809
810When the map name begins with the string @samp{hesiod.} lookups are made
811using the @dfn{Hesiod} name server.  The string following the dot is
812used as a name qualifier and is prepended with the key being located.
813The entire string is then resolved in the @code{automount} context.  For
814example, if the key is @samp{jsp} and map name is
815@samp{hesiod.homes} then @dfn{Hesiod} is asked to resolve
816@samp{jsp.homes.automount}.
817
818Hesiod maps do not support cache mode @samp{all} and, when caching is
819enabled, have a default cache mode of @samp{inc} (@pxref{Automount Filesystem}).
820
821The following is an example of a @dfn{Hesiod} map entry:
822
823@example
824jsp.homes.automount HS TXT "rfs:=/home/charm;rhost:=charm;sublink:=jsp"
825njw.homes.automount HS TXT "rfs:=/home/dylan/dk2;rhost:=dylan;sublink:=njw"
826@end example
827
828@node     Password maps, Union maps, Hesiod maps, Map Types
829@comment  node-name,  next,  previous,  up
830@subsection Password maps
831@cindex Password file maps
832@cindex /etc/passwd maps
833@cindex User maps, automatic generation
834@cindex Automatic generation of user maps
835@cindex Using the password file as a map
836
837The password map support is unlike the four previous map types.  When
838the map name is the string @file{/etc/passwd} @i{Amd} can lookup a user
839name in the password file and re-arrange the home directory field to
840produce a usable map entry.
841
842@i{Amd} assumes the home directory has the format
843`@t{/}@i{anydir}@t{/}@i{dom1}@t{/../}@i{domN}@t{/}@i{login}'.
844@c @footnote{This interpretation is not necessarily exactly what you want.}
845It breaks this string into a map entry where @code{$@{rfs@}} has the
846value `@t{/}@i{anydir}@t{/}@i{domN}', @code{$@{rhost@}} has the value
847`@i{domN}@t{.}@i{...}@t{.}@i{dom1}', and @code{$@{sublink@}} has the
848value @samp{login}.@refill
849
850Thus if the password file entry was
851
852@example
853/home/achilles/jsp
854@end example
855
856the map entry used by @i{Amd} would be
857
858@example
859rfs:=/home/achilles;rhost:=achilles;sublink:=jsp
860@end example
861
862Similarly, if the password file entry was
863
864@example
865/home/cc/sugar/mjh
866@end example
867
868the map entry used by @i{Amd} would be
869
870@example
871rfs:=/home/sugar;rhost:=sugar.cc;sublink:=jsp
872@end example
873
874@node     Union maps, , Password maps, Map Types
875@comment  node-name,  next,  previous,  up
876@subsection Union maps
877@cindex Union file maps
878
879The union map support is provided specifically for use with the union
880filesystem, @pxref{Union Filesystem}.
881
882It is identified by the string @samp{union:} which is followed by a
883colon separated list of directories.  The directories are read in order,
884and the names of all entries are recorded in the map cache.  Later
885directories take precedence over earlier ones.  The union filesystem
886type then uses the map cache to determine the union of the names in all
887the directories.
888
889@c subsection Gdbm
890
891@node     Key Lookup, Location Format, Map Types, Mount Maps
892@comment  node-name,  next,  previous,  up
893@section How keys are looked up
894@cindex Key lookup
895@cindex Map lookup
896@cindex Looking up keys
897@cindex How keys are looked up
898@cindex Wildcards in maps
899
900The key is located in the map whose type was determined when the
901automount point was first created.  In general the key is a pathname
902component.  In some circumstances this may be modified by variable
903expansion (@pxref{Variable Expansion}) and prefixing.  If the automount
904point has a prefix, specified by the @var{pref} option, then that is
905prepended to the search key before the map is searched.
906
907If the map cache is a @samp{regexp} cache then the key is treated as an
908egrep-style regular expression, otherwise a normal string comparison is
909made.
910
911If the key cannot be found then a @dfn{wildcard} match is attempted.
912@i{Amd} repeatedly strips the basename from the key, appends @samp{/*} and
913attempts a lookup.  Finally, @i{Amd} attempts to locate the special key @samp{*}.
914
915@group
916For example, the following sequence would be checked if @file{home/dylan/dk2} was
917being located:
918
919@example
920   home/dylan/dk2
921   home/dylan/*
922   home/*
923   *
924@end example
925@end group
926
927At any point when a wildcard is found, @i{Amd} proceeds as if an exact
928match had been found and the value field is then used to resolve the
929mount request, otherwise an error code is propagated back to the kernel.
930(@pxref{Filesystem Types}).@refill
931
932@node     Location Format, , Key Lookup, Mount Maps
933@comment  node-name,  next,  previous,  up
934@section Location Format
935@cindex Location format
936@cindex Map entry format
937@cindex How locations are parsed
938
939The value field from the lookup provides the information required to
940mount a filesystem.  The information is parsed according to the syntax
941shown below.
942
943@display
944@i{location-list}:
945                  @i{location-selection}
946                  @i{location-list} @i{white-space} @t{||} @i{white-space} @i{location-selection}
947@i{location-selection}:
948                  @i{location}
949                  @i{location-selection} @i{white-space} @i{location}
950@i{location}:
951                  @i{location-info}
952                  @t{-}@i{location-info}
953                  @t{-}
954@i{location-info}:
955                  @i{sel-or-opt}
956                  @i{location-info}@t{;}@i{sel-or-opt}
957                  @t{;}
958@i{sel-or-opt}:
959                  @i{selection}
960                  @i{opt-ass}
961@i{selection}:
962                  selector@t{==}@i{value}
963                  selector@t{!=}@i{value}
964@i{opt-ass}:
965                  option@t{:=}@i{value}
966@i{white-space}:
967                  space
968                  tab
969@end display
970
971Note that unquoted whitespace is not allowed in a location description.
972White space is only allowed, and is mandatory, where shown with non-terminal
973@samp{white-space}.
974
975A @dfn{location-selection} is a list of possible volumes with which to
976satisfy the request.  @dfn{location-selection}s are separated by the
977@samp{||} operator.  The effect of this operator is to prevent use of
978location-selections to its right if any of the location-selections on
979its left were selected whether or not any of them were successfully
980mounted (@pxref{Selectors}).@refill
981
982The location-selection, and singleton @dfn{location-list},
983@samp{type:=ufs;dev:=/dev/xd1g} would inform @i{Amd} to mount a UFS
984filesystem from the block special device @file{/dev/xd1g}.
985
986The @dfn{sel-or-opt} component is either the name of an option required
987by a specific filesystem, or it is the name of a built-in, predefined
988selector such as the architecture type.  The value may be quoted with
989double quotes @samp{"}, for example
990@samp{type:="ufs";dev:="/dev/xd1g"}.  These quotes are stripped when the
991value is parsed and there is no way to get a double quote into a value
992field.  Double quotes are used to get white space into a value field,
993which is needed for the program filesystem (@pxref{Program Filesystem}).@refill
994
995@menu
996* Map Defaults::
997* Variable Expansion::
998* Selectors::
999* Map Options::
1000@end menu
1001
1002@node     Map Defaults, Variable Expansion, Location Format, Location Format
1003@comment  node-name,  next,  previous,  up
1004@subsection Map Defaults
1005@cindex Map defaults
1006@cindex How to set default map parameters
1007@cindex Setting default map parameters
1008
1009A location beginning with a dash @samp{-} is used to specify default
1010values for subsequent locations.  Any previously specified defaults in
1011the location-list are discarded.  The default string can be empty in
1012which case no defaults apply.
1013
1014The location @samp{-fs:=/mnt;opts:=ro} would set the local mount point
1015to @file{/mnt} and cause mounts to be read-only by default.  Defaults
1016specified this way are appended to, and so override, any global map
1017defaults given with @samp{/defaults}).
1018@c
1019@c A @samp{/defaults} value @dfn{gdef} and a location list
1020@c \begin{quote}
1021@c $@samp{-}@dfn{def}_a $\verb*+ +$ @dfn{loc}_{a_1} $\verb*+ +$ @dfn{loc}_{a_2} $\verb*+ +$ @samp{-}@dfn{def}_b $\verb*+ +$ @dfn{loc}_{b_1} \ldots$
1022@c \end{quote}
1023@c is equivalent to
1024@c \begin{quote}
1025@c $@samp{-}@dfn{gdef}@samp{;}@dfn{def}_a $\verb*+ +$ @dfn{loc}_{a_1} $\verb*+ +$ @dfn{loc}_{a_2} $\verb*+ +$ @samp{-}@dfn{gdef}@samp{;}@dfn{def}_b $\verb*+ +$ @dfn{loc}_{b_1} \ldots$
1026@c \end{quote}
1027@c which is equivalent to
1028@c \begin{quote}
1029@c $@dfn{gdef}@samp{;}@dfn{def}_a@samp{;}@dfn{loc}_{a_1} $\verb*+ +$@dfn{gdef}@samp{;}@dfn{def}_a@samp{;}@dfn{loc}_{a_2} $\verb*+ +$@dfn{gdef}@samp{;}@dfn{def}_b@samp{;}@dfn{loc}_{b_1} \ldots$
1030@c \end{quote}
1031
1032@node     Variable Expansion, Selectors, Map Defaults, Location Format
1033@comment  node-name,  next,  previous,  up
1034@subsection Variable Expansion
1035@cindex Variable expansion
1036@cindex How variables are expanded
1037@cindex Pathname operators
1038@cindex Domain stripping
1039@cindex Domainname operators
1040@cindex Stripping the local domain name
1041@cindex Environment variables
1042@cindex How to access environment variables in maps
1043
1044To allow generic location specifications @i{Amd} does variable expansion
1045on each location and also on some of the option strings.  Any option or
1046selector appearing in the form @code{$@dfn{var}} is replaced by the
1047current value of that option or selector.  For example, if the value of
1048@code{$@{key@}} was @samp{bin}, @code{$@{autodir@}} was @samp{/a} and
1049@code{$@{fs@}} was `@t{$@{autodir@}}@t{/local/}@t{$@{key@}}' then
1050after expansion @code{$@{fs@}} would have the value @samp{/a/local/bin}.
1051Any environment variable can be accessed in a similar way.@refill
1052
1053Two pathname operators are available when expanding a variable.  If the
1054variable name begins with @samp{/} then only the last component of
1055then pathname is substituted.  For example, if @code{$@{path@}} was
1056@samp{/foo/bar} then @code{$@{/path@}} would be expanded to @samp{bar}.
1057Similarly, if the variable name ends with @samp{/} then all but the
1058last component of the pathname is substituted.  In the previous example,
1059@code{$@{path/@}} would be expanded to @samp{/foo}.@refill
1060
1061Two domain name operators are also provided.  If the variable name
1062begins with @samp{.} then only the domain part of the name is
1063substituted.  For example, if @code{$@{rhost@}} was
1064@samp{swan.doc.ic.ac.uk} then @code{$@{.rhost@}} would be expanded to
1065@samp{doc.ic.ac.uk}.  Similarly, if the variable name ends with @samp{.}
1066then only the host component is substituted.  In the previous example,
1067@code{$@{rhost.@}} would be expanded to @samp{swan}.@refill
1068
1069Variable expansion is a two phase process.  Before a location is parsed,
1070all references to selectors, @i{eg} @code{$@{path@}}, are expanded.  The
1071location is then parsed, selections are evaluated and option assignments
1072recorded.  If there were no selections or they all succeeded the
1073location is used and the values of the following options are expanded in
1074the order given: @var{sublink}, @var{rfs}, @var{fs}, @var{opts},
1075@var{remopts}, @var{mount} and @var{unmount}.
1076
1077Note that expansion of option values is done after @dfn{all} assignments
1078have been completed and not in a purely left to right order as is done
1079by the shell.  This generally has the desired effect but care must be
1080taken if one of the options references another, in which case the
1081ordering can become significant.
1082
1083There are two special cases concerning variable expansion:
1084
1085@enumerate
1086@item
1087before a map is consulted, any selectors in the name received
1088from the kernel are expanded.  For example, if the request from the
1089kernel was for `@t{$@{arch@}}@t{.bin}' and the machine architecture
1090was @samp{vax}, the value given to @code{$@{key@}} would be
1091@samp{vax.bin}.@refill
1092
1093@item
1094the value of @code{$@{rhost@}} is expanded and normalized before the
1095other options are expanded.  The normalization process strips any local
1096sub-domain components.  For example, if @code{$@{domain@}} was
1097@samp{Berkeley.EDU} and @code{$@{rhost@}} was initially
1098@samp{snow.Berkeley.EDU}, after the normalization it would simply be
1099@samp{snow}.  Hostname normalization is currently done in a
1100@emph{case-dependent} manner.@refill
1101@end enumerate
1102
1103@node     Selectors, Map Options, Variable Expansion, Location Format
1104@comment  node-name,  next,  previous,  up
1105@subsection Selectors
1106@cindex Selectors
1107
1108Selectors are used to control the use of a location.  It is possible to
1109share a mount map between many machines in such a way that filesystem
1110location, architecture and operating system differences are hidden from
1111the users.  A selector of the form @samp{arch==sun3;os==sos4} would only
1112apply on Sun-3s running SunOS 4.x.
1113
1114Selectors are evaluated left to right.  If a selector fails then that
1115location is ignored.  Thus the selectors form a conjunction and the
1116locations form a disjunction.  If all the locations are ignored or
1117otherwise fail then @i{Amd} uses the @dfn{error} filesystem
1118(@pxref{Error Filesystem}).  This is equivalent to having a location
1119@samp{type:=error} at the end of each mount-map entry.@refill
1120
1121The selectors currently implemented are:
1122
1123@table @samp
1124@cindex arch, mount selector
1125@cindex Mount selector; arch
1126@cindex Selector; arch
1127@item arch
1128the machine architecture which was automatically determined at compile
1129time.  The architecture type can be displayed by running the command
1130@samp{amd -v}.  @xref{Supported Machine Architectures}.@refill
1131
1132@item autodir
1133@cindex autodir, mount selector
1134@cindex Mount selector; autodir
1135@cindex Selector; autodir
1136the default directory under which to mount filesystems.  This may be
1137changed by the ``-a'' command line option.  See the @var{fs} option.
1138
1139@item byte
1140@cindex byte, mount selector
1141@cindex Mount selector; byte
1142@cindex Selector; byte
1143the machine's byte ordering.  This is either @samp{little}, indicating
1144little-endian, or @samp{big}, indicating big-endian.  One possible use
1145is to share @samp{rwho} databases (@pxref{rwho servers}).
1146
1147@item cluster
1148@cindex cluster, mount selector
1149@cindex Mount selector; cluster
1150@cindex Selector; cluster
1151is provided as a hook for the name of the local cluster.  This can be
1152used to decide which servers to use for copies of replicated
1153filesystems.  @code{$@{cluster@}} defaults to the value of
1154@code{$@{domain@}} unless a different value is set with the ``-C''
1155command line option.
1156
1157@item domain
1158@cindex domain, mount selector
1159@cindex Mount selector; domain
1160@cindex Selector; domain
1161the local domain name as specified by the ``-d'' command line option.
1162See @samp{host}.
1163
1164@item host
1165@cindex host, mount selector
1166@cindex Mount selector; host
1167@cindex Selector; host
1168the local hostname as determined by @b{gethostname}(2).  If no domain
1169name was specified on the command line and the hostname contains a
1170period @samp{.} then the string before the period is used as the
1171host name, and the string after the period is assigned to
1172@code{$@{domain@}}.  For example, if the hostname is
1173@samp{styx.doc.ic.ac.uk} then @code{host} would be @samp{styx} and
1174@code{domain} would be @samp{doc.ic.ac.uk}.  @code{hostd} would be
1175@samp{styx.doc.ic.ac.uk}.@refill
1176
1177@item hostd
1178@cindex hostd, mount selector
1179@cindex Mount selector; hostd
1180@cindex Selector; hostd
1181is @code{$@{host@}} and @code{$@{domain@}} concatenated with a
1182@samp{.} inserted between them if required.  If @code{$@{domain@}}
1183is an empty string then @code{$@{host@}} and @code{$@{hostd@}} will be
1184identical.
1185
1186@item karch
1187@cindex karch, mount selector
1188@cindex Mount selector; karch
1189@cindex Selector; karch
1190is provided as a hook for the kernel architecture.  This is used on
1191SunOS 4, for example, to distinguish between different @samp{/usr/kvm}
1192volumes.  @code{$@{karch@}} defaults to the value of @code{$@{arch@}}
1193unless a different value is set with the ``-k'' command line option.
1194
1195@item os
1196@cindex os, mount selector
1197@cindex Mount selector; os
1198@cindex Selector; os
1199the operating system.  Like the machine architecture, this is
1200automatically determined at compile time.  The operating system name can
1201be displayed by running the command @samp{amd -v}.  @xref{Supported
1202Operating Systems}.@refill
1203
1204@end table
1205
1206The following selectors are also provided.  Unlike the other selectors,
1207they vary for each lookup.  Note that when the name from the kernel is
1208expanded prior to a map lookup, these selectors are all defined as empty
1209strings.
1210
1211@table @samp
1212@item key
1213@cindex key, mount selector
1214@cindex Mount selector; key
1215@cindex Selector; key
1216the name being resolved.  For example, if @file{/home} is an automount
1217point, then accessing @file{/home/foo} would set @code{$@{key@}} to the
1218string @samp{foo}.  The key is prefixed by the @var{pref} option set in
1219the parent mount point.  The default prefix is an empty string.  If the
1220prefix was @file{blah/} then @code{$@{key@}} would be set to
1221@file{blah/foo}.@refill
1222
1223@item map
1224@cindex map, mount selector
1225@cindex Mount selector; map
1226@cindex Selector; map
1227the name of the mount map being used.
1228
1229@item path
1230@cindex path, mount selector
1231@cindex Mount selector; path
1232@cindex Selector; path
1233the full pathname of the name being resolved.  For example
1234@file{/home/foo} in the example above.
1235
1236@item wire
1237@cindex wire, mount selector
1238@cindex Mount selector; wire
1239@cindex Selector; wire
1240the name of the network to which the primary network interface is
1241attached.  If a symbolic name cannot be found in the hosts
1242database then dotted IP address format is used.  This value is also
1243output by the ``-v'' option.
1244
1245@end table
1246
1247Selectors can be negated by using @samp{!=} instead of @samp{==}.  For
1248example to select a location on all non-Vax machines the selector
1249@samp{arch!=vax} would be used.
1250
1251@node     Map Options,  , Selectors, Location Format
1252@comment  node-name,  next,  previous,  up
1253@subsection Map Options
1254@cindex Map options
1255@cindex Setting map options
1256
1257Options are parsed concurrently with selectors.  The difference is that
1258when an option is seen the string following the @samp{:=} is
1259recorded for later use.  As a minimum the @var{type} option must be
1260specified.  Each filesystem type has other options which must also be
1261specified.  @xref{Filesystem Types}, for details on the filesystem
1262specific options.@refill
1263
1264Superfluous option specifications are ignored and are not reported
1265as errors.
1266
1267The following options apply to more than one filesystem type.
1268
1269@menu
1270* delay Option::
1271* fs Option::
1272* opts Option::
1273* remopts Option::
1274* sublink Option::
1275* type Option::
1276@end menu
1277
1278@node     delay Option, fs Option, Map Options, Map Options
1279@comment  node-name,  next,  previous,  up
1280@subsubsection delay Option
1281@cindex Setting a delay on a mount location
1282@cindex Delaying mounts from specific locations
1283@cindex Primary server
1284@cindex Secondary server
1285@cindex delay, mount option
1286@cindex Mount option; delay
1287
1288The delay, in seconds, before an attempt will be made to mount from the current location.
1289Auxilliary data, such as network address, file handles and so on are computed
1290regardless of this value.
1291
1292A delay can be used to implement the notion of primary and secondary file servers.
1293The secondary servers would have a delay of a few seconds,
1294thus giving the primary servers a chance to respond first.
1295
1296@node     fs Option, opts Option, delay Option, Map Options
1297@comment  node-name,  next,  previous,  up
1298@subsubsection fs Option
1299@cindex Setting the local mount point
1300@cindex Overriding the default mount point
1301@cindex fs, mount option
1302@cindex Mount option; fs
1303
1304The local mount point.  The semantics of this option vary between
1305filesystems.
1306
1307For NFS and UFS filesystems the value of @code{$@{fs@}} is used as the
1308local mount point.  For other filesystem types it has other meanings
1309which are described in the section describing the respective filesystem
1310type.  It is important that this string uniquely identifies the
1311filesystem being mounted.  To satisfy this requirement, it should
1312contain the name of the host on which the filesystem is resident and the
1313pathname of the filesystem on the local or remote host.
1314
1315The reason for requiring the hostname is clear if replicated filesystems
1316are considered.  If a fileserver goes down and a replacement filesystem
1317is mounted then the @dfn{local} mount point @dfn{must} be different from
1318that of the filesystem which is hung.  Some encoding of the filesystem
1319name is required if more than one filesystem is to be mounted from any
1320given host.
1321
1322If the hostname is first in the path then all mounts from a particular
1323host will be gathered below a single directory.  If that server goes
1324down then the hung mount points are less likely to be accidentally
1325referenced, for example when @b{getwd}(3) traverses the namespace to
1326find the pathname of the current directory.
1327
1328The @samp{fs} option defaults to
1329@code{$@{autodir@}/$@{rhost@}$@{rfs@}}.  In addition,
1330@samp{rhost} defaults to the local host name (@code{$@{host@}}) and
1331@samp{rfs} defaults to the value of @code{$@{path@}}, which is the full
1332path of the requested file; @samp{/home/foo} in the example above
1333(@pxref{Selectors}).  @code{$@{autodir@}} defaults to @samp{/a} but may
1334be changed with the ``-a'' command line option.  Sun's automounter
1335defaults to @samp{/tmp_mnt}.  Note that there is no @samp{/} between
1336the @code{$@{rhost@}} and @code{$@{rfs@}} since @code{$@{rfs@}} begins
1337with a @samp{/}.@refill
1338
1339@node     opts Option, remopts Option, fs Option, Map Options
1340@comment  node-name,  next,  previous,  up
1341@subsubsection opts Option
1342@cindex Setting system mount options
1343@cindex Passing parameters to the mount system call
1344@cindex mount system call
1345@cindex mount system call flags
1346@cindex The mount system call
1347@cindex opts, mount option
1348@cindex Mount option; opts
1349
1350The options to pass to the mount system call.  A leading @samp{-} is
1351silently ignored.  The mount options supported generally correspond to
1352those used by @b{mount}(8) and are listed below.  Some additional
1353pseudo-options are interpreted by @i{Amd} and are also listed.
1354
1355Unless specifically overridden, each of the system default mount options
1356applies.  Any options not recognised are ignored.  If no options list is
1357supplied the string @samp{rw,defaults} is used and all the system
1358default mount options apply.  Options which are not applicable for a
1359particular operating system are silently ignored.  For example, only 4.4
1360BSD is known to implement the @code{compress} and @code{spongy} options.
1361
1362@table @code
1363@item compress
1364Use NFS compression protocol.
1365@item grpid
1366Use BSD directory group-id semantics.
1367@item intr
1368Allow keyboard interrupts on hard mounts.
1369@item noconn
1370Don't make a connection on datagram transports.
1371@item nocto
1372No close-to-open consistency.
1373@item nodevs
1374Don't allow local special devices on this filesystem.
1375@item nolooklease
1376When nqnfs is selected, disable the automatic acquiring of leases on
1377lookups.
1378@item nosuid
1379Don't allow set-uid or set-gid executables on this filesystem.
1380@item nqnfs
1381Enable leasing extensions to the NFS protocol know as Not Quite NFS.
1382Only supported by the 4.4BSD NFS implementation.
1383@item quota
1384Enable quota checking on this mount.
1385@item resvport
1386Use a reserved port number (one less than 1024).  Some NFS servers
1387require this.
1388@item retrans=@i{n}
1389The number of NFS retransmits made before a user error is generated by a
1390@samp{soft} mounted filesystem, and before a @samp{hard} mounted
1391filesystem reports @samp{NFS server @dfn{yoyo} not responding still
1392trying}.
1393@item ro
1394Mount this filesystem readonly.
1395@item rsize=@var{n}
1396The NFS read packet size.  You may need to set this if you are using
1397NFS/UDP through a gateway.
1398@item soft
1399Give up after @dfn{retrans} retransmissions.
1400@item spongy
1401Like @samp{soft} for status requests, and @samp{hard} for data transfers.
1402@item tcp
1403Use TCP/IP instead of UDP/IP, ignored if the NFS implementation does not
1404support TCP/IP mounts.
1405@item timeo=@var{n}
1406The NFS timeout, in tenth-seconds, before a request is retransmitted.
1407@item wsize=@var{n}
1408The NFS write packet size.  You may need to set this if you are using
1409NFS/UDP through a gateway.
1410@end table
1411
1412The following options are implemented by @i{Amd}, rather than being
1413passed to the kernel.
1414
1415@table @code
1416@item nounmount
1417Configures the mount so that its time-to-live will
1418never expire.  This is also the default for some filesystem types.
1419@c
1420@c Implementation broken:
1421@item ping=@var{n}
1422The interval, in seconds, between keep-alive pings.  When four
1423consecutive pings have failed the mount point is marked as hung.  This
1424interval defaults to 30 seconds.  If the ping interval is less than zero,
1425no pings are sent and the host is assumed to be always
1426up.  By default, pings are not sent for an NFS/TCP mount.
1427@item retry=@var{n}
1428The number of times to retry the mount system call.
1429@item utimeout=@var{n}
1430The interval, in seconds, by which the mount's
1431time-to-live is extended after an unmount attempt
1432has failed.  In fact the interval is extended before the unmount is
1433attempted to avoid thrashing.  The default value is 120 seconds (two
1434minutes) or as set by the ``-w'' command line option.
1435@end table
1436
1437@node     remopts Option, sublink Option, opts Option, Map Options
1438@comment  node-name,  next,  previous,  up
1439@subsubsection remopts Option
1440@cindex Setting system mount options for non-local networks
1441@cindex remopts, mount option
1442@cindex Mount option; remopts
1443
1444This option has the same use as @code{$@{opts@}} but applies only when
1445the remote host is on a non-local network.  For example, when using NFS
1446across a gateway it is often necessary to use smaller values for the
1447data read and write sizes.  This can simply be done by specifying the
1448small values in @var{remopts}.  When a non-local host is accessed, the
1449smaller sizes will automatically be used.
1450
1451@i{Amd} determines whether a host is local by examining the network
1452interface configuration at startup.  Any interface changes made after
1453@i{Amd} has been started will not be noticed.  The likely effect will
1454be that a host may incorrectly be declared non-local.
1455
1456Unless otherwise set, the value of @code{$@{rem@}} is the same as the
1457value of @code{$@{opts@}}.
1458
1459@node     sublink Option, type Option, remopts Option, Map Options
1460@comment  node-name,  next,  previous,  up
1461@subsubsection sublink Option
1462@cindex Setting the sublink option
1463@cindex sublink, mount option
1464@cindex Mount option; sublink
1465
1466The subdirectory within the mounted filesystem to which the reference
1467should point.  This can be used to prevent duplicate mounts in cases
1468where multiple directories in the same mounted filesystem are used.
1469
1470@node     type Option, , sublink Option, Map Options
1471@comment  node-name,  next,  previous,  up
1472@subsubsection type Option
1473@cindex Setting the filesystem type option
1474@cindex type, mount option
1475@cindex Mount option; type
1476
1477The filesystem type to be used.  @xref{Filesystem Types}, for a full
1478description of each type.@refill
1479
1480@node     Amd Command Line Options, Filesystem Types, Mount Maps, Top
1481@comment  node-name,  next,  previous,  up
1482@chapter @i{Amd} Command Line Options
1483@cindex Command line options, Amd
1484@cindex Amd command line options
1485@cindex Overriding defaults on the command line
1486
1487Many of @i{Amd}'s parameters can be set from the command line.  The
1488command line is also used to specify automount points and maps.
1489
1490The general format of a command line is
1491
1492@example
1493amd [@i{options}] @{ @i{directory} @i{map-name} [-@i{map-options}] @} ...
1494@end example
1495
1496For each directory and map-name given, @i{Amd} establishes an
1497automount point.  The @dfn{map-options} may be any sequence of options
1498or selectors---@pxref{Location Format}.  The @dfn{map-options}
1499apply only to @i{Amd}'s mount point.
1500
1501@samp{type:=toplvl;cache:=mapdefault;fs:=$@{map@}} is the default value for the
1502map options.  Default options for a map are read from a special entry in
1503the map whose key is the string @samp{/defaults}.  When default options
1504are given they are prepended to any options specified in the mount-map
1505locations as explained in.  @xref{Map Defaults}, for more details.
1506
1507The @dfn{options} are any combination of those listed below.
1508
1509Once the command line has been parsed, the automount points are mounted.
1510The mount points are created if they do not already exist, in which case they
1511will be removed when @i{Amd} exits.
1512Finally, @i{Amd} disassociates itself from its controlling terminal and
1513forks into the background.
1514
1515Note: Even if @i{Amd} has been built with @samp{-DDEBUG} it will still
1516background itself and disassociate itself from the controlling terminal.
1517To use a debugger it is necessary to specify @samp{-D nodaemon} on the
1518command line.
1519
1520@menu
1521* -a Option::	Automount directory.
1522* -c Option::	Cache timeout interval.
1523* -d Option::	Domain name.
1524* -k Option::	Kernel architecture.
1525* -l Option::	Log file.
1526* -n Option::	Hostname normalisation.
1527* -p Option::	Output process id.
1528* -r Option::	Restart existing mounts.
1529* -t Option::	Kernel RPC timeout.
1530* -v Option::	Version information.
1531* -w Option::	Wait interval after failed unmount.
1532* -x Option::	Log options.
1533* -y Option::	NIS domain.
1534* -C-Option::	Cluster name.
1535* -D-Option::	Debug flags.
1536@end menu
1537
1538@node     -a Option, -c Option, Amd Command Line Options, Amd Command Line Options
1539@comment  node-name,  next,  previous,  up
1540@section @code{-a} @var{directory}
1541@cindex Automount directory
1542@cindex Setting the default mount directory
1543
1544Specifies the default mount directory.  This option changes the variable
1545@code{$@{autodir@}} which otherwise defaults to @file{/a}.  For example,
1546some sites prefer @file{/amd}.
1547
1548@example
1549amd -a /amd ...
1550@end example
1551
1552@node     -c Option, -d Option, -a Option, Amd Command Line Options
1553@comment  node-name,  next,  previous,  up
1554@section @code{-c} @var{cache-interval}
1555@cindex Cache interval
1556@cindex Interval before a filesystem times out
1557@cindex Setting the interval before a filesystem times out
1558@cindex Changing the interval before a filesystem times out
1559
1560Selects the period, in seconds, for which a name is cached by @i{Amd}.
1561If no reference is made to the volume in this period, @i{Amd} discards
1562the volume name to filesystem mapping.
1563
1564Once the last reference to a filesystem has been removed, @i{Amd}
1565attempts to unmount the filesystem.  If the unmount fails the interval
1566is extended by a further period as specified by the @samp{-w} command
1567line option or by the @samp{utimeout} mount option.
1568
1569The default @dfn{cache-interval} is 300 seconds (five minutes).
1570
1571@node     -d Option, -k Option, -c Option, Amd Command Line Options
1572@comment  node-name,  next,  previous,  up
1573@section @code{-d} @var{domain}
1574@cindex Domain name
1575@cindex Setting the local domain name
1576@cindex Overriding the local domain name
1577
1578Specifies the host's domain.  This sets the internal variable
1579@code{$@{domain@}} and affects the @code{$@{hostd@}} variable.
1580
1581If this option is not specified and the hostname already contains the
1582local domain then that is used, otherwise the default value of
1583@code{$@{domain@}} is @samp{unknown.domain}.
1584
1585For example, if the local domain was @samp{doc.ic.ac.uk}, @i{Amd} could
1586be started as follows:
1587
1588@example
1589amd -d doc.ic.ac.uk ...
1590@end example
1591
1592@node     -k Option, -l Option, -d Option, Amd Command Line Options
1593@comment  node-name,  next,  previous,  up
1594@section @code{-k} @var{kernel-architecture}
1595@cindex Setting the Kernel architecture
1596
1597Specifies the kernel architecture of the system.  This is usually the
1598output of @samp{arch -k} and its only effect is to set the variable
1599@code{$@{karch@}}.  If this option is not given, @code{$@{karch@}} has
1600the same value as @code{$@{arch@}}.
1601
1602This would be used as follows:
1603
1604@example
1605amd -k `arch -k` ...
1606@end example
1607
1608@node     -l Option, -n Option, -k Option, Amd Command Line Options
1609@comment  node-name,  next,  previous,  up
1610@section @code{-l} @var{log-option}
1611@cindex Log filename
1612@cindex Setting the log file
1613@cindex Using syslog to log errors
1614@cindex syslog
1615
1616Selects the form of logging to be made.  Two special @dfn{log-options}
1617are recognised.
1618
1619@enumerate
1620@item
1621If @dfn{log-option} is the string @samp{syslog}, @i{Amd} will use the
1622@b{syslog}(3) mechanism.@refill
1623
1624@item
1625If @dfn{log-option} is the string @samp{/dev/stderr}, @i{Amd} will use
1626standard error, which is also the default target for log messages.  To
1627implement this, @i{Amd} simulates the effect of the @samp{/dev/fd}
1628driver.
1629@end enumerate
1630
1631Any other string is taken as a filename to use for logging.  Log
1632messages are appended to the file if it already exists, otherwise a new
1633file is created.  The file is opened once and then held open, rather
1634than being re-opened for each message.
1635
1636If the @samp{syslog} option is specified but the system does not support
1637syslog or if the named file cannot be opened or created, @i{Amd} will
1638use standard error.  Error messages generated before @i{Amd} has
1639finished parsing the command line are printed on standard error.
1640
1641Using @samp{syslog} is usually best, in which case @i{Amd} would be
1642started as follows:
1643
1644@example
1645amd -l syslog ...
1646@end example
1647
1648@node     -n Option, -p Option, -l Option, Amd Command Line Options
1649@comment  node-name,  next,  previous,  up
1650@section @code{-n}
1651@cindex Hostname normalisation
1652@cindex Aliased hostnames
1653@cindex Resolving aliased hostnames
1654@cindex Normalising hostnames
1655
1656Normalises the remote hostname before using it.  Normalisation is done
1657by replacing the value of @code{$@{rhost@}} with the primary name
1658returned by a hostname lookup.
1659
1660This option should be used if several names are used to refer to a
1661single host in a mount map.
1662
1663@node     -p Option, -r Option, -n Option, Amd Command Line Options
1664@comment  node-name,  next,  previous,  up
1665@section @code{-p}
1666@cindex Process id
1667@cindex Displaying the process id
1668@cindex process id of Amd daemon
1669@cindex pid file, creating with -p option
1670@cindex Creating a pid file
1671
1672Causes @i{Amd}'s process id to be printed on standard output.
1673This can be redirected to a suitable file for use with kill:
1674
1675@example
1676amd -p > /var/run/amd.pid ...
1677@end example
1678
1679This option only has an affect if @i{Amd} is running in daemon mode.
1680If @i{Amd} is started with the @code{-D nodaemon} debug flag, this
1681option is ignored.
1682
1683@node     -r Option, -t Option, -p Option, Amd Command Line Options
1684@comment  node-name,  next,  previous,  up
1685@section @code{-r}
1686@cindex Restarting existing mounts
1687@cindex Picking up existing mounts
1688
1689Tells @i{Amd} to restart existing mounts (@pxref{Inheritance Filesystem}).
1690@c @dfn{This option will be made the default in the next release.}
1691
1692@node     -t Option, -v Option, -r Option, Amd Command Line Options
1693@comment  node-name,  next,  previous,  up
1694@section @code{-t} @var{timeout.retransmit}
1695@cindex Setting Amd's RPC parameters
1696
1697Specifies the RPC @dfn{timeout} and @dfn{retransmit} intervals used by
1698the kernel to communicate to @i{Amd}.  These are used to set the
1699@samp{timeo} and @samp{retrans} mount options.
1700
1701@i{Amd} relies on the kernel RPC retransmit mechanism to trigger mount
1702retries.  The value of this parameter changes the retry interval.  Too
1703long an interval gives poor interactive response, too short an interval
1704causes excessive retries.
1705
1706@node     -v Option, -w Option, -t Option, Amd Command Line Options
1707@comment  node-name,  next,  previous,  up
1708@section @code{-v}
1709@cindex Version information
1710@cindex Discovering version information
1711@cindex How to discover your version of Amd
1712
1713Print version information on standard error and then exit.  The output
1714is of the form:
1715
1716@example
1717amd 5.2.1.11 of 91/03/17 18:04:05 5.3Alpha11 #0: Sun Mar 17 18:07:28 GMT 1991
1718Built by pendry@@vangogh.Berkeley.EDU for a hp300 running bsd44 (big-endian).
1719Map support for: root, passwd, union, file, error.
1720FS: ufs, nfs, nfsx, host, link, program, union, auto, direct, toplvl, error.
1721Primary network is 128.32.130.0.
1722@end example
1723
1724The information includes the version number, release date and name of
1725the release.  The architecture (@pxref{Supported Machine Architectures}),
1726operating system (@pxref{Supported Operating Systems})
1727and byte ordering are also printed as they appear in the @code{$@{os@}},
1728@code{$@{arch@}} and @code{$@{byte@}} variables.@refill
1729
1730@node     -w Option, -x Option, -v Option, Amd Command Line Options
1731@comment  node-name,  next,  previous,  up
1732@section @code{-w} @var{wait-timeout}
1733@cindex Setting the interval between unmount attempts
1734@cindex unmount attempt backoff interval
1735
1736Selects the interval in seconds between unmount attempts after the
1737initial time-to-live has expired.
1738
1739This defaults to 120 seconds (two minutes).
1740
1741@node     -x Option, -y Option, -w Option, Amd Command Line Options
1742@comment  node-name,  next,  previous,  up
1743@section @code{-x} @var{opts}
1744@cindex Log message selection
1745@cindex Selecting specific log messages
1746@cindex How to select log messages
1747@cindex syslog priorities
1748
1749Specifies the type and verbosity of log messages.  @dfn{opts} is
1750a comma separated list selected from the following options:
1751
1752@table @code
1753@item fatal
1754Fatal errors
1755@item error
1756Non-fatal errors
1757@item user
1758Non-fatal user errors
1759@item warn
1760Recoverable errors
1761@item warning
1762Alias for @code{warn}
1763@item info
1764Information messages
1765@item map
1766Mount map usage
1767@item stats
1768Additional statistics
1769@item all
1770All of the above
1771@end table
1772
1773Initially a set of default logging flags is enabled.  This is as if
1774@samp{-x all,nomap,nostats} had been selected.  The command line is
1775parsed and logging is controlled by the ``-x'' option.  The very first
1776set of logging flags is saved and can not be subsequently disabled using
1777@i{Amq}.  This default set of options is useful for general production
1778use.@refill
1779
1780The @samp{info} messages include details of what is mounted and
1781unmounted and when filesystems have timed out.  If you want to have the
1782default set of messages without the @samp{info} messages then you simply
1783need @samp{-x noinfo}.  The messages given by @samp{user} relate to
1784errors in the mount maps, so these are useful when new maps are
1785installed.  The following table lists the syslog priorites used for each
1786of the message types.@refill
1787
1788@table @code
1789@item fatal
1790LOG_CRIT
1791@item error
1792LOG_ERR
1793@item user
1794LOG_WARNING
1795@item warning
1796LOG_WARNING
1797@item info
1798LOG_INFO
1799@item debug
1800LOG_DEBUG
1801@item map
1802LOG_DEBUG
1803@item stats
1804LOG_INFO
1805@end table
1806
1807
1808The options can be prefixed by the string @samp{no} to indicate
1809that this option should be turned off.  For example, to obtain all
1810but @samp{info} messages the option @samp{-x all,noinfo} would be used.
1811
1812If @i{Amd} was built with debugging enabled the @code{debug} option is
1813automatically enabled regardless of the command line options.
1814
1815@node     -y Option, -C-Option, -x Option, Amd Command Line Options
1816@comment  node-name,  next,  previous,  up
1817@section @code{-y} @var{NIS-domain}
1818@cindex NIS (YP) domain name
1819@cindex Overriding the NIS (YP) domain name
1820@cindex Setting the NIS (YP) domain name
1821@cindex YP domain name
1822
1823Selects an alternate NIS domain.  This is useful for debugging and
1824cross-domain shared mounting.  If this flag is specified, @i{Amd}
1825immediately attempts to bind to a server for this domain.
1826@c @i{Amd} refers to NIS maps when it starts, unless the ``-m'' option
1827@c is specified, and whenever required in a mount map.
1828
1829@node     -C-Option, -D-Option, -y Option, Amd Command Line Options
1830@comment  node-name,  next,  previous,  up
1831@section @code{-C} @var{cluster-name}
1832@cindex Cluster names
1833@cindex Setting the cluster name
1834
1835Specifies the name of the cluster of which the local machine is a member.
1836The only effect is to set the variable @code{$@{cluster@}}.
1837The @dfn{cluster-name} is will usually obtained by running another command which uses
1838a database to map the local hostname into a cluster name.
1839@code{$@{cluster@}} can then be used as a selector to restrict mounting of
1840replicated data.
1841If this option is not given, @code{$@{cluster@}} has the same value as @code{$@{domain@}}.
1842This would be used as follows:
1843
1844@example
1845amd -C `clustername` ...
1846@end example
1847
1848@node     -D-Option, , -C-Option, Amd Command Line Options
1849@comment  node-name,  next,  previous,  up
1850@section @code{-D} @var{opts}
1851@cindex Debug options
1852@cindex Setting debug flags
1853
1854Controls the verbosity and coverage of the debugging trace; @dfn{opts}
1855is a comma separated list of debugging options.  The ``-D'' option is
1856only available if @i{Amd} was compiled with @samp{-DDEBUG}.  The memory
1857debugging facilities are only available if @i{Amd} was compiled with
1858@samp{-DDEBUG_MEM} (in addition to @samp{-DDEBUG}).
1859
1860The most common options to use are @samp{-D trace} and @samp{-D test}
1861(which turns on all the useful debug options).  See the program source
1862for a more detailed explanation of the available options.
1863
1864@node     Filesystem Types, Run-time Administration, Amd Command Line Options, Top
1865@comment  node-name,  next,  previous,  up
1866@chapter Filesystem Types
1867@cindex Filesystem types
1868@cindex Mount types
1869@cindex Types of filesystem
1870
1871To mount a volume, @i{Amd} must be told the type of filesystem to be
1872used.  Each filesystem type typically requires additional information
1873such as the fileserver name for NFS.
1874
1875From the point of view of @i{Amd}, a @dfn{filesystem} is anything that
1876can resolve an incoming name lookup.  An important feature is support
1877for multiple filesystem types.  Some of these filesystems are
1878implemented in the local kernel and some on remote fileservers, whilst
1879the others are implemented internally by @i{Amd}.@refill
1880
1881The two common filesystem types are UFS and NFS.  Four other user
1882accessible filesystems (@samp{link}, @samp{program}, @samp{auto} and
1883@samp{direct}) are also implemented internally by @i{Amd} and these are
1884described below.  There are two additional filesystem types internal to
1885@i{Amd} which are not directly accessible to the user (@samp{inherit}
1886and @samp{error}).  Their use is described since they may still have an
1887effect visible to the user.@refill
1888
1889@menu
1890* Network Filesystem::		A single NFS filesystem.
1891* Network Host Filesystem::	NFS mount a host's entire export tree.
1892* Network Filesystem Group::	An atomic group of NFS filesystems.
1893* Unix Filesystem::		Native disk filesystem.
1894* Program Filesystem::		Generic Program mounts.
1895* Symbolic Link Filesystem::	Local link referencing filesystem.
1896* Symbolic Link Filesystem II::	Local link referencing existing filesystem.
1897* Automount Filesystem::
1898* Direct Automount Filesystem::
1899* Union Filesystem::
1900* Error Filesystem::
1901* Top-level Filesystem::
1902* Root Filesystem::
1903* Inheritance Filesystem::
1904@end menu
1905
1906@node     Network Filesystem, Network Host Filesystem, Filesystem Types, Filesystem Types
1907@comment  node-name,  next,  previous,  up
1908@section Network Filesystem (@samp{type:=nfs})
1909@cindex NFS
1910@cindex Mounting an NFS filesystem
1911@cindex How to mount and NFS filesystem
1912@cindex nfs, filesystem type
1913@cindex Filesystem type; nfs
1914
1915The @dfn{nfs} filesystem type provides access to Sun's NFS.
1916
1917@noindent
1918The following options must be specified:
1919
1920@table @code
1921@cindex rhost, mount option
1922@cindex Mount option; rhost
1923@item rhost
1924the remote fileserver.  This must be an entry in the hosts database.  IP
1925addresses are not accepted.  The default value is taken
1926from the local host name (@code{$@{host@}}) if no other value is
1927specified.
1928
1929@cindex rfs, mount option
1930@cindex Mount option; rfs
1931@item rfs
1932the remote filesystem.
1933If no value is specified for this option, an internal default of
1934@code{$@{path@}} is used.
1935@end table
1936
1937NFS mounts require a two stage process.  First, the @dfn{file handle} of
1938the remote file system must be obtained from the server.  Then a mount
1939system call must be done on the local system.  @i{Amd} keeps a cache
1940of file handles for remote file systems.  The cache entries have a
1941lifetime of a few minutes.
1942
1943If a required file handle is not in the cache, @i{Amd} sends a request
1944to the remote server to obtain it.  @i{Amd} @dfn{does not} wait for
1945a response; it notes that one of the locations needs retrying, but
1946continues with any remaining locations.  When the file handle becomes
1947available, and assuming none of the other locations was successfully
1948mounted, @i{Amd} will retry the mount.  This mechanism allows several
1949NFS filesystems to be mounted in parallel.
1950@c @footnote{The mechanism
1951@c is general, however NFS is the only filesystem
1952@c for which the required hooks have been written.}
1953The first one which responds with a valid file handle will be used.
1954
1955@noindent
1956An NFS entry might be:
1957
1958@example
1959jsp  host!=charm;type:=nfs;rhost:=charm;rfs:=/home/charm;sublink:=jsp
1960@end example
1961
1962The mount system call and any unmount attempts are always done
1963in a new task to avoid the possibilty of blocking @i{Amd}.
1964
1965@node     Network Host Filesystem, Network Filesystem Group, Network Filesystem, Filesystem Types
1966@comment  node-name,  next,  previous,  up
1967@section Network Host Filesystem (@samp{type:=host})
1968@cindex Network host filesystem
1969@cindex Mounting entire export trees
1970@cindex How to mount all NFS exported filesystems
1971@cindex host, filesystem type
1972@cindex Filesystem type; host
1973
1974@c NOTE: the current implementation of the @dfn{host} filesystem type
1975@c sometimes fails to maintain a consistent view of the remote mount tree.
1976@c This happens when the mount times out and only some of the remote mounts
1977@c are successfully unmounted.  To prevent this from occurring, use the
1978@c @samp{nounmount} mount option.
1979
1980The @dfn{host} filesystem allows access to the entire export tree of an
1981NFS server.  The implementation is layered above the @samp{nfs}
1982implementation so keep-alives work in the same way.  The only option
1983which needs to specified is @samp{rhost} which is the name of the
1984fileserver to mount.
1985
1986The @samp{host} filesystem type works by querying the mount daemon on
1987the given fileserver to obtain its export list.  @i{Amd} then obtains
1988filehandles for each of the exported filesystems.  Any errors at this
1989stage cause that particular filesystem to be ignored.  Finally each
1990filesystem is mounted.  Again, errors are logged but ignored.  One
1991common reason for mounts to fail is that the mount point does not exist.
1992Although @i{Amd} attempts to automatically create the mount point, it
1993may be on a remote filesystem to which @i{Amd} does not have write
1994permission.
1995
1996When an attempt to unmount a @samp{host} filesystem mount fails, @i{Amd}
1997remounts any filesystems which had successfully been unmounted.  To do
1998this @i{Amd} queries the mount daemon again and obtains a fresh copy of
1999the export list.  @i{Amd} then tries to mount any exported filesystems
2000which are not currently mounted.
2001
2002Sun's automounter provides a special @samp{-hosts} map.  To achieve the
2003same effect with @i{Amd} requires two steps.  First a mount map must
2004be created as follows:
2005
2006@example
2007/defaults  type:=host;fs:=$@{autodir@}/$@{rhost@}/root;rhost:=$@{key@}
2008*          opts:=rw,nosuid,grpid
2009@end example
2010
2011@noindent
2012and then start @i{Amd} with the following command
2013
2014@example
2015amd /n net.map
2016@end example
2017
2018@noindent
2019where @samp{net.map} is the name of map described above.  Note that the
2020value of @code{$@{fs@}} is overridden in the map.  This is done to avoid
2021a clash between the mount tree and any other filesystem already mounted
2022from the same fileserver.
2023
2024If different mount options are needed for different hosts then
2025additional entries can be added to the map, for example
2026
2027@example
2028host2       opts:=ro,nosuid,soft
2029@end example
2030
2031@noindent
2032would soft mount @samp{host2} read-only.
2033
2034@node     Network Filesystem Group, Unix Filesystem, Network Host Filesystem, Filesystem Types
2035@comment  node-name,  next,  previous,  up
2036@section Network Filesystem Group (@samp{type:=nfsx})
2037@cindex Network filesystem group
2038@cindex Atomic NFS mounts
2039@cindex Mounting an atomic group of NFS filesystems
2040@cindex How to mount an atomic group of NFS filesystems
2041@cindex nfsx, filesystem type
2042@cindex Filesystem type; nfsx
2043
2044The @dfn{nfsx} filesystem allows a group of filesystems to be mounted
2045from a single NFS server.  The implementation is layered above the
2046@samp{nfs} implementation so keep-alives work in the same way.
2047
2048The options are the same as for the @samp{nfs} filesystem with one
2049difference.
2050
2051@noindent
2052The following options must be specified:
2053
2054@table @code
2055@item rhost
2056the remote fileserver.  This must be an entry in the hosts database.  IP
2057addresses are not accepted.  The default value is taken from the local
2058host name (@code{$@{host@}}) if no other value is specified.
2059
2060@item rfs
2061as a list of filesystems to mount.  The list is in the form of a comma
2062separated strings.
2063@end table
2064
2065@noindent
2066For example:
2067
2068@example
2069pub      type:=nfsx;rhost:=gould;\
2070		rfs:=/public,/,graphics,usenet;fs:=$@{autodir@}/$@{rhost@}/root
2071@end example
2072
2073The first string defines the root of the tree, and is applied as a
2074prefix to the remaining members of the list which define the individual
2075filesystems.  The first string is @emph{not} used as a filesystem name.
2076A parallel operation is used to determine the local mount points to
2077ensure a consistent layout of a tree of mounts.
2078
2079Here, the @emph{three} filesystems, @samp{/public},
2080@samp{/public/graphics} and @samp{/public/usenet}, would be mounted.@refill
2081
2082A local mount point, @code{$@{fs@}}, @emph{must} be specified.  The
2083default local mount point will not work correctly in the general case.
2084A suggestion is to use @samp{fs:=$@{autodir@}/$@{rhost@}/root}.@refill
2085
2086@node     Unix Filesystem, Program Filesystem, Network Filesystem Group, Filesystem Types
2087@comment  node-name,  next,  previous,  up
2088@section Unix Filesystem (@samp{type:=ufs})
2089@cindex Unix filesystem
2090@cindex UFS
2091@cindex Mounting a UFS filesystem
2092@cindex Mounting a local disk
2093@cindex How to mount a UFS filesystems
2094@cindex How to mount a local disk
2095@cindex Disk filesystems
2096@cindex ufs, filesystem type
2097@cindex Filesystem type; ufs
2098
2099The @dfn{ufs} filesystem type provides access to the system's
2100standard disk filesystem---usually a derivative of the Berkeley Fast Filesystem.
2101
2102@noindent
2103The following option must be specified:
2104
2105@table @code
2106@cindex dev, mount option
2107@cindex Mount option; dev
2108@item dev
2109the block special device to be mounted.
2110@end table
2111
2112A UFS entry might be:
2113
2114@example
2115jsp   host==charm;type:=ufs;dev:=/dev/xd0g;sublink:=jsp
2116@end example
2117
2118@node     Program Filesystem, Symbolic Link Filesystem, Unix Filesystem, Filesystem Types
2119@comment  node-name,  next,  previous,  up
2120@section Program Filesystem (@samp{type:=program})
2121@cindex Program filesystem
2122@cindex Mount a filesystem under program control
2123@cindex program, filesystem type
2124@cindex Filesystem type; program
2125
2126The @dfn{program} filesystem type allows a program to be run whenever a
2127mount or unmount is required.  This allows easy addition of support for
2128other filesystem types, such as MIT's Remote Virtual Disk (RVD)
2129which has a programmatic interface via the commands
2130@samp{rvdmount} and @samp{rvdunmount}.
2131
2132@noindent
2133The following options must be specified:
2134
2135@table @code
2136@cindex mount, mount option
2137@cindex Mount option; mount
2138@item mount
2139the program which will perform the mount.
2140
2141@cindex unmount, mount option
2142@cindex Mount option; unmount
2143@item unmount
2144the program which will perform the unmount.
2145@end table
2146
2147The exit code from these two programs is interpreted as a Unix error
2148code.  As usual, exit code zero indicates success.  To execute the
2149program @i{Amd} splits the string on whitespace to create an array of
2150substrings.  Single quotes @samp{'} can be used to quote whitespace
2151if that is required in an argument.  There is no way to escape or change
2152the quote character.
2153
2154To run the program @samp{rvdmount} with a host name and filesystem as
2155arguments would be specified by @samp{mount:="/etc/rvdmount rvdmount
2156fserver $@{path@}"}.
2157
2158The first element in the array is taken as the pathname of the program
2159to execute.  The other members of the array form the argument vector to
2160be passed to the program, @dfn{including argument zero}.  This means
2161that the split string must have at least two elements.  The program is
2162directly executed by @i{Amd}, not via a shell.  This means that scripts
2163must begin with a @code{#!} interpreter specification.
2164
2165If a filesystem type is to be heavily used, it may be worthwhile adding
2166a new filesystem type into @i{Amd}, but for most uses the program
2167filesystem should suffice.
2168
2169When the program is run, standard input and standard error are inherited
2170from the current values used by @i{Amd}.  Standard output is a
2171duplicate of standard error.  The value specified with the ``-l''
2172command line option has no effect on standard error.
2173
2174@node     Symbolic Link Filesystem, Symbolic Link Filesystem II, Program Filesystem, Filesystem Types
2175@comment  node-name,  next,  previous,  up
2176@section Symbolic Link Filesystem (@samp{type:=link})
2177@cindex Symbolic link filesystem
2178@cindex Referencing part of the local name space
2179@cindex Mounting part of the local name space
2180@cindex How to reference part of the local name space
2181@cindex link, filesystem type
2182@cindex symlink, link filesystem type
2183@cindex Filesystem type; link
2184
2185Each filesystem type creates a symbolic link to point from the volume
2186name to the physical mount point.  The @samp{link} filesystem does the
2187same without any other side effects.  This allows any part of the
2188machines name space to be accessed via @i{Amd}.
2189
2190One common use for the symlink filesystem is @file{/homes} which can be
2191made to contain an entry for each user which points to their
2192(auto-mounted) home directory.  Although this may seem rather expensive,
2193it provides a great deal of administrative flexibility.
2194
2195@noindent
2196The following option must be defined:
2197
2198@table @code
2199@item fs
2200The value of @var{fs} option specifies the destination of the link, as
2201modified by the @var{sublink} option.  If @var{sublink} is non-null, it
2202is appended to @code{$@{fs@}}@code{/} and the resulting string is used
2203as the target.
2204@end table
2205
2206The @samp{link} filesystem can be though of as identical to the
2207@samp{ufs} filesystem but without actually mounting anything.
2208
2209An example entry might be:
2210
2211@example
2212jsp   host==charm;type:=link;fs:=/home/charm;sublink:=jsp
2213@end example
2214which would return a symbolic link pointing to @file{/home/charm/jsp}.
2215
2216@node     Symbolic Link Filesystem II, Automount Filesystem, Symbolic Link Filesystem, Filesystem Types
2217@comment  node-name,  next,  previous,  up
2218@section Symbolic Link Filesystem II (@samp{type:=linkx})
2219@cindex Symbolic link filesystem II
2220@cindex Referencing an existing part of the local name space
2221@cindex Mounting an existing part of the local name space
2222@cindex How to reference an existing part of the local name space
2223@cindex linkx, filesystem type
2224@cindex symlink, linkx filesystem type
2225@cindex Filesystem type; linkx
2226
2227The @samp{linkx} filesystem type is identical to @samp{link} with the
2228exception that the target of the link must exist.  Existence is checked
2229with the @samp{lstat} system call.
2230
2231The @samp{linkx} filesystem type is particularly useful for wildcard map
2232entries.  In this case, a list of possible targets can be give and
2233@i{Amd} will choose the first one which exists on the local machine.
2234
2235@node     Automount Filesystem, Direct Automount Filesystem, Symbolic Link Filesystem II, Filesystem Types
2236@comment  node-name,  next,  previous,  up
2237@section Automount Filesystem (@samp{type:=auto})
2238@cindex Automount filesystem
2239@cindex Map cache types
2240@cindex Setting map cache parameters
2241@cindex How to set map cache parameters
2242@cindex How to start an indirect automount point
2243@cindex auto, filesystem type
2244@cindex Filesystem type; auto
2245@cindex SIGHUP signal
2246@cindex Map cache synchronising
2247@cindex Synchronising the map cache
2248@cindex Map cache options
2249@cindex Regular expressions in maps
2250
2251The @dfn{auto} filesystem type creates a new automount point below an
2252existing automount point.  Top-level automount points appear as system
2253mount points.  An automount mount point can also appear as a
2254sub-directory of an existing automount point.  This allows some
2255additional structure to be added, for example to mimic the mount tree of
2256another machine.
2257
2258The following options may be specified:
2259
2260@table @code
2261@cindex cache, mount option
2262@cindex Mount option; cache
2263@item cache
2264specifies whether the data in this mount-map should be
2265cached.  The default value is @samp{none}, in which case
2266no caching is done in order to conserve memory.
2267However, better performance and reliability can be obtained by caching
2268some or all of a mount-map.
2269
2270If the cache option specifies @samp{all},
2271the entire map is enumerated when the mount point is created.
2272
2273If the cache option specifies @samp{inc}, caching is done incrementally
2274as and when data is required.
2275Some map types do not support cache mode @samp{all}, in which case @samp{inc}
2276is used whenever @samp{all} is requested.
2277
2278Caching can be entirely disabled by using cache mode @samp{none}.
2279
2280If the cache option specifies @samp{regexp} then the entire map will be
2281enumerated and each key will be treated as an egrep-style regular
2282expression.  The order in which a cached map is searched does not
2283correspond to the ordering in the source map so the regular expressions
2284should be mutually exclusive to avoid confusion.
2285
2286Each mount map type has a default cache type, usually @samp{inc}, which
2287can be selected by specifying @samp{mapdefault}.
2288
2289The cache mode for a mount map can only be selected on the command line.
2290Starting @i{Amd} with the command:
2291
2292@example
2293amd /homes hesiod.homes -cache:=inc
2294@end example
2295
2296will cause @samp{/homes} to be automounted using the @dfn{Hesiod} name
2297server with local incremental caching of all successfully resolved names.
2298
2299All cached data is forgotten whenever @i{Amd} receives a @samp{SIGHUP}
2300signal and, if cache @samp{all} mode was selected, the cache will be
2301reloaded.  This can be used to inform @i{Amd} that a map has been
2302updated.  In addition, whenever a cache lookup fails and @i{Amd} needs
2303to examine a map, the map's modify time is examined.  If the cache is
2304out of date with respect to the map then it is flushed as if a
2305@samp{SIGHUP} had been received.
2306
2307An additional option (@samp{sync}) may be specified to force @i{Amd} to
2308check the map's modify time whenever a cached entry is being used.  For
2309example, an incremental, synchronised cache would be created by the
2310following command:
2311
2312@example
2313amd /homes hesiod.homes -cache:=inc,sync
2314@end example
2315
2316@item fs
2317specifies the name of the mount map to use for the new mount point.
2318
2319Arguably this should have been specified with the @code{$@{rfs@}} option but
2320we are now stuck with it due to historical accident.
2321
2322@c %If the string @samp{.} is used then the same map is used;
2323@c %in addition the lookup prefix is set to the name of the mount point followed
2324@c %by a slash @samp{/}.
2325@c %This is the same as specifying @samp{fs:=\$@{map@};pref:=\$@{key@}/}.
2326@c
2327
2328@item pref
2329alters the name that is looked up in the mount map.  If
2330@code{$@{pref@}}, the @dfn{prefix}, is non-null then it is prepended to
2331the name requested by the kernel @dfn{before} the map is searched.
2332@end table
2333
2334The server @samp{dylan.doc.ic.ac.uk} has two user disks:
2335@samp{/dev/dsk/2s0} and @samp{/dev/dsk/5s0}.  These are accessed as
2336@samp{/home/dylan/dk2} and @samp{/home/dylan/dk5} respectively.  Since
2337@samp{/home} is already an automount point, this naming is achieved with
2338the following map entries:@refill
2339
2340@example
2341dylan        type:=auto;fs:=$@{map@};pref:=$@{key@}/
2342dylan/dk2    type:=ufs;dev:=/dev/dsk/2s0
2343dylan/dk5    type:=ufs;dev:=/dev/dsk/5s0
2344@end example
2345
2346@node     Direct Automount Filesystem, Union Filesystem, Automount Filesystem, Filesystem Types
2347@comment  node-name,  next,  previous,  up
2348@section Direct Automount Filesystem (@samp{type:=direct})
2349@cindex Direct automount filesystem
2350@cindex How to start a direct automount point
2351@cindex direct, filesystem type
2352@cindex Filesystem type; direct
2353
2354The @dfn{direct} filesystem is almost identical to the automount
2355filesystem.  Instead of appearing to be a directory of mount points, it
2356appears as a symbolic link to a mounted filesystem.  The mount is done
2357at the time the link is accessed.  @xref{Automount Filesystem}, for a
2358list of required options.
2359
2360Direct automount points are created by specifying the @samp{direct}
2361filesystem type on the command line:
2362
2363@example
2364amd ... /usr/man auto.direct -type:=direct
2365@end example
2366
2367where @samp{auto.direct} would contain an entry such as:
2368
2369@example
2370usr/man    -type:=nfs;rfs:=/usr/man \
2371           rhost:=man-server1  rhost:=man-server2
2372@end example
2373
2374In this example, @samp{man-server1} and @samp{man-server2} are file
2375servers which export copies of the manual pages.  Note that the key
2376which is looked up is the name of the automount point without the
2377leading @samp{/}.
2378
2379@node     Union Filesystem, Error Filesystem, Direct Automount Filesystem, Filesystem Types
2380@comment  node-name,  next,  previous,  up
2381@section Union Filesystem (@samp{type:=union})
2382@cindex Union filesystem
2383@cindex union, filesystem type
2384@cindex Filesystem type; union
2385
2386The @dfn{union} filesystem type allows the contents of several
2387directories to be merged and made visible in a single directory.  This
2388can be used to overcome one of the major limitations of the Unix mount
2389mechanism which only allows complete directories to be mounted.
2390
2391For example, supposing @file{/tmp} and @file{/var/tmp} were to be merged
2392into a new directory called @file{/mtmp}, with files in @file{/var/tmp}
2393taking precedence.  The following command could be used to achieve this
2394effect:
2395
2396@example
2397amd ... /mtmp union:/tmp:/var/tmp -type:=union
2398@end example
2399
2400Currently, the unioned directories must @emph{not} be automounted.  That
2401would cause a deadlock.  This seriously limits the current usefulness of
2402this filesystem type and the problem will be addressed in a future
2403release of @i{Amd}.
2404
2405Files created in the union directory are actually created in the last
2406named directory.  This is done by creating a wildcard entry which points
2407to the correct directory.  The wildcard entry is visible if the union
2408directory is listed, so allowing you to see which directory has
2409priority.
2410
2411The files visible in the union directory are computed at the time
2412@i{Amd} is started, and are not kept uptodate with respect to the
2413underlying directories.  Similarly, if a link is removed, for example
2414with the @samp{rm} command, it will be lost forever.
2415
2416@node     Error Filesystem, Top-level Filesystem, Union Filesystem, Filesystem Types
2417@comment  node-name,  next,  previous,  up
2418@section Error Filesystem (@samp{type:=error})
2419@cindex Error filesystem
2420@cindex error, filesystem type
2421@cindex Filesystem type; error
2422
2423The @dfn{error} filesystem type is used internally as a catch-all in
2424the case where none of the other filesystems was selected, or some other
2425error occurred.
2426Lookups and mounts always fail with ``No such file or directory''.
2427All other operations trivially succeed.
2428
2429The error filesystem is not directly accessible.
2430
2431@node     Top-level Filesystem, Root Filesystem, Error Filesystem, Filesystem Types
2432@comment  node-name,  next,  previous,  up
2433@section Top-level Filesystem (@samp{type:=toplvl})
2434@cindex Top level filesystem
2435@cindex toplvl, filesystem type
2436@cindex Filesystem type; toplvl
2437
2438The @dfn{toplvl} filesystems is derived from the @samp{auto} filesystem
2439and is used to mount the top-level automount nodes.  Requests of this
2440type are automatically generated from the command line arguments.
2441
2442@node     Root Filesystem, Inheritance Filesystem, Top-level Filesystem, Filesystem Types
2443@comment  node-name,  next,  previous,  up
2444@section Root Filesystem
2445@cindex Root filesystem
2446@cindex root, filesystem type
2447@cindex Filesystem type; root
2448
2449The @dfn{root} (@samp{type:=root}) filesystem type acts as an internal
2450placeholder onto which @i{Amd} can pin @samp{toplvl} mounts.  Only one
2451node of this type need ever exist and one is created automatically
2452during startup.  The effect of creating a second root node is undefined.
2453
2454@node     Inheritance Filesystem, , Root Filesystem, Filesystem Types
2455@comment  node-name,  next,  previous,  up
2456@section Inheritance Filesystem
2457@cindex Inheritance filesystem
2458@cindex Nodes generated on a restart
2459@cindex inherit, filesystem type
2460@cindex Filesystem type; inherit
2461
2462The @dfn{inheritance} (@samp{type:=inherit}) filesystem is not directly
2463accessible.  Instead, internal mount nodes of this type are
2464automatically generated when @i{Amd} is started with the ``-r'' option.
2465At this time the system mount table is scanned to locate any filesystems
2466which are already mounted.  If any reference to these filesystems is
2467made through @i{Amd} then instead of attempting to mount it, @i{Amd}
2468simulates the mount and @dfn{inherits} the filesystem.  This allows a
2469new version of @i{Amd} to be installed on a live system simply by
2470killing the old daemon with @code{SIGTERM} and starting the new one.@refill
2471
2472This filesystem type is not generally visible externally, but it is
2473possible that the output from @samp{amq -m} may list @samp{inherit} as
2474the filesystem type.  This happens when an inherit operation cannot
2475be completed for some reason, usually because a fileserver is down.
2476
2477@node     Run-time Administration, Examples, Filesystem Types, Top
2478@comment  node-name,  next,  previous,  up
2479@chapter Run-time Administration
2480@cindex Run-time administration
2481@cindex Amq command
2482
2483@menu
2484* Starting Amd::
2485* Stopping Amd::
2486* Controlling Amd::
2487@end menu
2488
2489@node     Starting Amd, Stopping Amd, Run-time Administration, Run-time Administration
2490@comment  node-name,  next,  previous,  up
2491@section Starting @i{Amd}
2492@cindex Starting Amd
2493@cindex Additions to /etc/rc.local
2494@cindex /etc/rc.local additions
2495@cindex /etc/amd.start
2496
2497@i{Amd} is best started from @samp{/etc/rc.local}:
2498
2499@example
2500if [ -f /etc/amd.start ]; then
2501        sh /etc/amd.start; (echo -n ' amd')      >/dev/console
2502fi
2503@end example
2504
2505@noindent
2506The shell script, @samp{amd.start}, contains:
2507
2508@example
2509#!/bin/sh -
2510PATH=/etc:/bin:/usr/bin:/usr/ucb:$PATH export PATH
2511
2512#
2513# Either name of logfile or "syslog"
2514#
2515LOGFILE=syslog
2516#LOGFILE=/var/log/amd
2517
2518#
2519# Figure out whether domain name is in host name
2520# If the hostname is just the machine name then
2521# pass in the name of the local domain so that the
2522# hostnames in the map are domain stripped correctly.
2523#
2524case `hostname` in
2525*.*) dmn= ;;
2526*) dmn='-d doc.ic.ac.uk'
2527esac
2528
2529#
2530# Zap earlier log file
2531#
2532case "$LOGFILE" in
2533*/*)
2534        mv "$LOGFILE" "$LOGFILE"-
2535        > "$LOGFILE"
2536        ;;
2537syslog)
2538        : nothing
2539        ;;
2540esac
2541
2542cd /usr/sbin
2543#
2544# -r            restart
2545# -d dmn        local domain
2546# -w wait       wait between unmount attempts
2547# -l log        logfile or "syslog"
2548#
2549eval ./amd -r $dmn -w 240 -l "$LOGFILE" \
2550        /homes amd.homes -cache:=inc \
2551        /home amd.home -cache:=inc \
2552        /vol amd.vol -cache:=inc \
2553        /n amd.net -cache:=inc
2554@end example
2555
2556If the list of automount points and maps is contained in a file or NIS map
2557it is easily incorporated onto the command line:
2558
2559@example
2560...
2561eval ./amd -r $dmn -w 240 -l "$LOGFILE" `ypcat -k auto.master`
2562@end example
2563
2564@node     Stopping Amd, Controlling Amd, Starting Amd, Run-time Administration
2565@comment  node-name,  next,  previous,  up
2566@section Stopping @i{Amd}
2567@cindex Stopping Amd
2568@cindex SIGTERM signal
2569@cindex SIGINT signal
2570
2571@i{Amd} stops in response to two signals.
2572
2573@table @samp
2574@item SIGTERM
2575causes the top-level automount points to be unmounted and then @i{Amd}
2576to exit.  Any automounted filesystems are left mounted.  They can be
2577recovered by restarting @i{Amd} with the ``-r'' command line option.@refill
2578
2579@item SIGINT
2580causes @i{Amd} to attempt to unmount any filesystems which it has
2581automounted, in addition to the actions of @samp{SIGTERM}.  This signal
2582is primarly used for debugging.@refill
2583@end table
2584
2585Actions taken for other signals are undefined.
2586
2587@node     Controlling Amd, , Stopping Amd, Run-time Administration
2588@comment  node-name,  next,  previous,  up
2589@section Controlling @i{Amd}
2590@cindex Controlling Amd
2591@cindex Discovering what is going on at run-time
2592@cindex Listing currently mounted filesystems
2593
2594It is sometimes desirable or necessary to exercise external control
2595over some of @i{Amd}'s internal state.  To support this requirement,
2596@i{Amd} implements an RPC interface which is used by the @dfn{Amq} program.
2597A variety of information is available.
2598
2599@i{Amq} generally applies an operation, specified by a single letter option,
2600to a list of mount points.  The default operation is to obtain statistics
2601about each mount point.  This is similar to the output shown above
2602but includes information about the number and type of accesses to each
2603mount point.
2604
2605@menu
2606* Amq default::      Default command behaviour.
2607* Amq -f option::     Flushing the map cache.
2608* Amq -h option::     Controlling a non-local host.
2609* Amq -m option::     Obtaining mount statistics.
2610* Amq -s option::     Obtaining global statistics.
2611* Amq -u option::     Forcing volumes to time out.
2612* Amq -v option::     Version information.
2613* Other Amq options:: Three other special options.
2614@end menu
2615
2616@node     Amq default, Amq -f option, Controlling Amd, Controlling Amd
2617@comment  node-name,  next,  previous,  up
2618@subsection @i{Amq} default information
2619
2620With no arguments, @dfn{Amq} obtains a brief list of all existing
2621mounts created by @i{Amd}.  This is different from the list displayed by
2622@b{df}(1) since the latter only includes system mount points.
2623
2624@noindent
2625The output from this option includes the following information:
2626
2627@itemize @bullet
2628@item
2629the automount point,
2630@item
2631the filesystem type,
2632@item
2633the mount map or mount information,
2634@item
2635the internal, or system mount point.
2636@end itemize
2637
2638@noindent
2639For example:
2640
2641@example
2642/            root   "root"                    sky:(pid75)
2643/homes       toplvl /usr/local/etc/amd.homes  /homes
2644/home        toplvl /usr/local/etc/amd.home   /home
2645/homes/jsp   nfs    charm:/home/charm         /a/charm/home/charm/jsp
2646/homes/phjk  nfs    toytown:/home/toytown     /a/toytown/home/toytown/ai/phjk
2647@end example
2648
2649@noindent
2650If an argument is given then statistics for that volume name will
2651be output.  For example:
2652
2653@example
2654What            Uid   Getattr Lookup RdDir   RdLnk   Statfs Mounted@@
2655/homes          0     1196    512    22      0       30     90/09/14 12:32:55
2656/homes/jsp      0     0       0      0       1180    0      90/10/13 12:56:58
2657@end example
2658
2659@table @code
2660@item What
2661the volume name.
2662
2663@item Uid
2664ignored.
2665
2666@item Getattr
2667the count of NFS @dfn{getattr} requests on this node.  This should only be
2668non-zero for directory nodes.
2669
2670@item Lookup
2671the count of NFS @dfn{lookup} requests on this node.  This should only be
2672non-zero for directory nodes.
2673
2674@item RdDir
2675the count of NFS @dfn{readdir} requests on this node.  This should only
2676be non-zero for directory nodes.
2677
2678@item RdLnk
2679the count of NFS @dfn{readlink} requests on this node.  This should be
2680zero for directory nodes.
2681
2682@item Statfs
2683the could of NFS @dfn{statfs} requests on this node.  This should only
2684be non-zero for top-level automount points.
2685
2686@item Mounted@@
2687the date and time the volume name was first referenced.
2688@end table
2689
2690@node     Amq -f option, Amq -h option, Amq default, Controlling Amd
2691@comment  node-name,  next,  previous,  up
2692@subsection @i{Amq} -f option
2693@cindex Flushing the map cache
2694@cindex Map cache, flushing
2695
2696The ``-f'' option causes @i{Amd} to flush the internal mount map cache.
2697This is useful for Hesiod maps since @i{Amd} will not automatically
2698notice when they have been updated.  The map cache can also be
2699synchronised with the map source by using the @samp{sync} option
2700(@pxref{Automount Filesystem}).@refill
2701
2702@node     Amq -h option, Amq -m option, Amq -f option, Controlling Amd
2703@comment  node-name,  next,  previous,  up
2704@subsection @i{Amq} -h option
2705@cindex Querying an alternate host
2706
2707By default the local host is used.  In an HP-UX cluster the root server
2708is used since that is the only place in the cluster where @i{Amd} will
2709be running.  To query @i{Amd} on another host the ``-h'' option should
2710be used.
2711
2712@node     Amq -m option, Amq -s option, Amq -h option, Controlling Amd
2713@comment  node-name,  next,  previous,  up
2714@subsection @i{Amq} -m option
2715
2716The ``-m'' option displays similar information about mounted
2717filesystems, rather than automount points.  The output includes the
2718following information:
2719
2720@itemize @bullet
2721@item
2722the mount information,
2723@item
2724the mount point,
2725@item
2726the filesystem type,
2727@item
2728the number of references to this filesystem,
2729@item
2730the server hostname,
2731@item
2732the state of the file server,
2733@item
2734any error which has occured.
2735@end itemize
2736
2737For example:
2738
2739@example
2740"root"           truth:(pid602)     root   1 localhost is up
2741hesiod.home      /home              toplvl 1 localhost is up
2742hesiod.vol       /vol               toplvl 1 localhost is up
2743hesiod.homes     /homes             toplvl 1 localhost is up
2744amy:/home/amy    /a/amy/home/amy    nfs    5 amy is up
2745swan:/home/swan  /a/swan/home/swan  nfs    0 swan is up (Permission denied)
2746ex:/home/ex      /a/ex/home/ex      nfs    0 ex is down
2747@end example
2748
2749When the reference count is zero the filesystem is not mounted but
2750the mount point and server information is still being maintained
2751by @i{Amd}.
2752
2753@node     Amq -s option, Amq -u option, Amq -m option, Controlling Amd
2754@comment  node-name,  next,  previous,  up
2755@subsection @i{Amq} -s option
2756@cindex Global statistics
2757@cindex Statistics
2758
2759The ``-s'' option displays global statistics.  If any other options are specified
2760or any filesystems named then this option is ignored.  For example:
2761
2762@example
2763requests  stale     mount     mount     unmount
2764deferred  fhandles  ok        failed    failed
27651054      1         487       290       7017
2766@end example
2767
2768@table @samp
2769@item Deferred requests
2770are those for which an immediate reply could not be constructed.  For
2771example, this would happen if a background mount was required.
2772
2773@item Stale filehandles
2774counts the number of times the kernel passes a stale filehandle to @i{Amd}.
2775Large numbers indicate problems.
2776
2777@item Mount ok
2778counts the number of automounts which were successful.
2779
2780@item Mount failed
2781counts the number of automounts which failed.
2782
2783@item Unmount failed
2784counts the number of times a filesystem could not be unmounted.  Very
2785large numbers here indicate that the time between unmount attempts
2786should be increased.
2787@end table
2788
2789@node     Amq -u option, Amq -v option, Amq -s option, Controlling Amd
2790@comment  node-name,  next,  previous,  up
2791@subsection @i{Amq} -u option
2792@cindex Forcing filesystem to time out
2793@cindex Unmounting a filesystem
2794
2795The ``-u'' option causes the time-to-live interval of the named mount
2796points to be expired, thus causing an unmount attempt.  This is the only
2797safe way to unmount an automounted filesystem.  It is not possible to
2798unmount a filesystem which has been mounted with the @samp{nounmount}
2799flag.
2800
2801@c The ``-H'' option informs @i{Amd} that the specified mount point has hung -
2802@c as if its keepalive timer had expired.
2803
2804@node     Amq -v option, Other Amq options, Amq -u option, Controlling Amd
2805@comment  node-name,  next,  previous,  up
2806@subsection @i{Amq} -v option
2807@cindex Version information at run-time
2808
2809The ``-v'' option displays the version of @i{Amd} in a similar way to
2810@i{Amd}'s ``-v'' option.
2811
2812@node     Other Amq options, , Amq -v option, Controlling Amd
2813@comment  node-name,  next,  previous,  up
2814@subsection Other @i{Amq} options
2815
2816Three other operations are implemented.  These modify the state of
2817@i{Amd} as a whole, rather than any particular filesystem.  The ``-l'',
2818``-x'' and ``-D'' options have exactly the same effect as @i{Amd}'s
2819corresponding command line options.  The ``-l'' option is rejected by
2820@i{Amd} in the current version for obvious security reasons.  When
2821@i{Amd} receives a ``-x''flag it limits the log options being modified
2822to those which were not enabled at startup.  This prevents a user
2823turning @emph{off} any logging option which was specified at startup,
2824though any which have been turned off since then can still be turned
2825off.  The ``-D'' option has a similar behaviour.
2826
2827@node     Examples, Internals, Run-time Administration, Top
2828@comment  node-name,  next,  previous,  up
2829@chapter Examples
2830
2831@menu
2832* User Filesystems::
2833* Home Directories::
2834* Architecture Sharing::
2835* Wildcard Names::
2836* rwho servers::
2837* /vol::
2838@end menu
2839
2840@node     User Filesystems, Home Directories, Examples, Examples
2841@comment  node-name,  next,  previous,  up
2842@section User Filesystems
2843@cindex User filesystems
2844@cindex Mounting user filesystems
2845
2846With more than one fileserver, the directories most frequently
2847cross-mounted are those containing user home directories.  A common
2848convention used at Imperial College is to mount the user disks under
2849@t{/home/}@i{machine}.
2850
2851Typically, the @samp{/etc/fstab} file contained a long list of entries
2852such as:
2853
2854@example
2855@i{machine}:/home/@i{machine} /home/@i{machine} nfs ...
2856@end example
2857
2858for each fileserver on the network.
2859
2860There are numerous problems with this system.  The mount list can become
2861quite large and some of the machines may be down when a system is
2862booted.  When a new fileserver is installed, @samp{/etc/fstab} must be
2863updated on every machine, the mount directory created and the filesystem
2864mounted.
2865
2866In many environments most people use the same few workstations, but
2867it is convenient to go to a colleague's machine and access your own
2868files.  When a server goes down, it can cause a process on a client
2869machine to hang.  By minimising the mounted filesystems to only include
2870those actively being used, there is less chance that a filesystem will
2871be mounted when a server goes down.
2872
2873The following is a short extract from a map taken from a research fileserver
2874at Imperial College.
2875
2876Note the entry for @samp{localhost} which is used for users such as
2877the operator (@samp{opr}) who have a home directory on most machine as
2878@samp{/home/localhost/opr}.
2879
2880@example
2881/defaults       opts:=rw,intr,grpid,nosuid
2882charm           host!=$@{key@};type:=nfs;rhost:=$@{key@};rfs:=/home/$@{key@} \
2883                host==$@{key@};type:=ufs;dev:=/dev/xd0g
2884#
2885...
2886
2887#
2888localhost       type:=link;fs:=$@{host@}
2889...
2890#
2891# dylan has two user disks so have a
2892# top directory in which to mount them.
2893#
2894dylan           type:=auto;fs:=$@{map@};pref:=$@{key@}/
2895#
2896dylan/dk2       host!=dylan;type:=nfs;rhost:=dylan;rfs:=/home/$@{key@} \
2897                host==dylan;type:=ufs;dev:=/dev/dsk/2s0
2898#
2899dylan/dk5       host!=dylan;type:=nfs;rhost:=dylan;rfs:=/home/$@{key@} \
2900                host==dylan;type:=ufs;dev:=/dev/dsk/5s0
2901...
2902#
2903toytown         host!=$@{key@};type:=nfs;rhost:=$@{key@};rfs:=/home/$@{key@} \
2904                host==$@{key@};type:=ufs;dev:=/dev/xy1g
2905...
2906#
2907zebedee         host!=$@{key@};type:=nfs;rhost:=$@{key@};rfs:=/home/$@{key@} \
2908                host==$@{key@};type:=ufs;dev:=/dev/dsk/1s0
2909#
2910# Just for access...
2911#
2912gould           type:=auto;fs:=$@{map@};pref:=$@{key@}/
2913gould/staff     host!=gould;type:=nfs;rhost:=gould;rfs:=/home/$@{key@}
2914#
2915gummo           host!=$@{key@};type:=nfs;rhost:=$@{key@};rfs:=/home/$@{key@}
2916...
2917@end example
2918
2919This map is shared by most of the machines listed so on those
2920systems any of the user disks is accessible via a consistent name.
2921@i{Amd} is started with the following command
2922
2923@example
2924amd /home amd.home
2925@end example
2926
2927Note that when mounting a remote filesystem, the @dfn{automounted}
2928mount point is referenced, so that the filesystem will be mounted if
2929it is not yet (at the time the remote @samp{mountd} obtains the file handle).
2930
2931@node     Home Directories, Architecture Sharing, User Filesystems, Examples
2932@comment  node-name,  next,  previous,  up
2933@section Home Directories
2934@cindex Home directories
2935@cindex Example of mounting home directories
2936@cindex Mount home directories
2937
2938One convention for home directories is to locate them in @samp{/homes}
2939so user @samp{jsp}'s home directory is @samp{/homes/jsp}.  With more
2940than a single fileserver it is convenient to spread user files across
2941several machines.  All that is required is a mount-map which converts
2942login names to an automounted directory.
2943
2944Such a map might be started by the command:
2945
2946@example
2947amd /homes amd.homes
2948@end example
2949
2950where the map @samp{amd.homes} contained the entries:
2951
2952@example
2953/defaults   type:=link   # All the entries are of type:=link
2954jsp         fs:=/home/charm/jsp
2955njw         fs:=/home/dylan/dk5/njw
2956...
2957phjk        fs:=/home/toytown/ai/phjk
2958sjv         fs:=/home/ganymede/sjv
2959@end example
2960
2961Whenever a login name is accessed in @samp{/homes} a symbolic link
2962appears pointing to the real location of that user's home directory.  In
2963this example, @samp{/homes/jsp} would appear to be a symbolic link
2964pointing to @samp{/home/charm/jsp}.  Of course, @samp{/home} would also
2965be an automount point.
2966
2967This system causes an extra level of symbolic links to be used.
2968Although that turns out to be relatively inexpensive, an alternative is
2969to directly mount the required filesystems in the @samp{/homes}
2970map.  The required map is simple, but long, and its creation is best automated.
2971The entry for @samp{jsp} could be:
2972
2973@example
2974jsp   -sublink:=$@{key@};rfs:=/home/charm \
2975               host==charm;type:=ufs;dev:=/dev/xd0g \
2976               host!=charm;type:=nfs;rhost:=charm
2977@end example
2978
2979This map can become quite big if it contains a large number of entries.
2980By combining two other features of @i{Amd} it can be greatly simplified.
2981
2982First the UFS partitions should be mounted under the control of
2983@samp{/etc/fstab}, taking care that they are mounted in the same place
2984that @i{Amd} would have automounted them.  In most cases this would be
2985something like @samp{/a/@dfn{host}/home/@dfn{host}} and
2986@samp{/etc/fstab} on host @samp{charm} would have a line:@refill
2987
2988@example
2989/dev/xy0g /a/charm/home/charm 4.2 rw,nosuid,grpid 1 5
2990@end example
2991
2992The map can then be changed to:
2993
2994@example
2995/defaults    type:=nfs;sublink:=$@{key@};opts:=rw,intr,nosuid,grpid
2996jsp          rhost:=charm;rfs:=/home/charm
2997njw          rhost:=dylan;rfs:=/home/dylan/dk5
2998...
2999phjk         rhost:=toytown;rfs:=/home/toytown;sublink:=ai/$@{key@}
3000sjv          rhost:=ganymede;rfs:=/home/ganymede
3001@end example
3002
3003This map operates as usual on a remote machine (@i{ie} @code{$@{host@}}
3004not equal to @code{$@{rhost@}}).  On the machine where the filesystem is
3005stored (@i{ie} @code{$@{host@}} equal to @code{$@{rhost@}}), @i{Amd}
3006will construct a local filesystem mount point which corresponds to the
3007name of the locally mounted UFS partition.  If @i{Amd} is started with
3008the ``-r'' option then instead of attempting an NFS mount, @i{Amd} will
3009simply inherit the UFS mount (@pxref{Inheritance Filesystem}).  If
3010``-r'' is not used then a loopback NFS mount will be made.  This type of
3011mount is known to cause a deadlock on many systems.
3012
3013@node     Architecture Sharing, Wildcard Names, Home Directories, Examples
3014@comment  node-name,  next,  previous,  up
3015@section Architecture Sharing
3016@cindex Architecture sharing
3017@cindex Sharing a fileserver between architectures
3018@cindex Architecture dependent volumes
3019
3020@c %At the moment some of the research machines have sets of software
3021@c %mounted in @samp{/vol}.  This contains subdirectories for \TeX,
3022@c %system sources, local sources, prolog libraries and so on.
3023Often a filesystem will be shared by machines of different architectures.
3024Separate trees can be maintained for the executable images for each
3025architecture, but it may be more convenient to have a shared tree,
3026with distinct subdirectories.
3027
3028A shared tree might have the following structure on the fileserver (called
3029@samp{fserver} in the example):
3030
3031@example
3032local/tex
3033local/tex/fonts
3034local/tex/lib
3035local/tex/bin
3036local/tex/bin/sun3
3037local/tex/bin/sun4
3038local/tex/bin/hp9000
3039...
3040@end example
3041
3042In this example, the subdirectories of @samp{local/tex/bin} should be
3043hidden when accessed via the automount point (conventionally @samp{/vol}).
3044A mount-map for @samp{/vol} to achieve this would look like:
3045
3046@example
3047/defaults   sublink:=$@{/key@};rhost:=fserver;type:=link
3048tex         type:=auto;fs:=$@{map@};pref:=$@{key@}/
3049tex/fonts   host!=fserver;type:=nfs;rfs:=/vol/tex \
3050            host==fserver;fs:=/usr/local/tex
3051tex/lib     host!=fserver;type:=nfs;rfs:=/vol/tex \
3052            host==fserver;fs:=/usr/local/tex
3053tex/bin     -sublink:=$@{/key@}/$@{arch@} host!=fserver;type:=nfs;rfs:=/vol/tex \
3054            host:=fserver;fs:=/usr/local/tex
3055@end example
3056
3057When @samp{/vol/tex/bin} is referenced, the current machine architecture
3058is automatically appended to the path by the @code{$@{sublink@}}
3059variable.  This means that users can have @samp{/vol/tex/bin} in their
3060@samp{PATH} without concern for architecture dependencies.
3061
3062@node     Wildcard Names, rwho servers, Architecture Sharing, Examples
3063@comment  node-name,  next,  previous,  up
3064@section Wildcard names & Replicated Servers
3065
3066By using the wildcard facility, @i{Amd} can @dfn{overlay} an existing
3067directory with additional entries.
3068The system files are usually mounted under @samp{/usr}.  If instead
3069@i{Amd} is mounted on @samp{/usr}, additional
3070names can be overlayed to augment or replace names in the ``master'' @samp{/usr}.
3071A map to do this would have the form:
3072
3073@example
3074local  type:=auto;fs:=local-map
3075share  type:=auto;fs:=share-map
3076*      -type:=nfs;rfs:=/export/exec/$@{arch@};sublink:="$@{key@}" \
3077        rhost:=fserv1  rhost:=fserv2  rhost:=fserv3
3078@end example
3079
3080Note that the assignment to @code{$@{sublink@}} is surrounded by double
3081quotes to prevent the incoming key from causing the map to be
3082misinterpreted.  This map has the effect of directing any access to
3083@samp{/usr/local} or @samp{/usr/share} to another automount point.
3084
3085In this example, it is assumed that the @samp{/usr} files are replicated
3086on three fileservers: @samp{fserv1}, @samp{fserv2} and @samp{fserv3}.
3087For any references other than to @samp{local} and @samp{share} one of
3088the servers is used and a symbolic link to
3089@t{$@{autodir@}/$@{rhost@}/export/exec/$@{arch@}/@i{whatever}} is
3090returned once an appropriate filesystem has been mounted.@refill
3091
3092@node     rwho servers, /vol, Wildcard Names, Examples
3093@comment  node-name,  next,  previous,  up
3094@section @samp{rwho} servers
3095@cindex rwho servers
3096@cindex Architecture specific mounts
3097@cindex Example of architecture specific mounts
3098
3099The @samp{/usr/spool/rwho} directory is a good candidate for automounting.
3100For efficiency reasons it is best to capture the rwho data on a small
3101number of machines and then mount that information onto a large number
3102of clients.  The data written into the rwho files is byte order dependent
3103so only servers with the correct byte ordering can be used by a client:
3104
3105@example
3106/defaults         type:=nfs
3107usr/spool/rwho    -byte==little;rfs:=/usr/spool/rwho \
3108                      rhost:=vaxA  rhost:=vaxB \
3109                  || -rfs:=/usr/spool/rwho \
3110                      rhost:=sun4  rhost:=hp300
3111@end example
3112
3113@node     /vol, , rwho servers, Examples
3114@comment  node-name,  next,  previous,  up
3115@section @samp{/vol}
3116@cindex /vol
3117@cindex Catch-all mount point
3118@cindex Generic volume name
3119
3120@samp{/vol} is used as a catch-all for volumes which do not have other
3121conventional names.
3122
3123Below is part of the @samp{/vol} map for the domain @samp{doc.ic.ac.uk}.
3124The @samp{r+d} tree is used for new or experimental software that needs
3125to be available everywhere without installing it on all the fileservers.
3126Users wishing to try out the new software then simply include
3127@samp{/vol/r+d/@{bin,ucb@}} in their path.@refill
3128
3129The main tree resides on one host @samp{gould.doc.ic.ac.uk}, which has
3130different @samp{bin}, @samp{etc}, @samp{lib} and @samp{ucb}
3131sub-directories for each machine architecture.  For example,
3132@samp{/vol/r+d/bin} for a Sun-4 would be stored in the sub-directory
3133@samp{bin/sun4} of the filesystem @samp{/usr/r+d}.  When it was accessed
3134a symbolic link pointing to @samp{/a/gould/usr/r+d/bin/sun4} would be
3135returned.@refill
3136
3137@example
3138/defaults    type:=nfs;opts:=rw,grpid,nosuid,intr,soft
3139wp           -opts:=rw,grpid,nosuid;rhost:=charm \
3140             host==charm;type:=link;fs:=/usr/local/wp \
3141             host!=charm;type:=nfs;rfs:=/vol/wp
3142...
3143#
3144src          -opts:=rw,grpid,nosuid;rhost:=charm \
3145             host==charm;type:=link;fs:=/usr/src \
3146             host!=charm;type:=nfs;rfs:=/vol/src
3147#
3148r+d          type:=auto;fs:=$@{map@};pref:=r+d/
3149# per architecture bin,etc,lib&ucb...
3150r+d/bin      rhost:=gould.doc.ic.ac.uk;rfs:=/usr/r+d;sublink:=$@{/key@}/$@{arch@}
3151r+d/etc      rhost:=gould.doc.ic.ac.uk;rfs:=/usr/r+d;sublink:=$@{/key@}/$@{arch@}
3152r+d/include  rhost:=gould.doc.ic.ac.uk;rfs:=/usr/r+d;sublink:=$@{/key@}
3153r+d/lib      rhost:=gould.doc.ic.ac.uk;rfs:=/usr/r+d;sublink:=$@{/key@}/$@{arch@}
3154r+d/man      rhost:=gould.doc.ic.ac.uk;rfs:=/usr/r+d;sublink:=$@{/key@}
3155r+d/src      rhost:=gould.doc.ic.ac.uk;rfs:=/usr/r+d;sublink:=$@{/key@}
3156r+d/ucb      rhost:=gould.doc.ic.ac.uk;rfs:=/usr/r+d;sublink:=$@{/key@}/$@{arch@}
3157# hades pictures
3158pictures     -opts:=rw,grpid,nosuid;rhost:=thpfs \
3159             host==thpfs;type:=link;fs:=/nbsd/pictures \
3160             host!=thpfs;type:=nfs;rfs:=/nbsd;sublink:=pictures
3161# hades tools
3162hades        -opts:=rw,grpid,nosuid;rhost:=thpfs \
3163             host==thpfs;type:=link;fs:=/nbsd/hades \
3164             host!=thpfs;type:=nfs;rfs:=/nbsd;sublink:=hades
3165# bsd tools for hp.
3166bsd          -opts:=rw,grpid,nosuid;arch==hp9000;rhost:=thpfs \
3167             host==thpfs;type:=link;fs:=/nbsd/bsd \
3168             host!=thpfs;type:=nfs;rfs:=/nbsd;sublink:=bsd
3169@end example
3170
3171@node     Internals, Acknowledgements & Trademarks, Examples, Top
3172@comment  node-name,  next,  previous,  up
3173@chapter Internals
3174
3175@menu
3176* Log Messages::
3177@end menu
3178
3179@node     Log Messages, , Internals, Internals
3180@comment  node-name,  next,  previous,  up
3181@section Log Messages
3182
3183In the following sections a brief explanation is given of some of the
3184log messages made by @i{Amd}.  Where the message is in @samp{typewriter}
3185font, it corresponds exactly to the message produced by @i{Amd}.  Words
3186in @dfn{italic} are replaced by an appropriate string.  Variables,
3187@code{$@{var@}}, indicate that the value of the appropriate variable is
3188output.
3189
3190Log messages are either sent direct to a file,
3191or logged via the @b{syslog}(3) mechanism.
3192Messages are logged with facility @samp{LOG_DAEMON} when using @b{syslog}(3).
3193In either case, entries in the file are of the form:
3194@example
3195@i{date-string}  @i{hostname} @t{amd[}@i{pid}@t{]}  @i{message}
3196@end example
3197
3198@menu
3199* Fatal errors::
3200* Info messages::
3201@end menu
3202
3203@node     Fatal errors, Info messages, Log Messages, Log Messages
3204@comment  node-name,  next,  previous,  up
3205@subsection Fatal errors
3206
3207@i{Amd} attempts to deal with unusual events.  Whenever it is not
3208possible to deal with such an error, @i{Amd} will log an appropriate
3209message and, if it cannot possibly continue, will either exit or abort.
3210These messages are selected by @samp{-x fatal} on the command line.
3211When @b{syslog}(3) is being used, they are logged with level
3212@samp{LOG_FATAL}.  Even if @i{Amd} continues to operate it is likely to
3213remain in a precarious state and should be restarted at the earliest
3214opportunity.
3215
3216@table @asis
3217@item @t{Attempting to inherit not-a-filesystem}
3218The prototype mount point created during a filesystem restart did not
3219contain a reference to the restarted filesystem.  This erorr ``should
3220never happen''.
3221
3222@item @t{Can't bind to domain "@i{NIS-domain}"}
3223A specific NIS domain was requested on the command line, but no server
3224for that domain is available on the local net.
3225
3226@item @t{Can't determine IP address of this host (@i{hostname})}
3227When @i{Amd} starts it determines its own IP address.  If this lookup
3228fails then @i{Amd} cannot continue.  The hostname it looks up is that
3229obtained returned by @b{gethostname}(2) system call.
3230
3231@item @t{Can't find root file handle for @i{automount point}}
3232@i{Amd} creates its own file handles for the automount points.  When it
3233mounts itself as a server, it must pass these file handles to the local
3234kernel.  If the filehandle is not obtainable the mount point is ignored.
3235This error ``should never happen''.
3236
3237@item @t{Must be root to mount filesystems (euid = @i{euid})}
3238To prevent embarrassment, @i{Amd} makes sure it has appropriate system
3239privileges.  This amounts to having an euid of 0.  The check is made
3240after argument processing complete to give non-root users a chance to
3241access the ``-v'' option.
3242
3243@item @t{No work to do - quitting}
3244No automount points were given on the command line and so there is no
3245work to do.
3246
3247@item @t{Out of memory in realloc}
3248While attempting to realloc some memory, the memory space available to
3249@i{Amd} was exhausted.  This is an unrecoverable error.
3250
3251@item @t{Out of memory}
3252While attempting to malloc some memory, the memory space available to
3253@i{Amd} was exhausted.  This is an unrecoverable error.
3254
3255@item @t{cannot create rpc/udp service}
3256Either the NFS or AMQ endpoint could not be created.
3257
3258@item @t{gethostname:} @i{description}
3259The @b{gethostname}(2) system call failed during startup.
3260
3261@item @t{host name is not set}
3262The @b{gethostname}(2) system call returned a zero length host name.
3263This can happen if @i{Amd} is started in single user mode just after
3264booting the system.
3265
3266@item @t{ifs_match called!}
3267An internal error occurred while restarting a pre-mounted filesystem.
3268This error ``should never happen''.
3269
3270@item @t{mount_afs:} @i{description}
3271An error occured while @i{Amd} was mounting itself.
3272
3273@item @t{run_rpc failed}
3274Somehow the main NFS server loop failed.  This error ``should never
3275happen''.
3276
3277@item @t{unable to free rpc arguments in amqprog_1}
3278The incoming arguments to the AMQ server could not be free'ed.
3279
3280@item @t{unable to free rpc arguments in nfs_program_1}
3281The incoming arguments to the NFS server could not be free'ed.
3282
3283@item @t{unable to register (AMQ_PROGRAM, AMQ_VERSION, udp)}
3284The AMQ server could not be registered with the local portmapper or the
3285internal RPC dispatcher.
3286
3287@item @t{unable to register (NFS_PROGRAM, NFS_VERSION, 0)}
3288The NFS server could not be registered with the internal RPC dispatcher.
3289
3290@end table
3291
3292@node     Info messages, , Fatal errors, Log Messages
3293@comment  node-name,  next,  previous,  up
3294@subsection Info messages
3295
3296@i{Amd} generates information messages to record state changes.  These
3297messages are selected by @samp{-x info} on the command line.  When
3298@b{syslog}(3) is being used, they are logged with level @samp{LOG_INFO}.
3299
3300The messages listed below can be generated and are in a format suitable
3301for simple statistical analysis.  @dfn{mount-info} is the string
3302that is displayed by @dfn{Amq} in its mount information column and
3303placed in the system mount table.
3304
3305@table @asis
3306@item @t{mount of "@t{$@{@i{path}@}}" on @t{$@{@i{fs}@}} timed out}
3307Attempts to mount a filesystem for the given automount point have failed
3308to complete within 30 seconds.
3309
3310@item @t{"@t{$@{@i{path}@}}" forcibly timed out}
3311An automount point has been timed out by the @i{Amq} command.
3312
3313@item @t{restarting @i{mount-info} on @t{$@{@i{fs}@}}}
3314A pre-mounted file system has been noted.
3315
3316@item @t{"@t{$@{@i{path}@}}" has timed out}
3317No access to the automount point has been made within the timeout
3318period.
3319
3320@item @t{file server @t{$@{@i{rhost}@}} is down - timeout of "@t{$@{@i{path}@}}" ignored}
3321An automount point has timed out, but the corresponding file server is
3322known to be down.  This message is only produced once for each mount
3323point for which the server is down.
3324
3325@item @t{Re-synchronizing cache for map @t{$@{@i{map}@}}}
3326The named map has been modified and the internal cache is being re-synchronized.
3327
3328@item @t{Filehandle denied for "@t{$@{@i{rhost}@}}:@t{$@{@i{rfs}@}}"}
3329The mount daemon refused to return a file handle for the requested filesystem.
3330
3331@item @t{Filehandle error for "$@{@i{rhost}@}:$@{@i{rfs}@}":} @i{description}
3332The mount daemon gave some other error for the requested filesystem.
3333
3334@item @t{file server @t{$@{@i{rhost}@}} type nfs starts up}
3335A new NFS file server has been referenced and is known to be up.
3336
3337@item @t{file server @t{$@{@i{rhost}@}} type nfs starts down}
3338A new NFS file server has been referenced and is known to be down.
3339
3340@item @t{file server @t{$@{@i{rhost}@}} type nfs is up}
3341An NFS file server that was previously down is now up.
3342
3343@item @t{file server @t{$@{@i{rhost}@}} type nfs is down}
3344An NFS file server that was previously up is now down.
3345
3346@item @t{Finishing with status @i{exit-status}}
3347@i{Amd} is about to exit with the given exit status.
3348
3349@item @t{@i{mount-info} mounted fstype @t{$@{@i{type}@}} on @t{$@{@i{fs}@}}}
3350A new file system has been mounted.
3351
3352@item @t{@i{mount-info} restarted fstype @t{$@{@i{type}@}} on @t{$@{@i{fs}@}}}
3353@i{Amd} is using a pre-mounted filesystem to satisfy a mount request.
3354
3355@item @t{@i{mount-info} unmounted fstype @t{$@{@i{type}@}} from @t{$@{@i{fs}@}}}
3356A file system has been unmounted.
3357
3358@item @t{@i{mount-info} unmounted fstype @t{$@{@i{type}@}} from @t{$@{@i{fs}@}} link @t{$@{@i{fs}@}}/@t{$@{@i{sublink}@}}}
3359A file system of which only a sub-directory was in use has been unmounted.
3360
3361@end table
3362
3363@node     Acknowledgements & Trademarks, Index, Internals, Top
3364@comment  node-name,  next,  previous,  up
3365@unnumbered Acknowledgements & Trademarks
3366
3367Thanks to the Formal Methods Group at Imperial College for
3368suffering patiently while @i{Amd} was being developed on their machines.
3369
3370Thanks to the many people who have helped with the development of
3371@i{Amd}, especially Piete Brooks at the Cambridge University Computing
3372Lab for many hours of testing, experimentation and discussion.
3373
3374@itemize @bullet
3375@item
3376@b{DEC}, @b{VAX} and @b{Ultrix} are registered trademarks of Digital
3377Equipment Corporation.
3378@item
3379@b{AIX} and @b{IBM} are registered trademarks of International Business
3380Machines Corporation.
3381@item
3382@b{Sun}, @b{NFS} and @b{SunOS} are registered trademarks of Sun
3383Microsystems, Inc.
3384@item
3385@b{Unix} is a registered trademark of AT&T Unix Systems Laboratories
3386in the USA and other countries.
3387@end itemize
3388
3389@node Index, , Acknowledgements & Trademarks, Top
3390@comment  node-name,  next,  previous,  up
3391@unnumbered Index
3392
3393@printindex cp
3394
3395@contents
3396@bye
3397