xref: /openbsd/usr.sbin/amd/doc/amdref.texinfo (revision 7b36286a)
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.11 2004/02/19 23:40:38 deraadt 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 networks or 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 existing filesystem.
1896* Automount Filesystem::
1897* Direct Automount Filesystem::
1898* Union Filesystem::
1899* Error Filesystem::
1900* Top-level Filesystem::
1901* Root Filesystem::
1902* Inheritance Filesystem::
1903@end menu
1904
1905@node     Network Filesystem, Network Host Filesystem, Filesystem Types, Filesystem Types
1906@comment  node-name,  next,  previous,  up
1907@section Network Filesystem (@samp{type:=nfs})
1908@cindex NFS
1909@cindex Mounting an NFS filesystem
1910@cindex How to mount and NFS filesystem
1911@cindex nfs, filesystem type
1912@cindex Filesystem type; nfs
1913
1914The @dfn{nfs} filesystem type provides access to Sun's NFS.
1915
1916@noindent
1917The following options must be specified:
1918
1919@table @code
1920@cindex rhost, mount option
1921@cindex Mount option; rhost
1922@item rhost
1923the remote fileserver.  This must be an entry in the hosts database.  IP
1924addresses are not accepted.  The default value is taken
1925from the local host name (@code{$@{host@}}) if no other value is
1926specified.
1927
1928@cindex rfs, mount option
1929@cindex Mount option; rfs
1930@item rfs
1931the remote filesystem.
1932If no value is specified for this option, an internal default of
1933@code{$@{path@}} is used.
1934@end table
1935
1936NFS mounts require a two stage process.  First, the @dfn{file handle} of
1937the remote file system must be obtained from the server.  Then a mount
1938system call must be done on the local system.  @i{Amd} keeps a cache
1939of file handles for remote file systems.  The cache entries have a
1940lifetime of a few minutes.
1941
1942If a required file handle is not in the cache, @i{Amd} sends a request
1943to the remote server to obtain it.  @i{Amd} @dfn{does not} wait for
1944a response; it notes that one of the locations needs retrying, but
1945continues with any remaining locations.  When the file handle becomes
1946available, and assuming none of the other locations was successfully
1947mounted, @i{Amd} will retry the mount.  This mechanism allows several
1948NFS filesystems to be mounted in parallel.
1949@c @footnote{The mechanism
1950@c is general, however NFS is the only filesystem
1951@c for which the required hooks have been written.}
1952The first one which responds with a valid file handle will be used.
1953
1954@noindent
1955An NFS entry might be:
1956
1957@example
1958jsp  host!=charm;type:=nfs;rhost:=charm;rfs:=/home/charm;sublink:=jsp
1959@end example
1960
1961The mount system call and any unmount attempts are always done
1962in a new task to avoid the possibilty of blocking @i{Amd}.
1963
1964@node     Network Host Filesystem, Network Filesystem Group, Network Filesystem, Filesystem Types
1965@comment  node-name,  next,  previous,  up
1966@section Network Host Filesystem (@samp{type:=host})
1967@cindex Network host filesystem
1968@cindex Mounting entire export trees
1969@cindex How to mount all NFS exported filesystems
1970@cindex host, filesystem type
1971@cindex Filesystem type; host
1972
1973@c NOTE: the current implementation of the @dfn{host} filesystem type
1974@c sometimes fails to maintain a consistent view of the remote mount tree.
1975@c This happens when the mount times out and only some of the remote mounts
1976@c are successfully unmounted.  To prevent this from occurring, use the
1977@c @samp{nounmount} mount option.
1978
1979The @dfn{host} filesystem allows access to the entire export tree of an
1980NFS server.  The implementation is layered above the @samp{nfs}
1981implementation so keep-alives work in the same way.  The only option
1982which needs to specified is @samp{rhost} which is the name of the
1983fileserver to mount.
1984
1985The @samp{host} filesystem type works by querying the mount daemon on
1986the given fileserver to obtain its export list.  @i{Amd} then obtains
1987filehandles for each of the exported filesystems.  Any errors at this
1988stage cause that particular filesystem to be ignored.  Finally each
1989filesystem is mounted.  Again, errors are logged but ignored.  One
1990common reason for mounts to fail is that the mount point does not exist.
1991Although @i{Amd} attempts to automatically create the mount point, it
1992may be on a remote filesystem to which @i{Amd} does not have write
1993permission.
1994
1995When an attempt to unmount a @samp{host} filesystem mount fails, @i{Amd}
1996remounts any filesystems which had successfully been unmounted.  To do
1997this @i{Amd} queries the mount daemon again and obtains a fresh copy of
1998the export list.  @i{Amd} then tries to mount any exported filesystems
1999which are not currently mounted.
2000
2001Sun's automounter provides a special @samp{-hosts} map.  To achieve the
2002same effect with @i{Amd} requires two steps.  First a mount map must
2003be created as follows:
2004
2005@example
2006/defaults  type:=host;fs:=$@{autodir@}/$@{rhost@}/root;rhost:=$@{key@}
2007*          opts:=rw,nosuid,grpid
2008@end example
2009
2010@noindent
2011and then start @i{Amd} with the following command
2012
2013@example
2014amd /n net.map
2015@end example
2016
2017@noindent
2018where @samp{net.map} is the name of map described above.  Note that the
2019value of @code{$@{fs@}} is overridden in the map.  This is done to avoid
2020a clash between the mount tree and any other filesystem already mounted
2021from the same fileserver.
2022
2023If different mount options are needed for different hosts then
2024additional entries can be added to the map, for example
2025
2026@example
2027host2       opts:=ro,nosuid,soft
2028@end example
2029
2030@noindent
2031would soft mount @samp{host2} read-only.
2032
2033@node     Network Filesystem Group, Unix Filesystem, Network Host Filesystem, Filesystem Types
2034@comment  node-name,  next,  previous,  up
2035@section Network Filesystem Group (@samp{type:=nfsx})
2036@cindex Network filesystem group
2037@cindex Atomic NFS mounts
2038@cindex Mounting an atomic group of NFS filesystems
2039@cindex How to mount an atomic group of NFS filesystems
2040@cindex nfsx, filesystem type
2041@cindex Filesystem type; nfsx
2042
2043The @dfn{nfsx} filesystem allows a group of filesystems to be mounted
2044from a single NFS server.  The implementation is layered above the
2045@samp{nfs} implementation so keep-alives work in the same way.
2046
2047The options are the same as for the @samp{nfs} filesystem with one
2048difference.
2049
2050@noindent
2051The following options must be specified:
2052
2053@table @code
2054@item rhost
2055the remote fileserver.  This must be an entry in the hosts database.  IP
2056addresses are not accepted.  The default value is taken from the local
2057host name (@code{$@{host@}}) if no other value is specified.
2058
2059@item rfs
2060as a list of filesystems to mount.  The list is in the form of a comma
2061separated strings.
2062@end table
2063
2064@noindent
2065For example:
2066
2067@example
2068pub      type:=nfsx;rhost:=gould;\
2069		rfs:=/public,/,graphics,usenet;fs:=$@{autodir@}/$@{rhost@}/root
2070@end example
2071
2072The first string defines the root of the tree, and is applied as a
2073prefix to the remaining members of the list which define the individual
2074filesystems.  The first string is @emph{not} used as a filesystem name.
2075A parallel operation is used to determine the local mount points to
2076ensure a consistent layout of a tree of mounts.
2077
2078Here, the @emph{three} filesystems, @samp{/public},
2079@samp{/public/graphics} and @samp{/public/usenet}, would be mounted.@refill
2080
2081A local mount point, @code{$@{fs@}}, @emph{must} be specified.  The
2082default local mount point will not work correctly in the general case.
2083A suggestion is to use @samp{fs:=$@{autodir@}/$@{rhost@}/root}.@refill
2084
2085@node     Unix Filesystem, Program Filesystem, Network Filesystem Group, Filesystem Types
2086@comment  node-name,  next,  previous,  up
2087@section Unix Filesystem (@samp{type:=ufs})
2088@cindex Unix filesystem
2089@cindex UFS
2090@cindex Mounting a UFS filesystem
2091@cindex Mounting a local disk
2092@cindex How to mount a UFS filesystems
2093@cindex How to mount a local disk
2094@cindex Disk filesystems
2095@cindex ufs, filesystem type
2096@cindex Filesystem type; ufs
2097
2098The @dfn{ufs} filesystem type provides access to the system's
2099standard disk filesystem---usually a derivative of the Berkeley Fast Filesystem.
2100
2101@noindent
2102The following option must be specified:
2103
2104@table @code
2105@cindex dev, mount option
2106@cindex Mount option; dev
2107@item dev
2108the block special device to be mounted.
2109@end table
2110
2111A UFS entry might be:
2112
2113@example
2114jsp   host==charm;type:=ufs;dev:=/dev/xd0g;sublink:=jsp
2115@end example
2116
2117@node     Program Filesystem, Symbolic Link Filesystem, Unix Filesystem, Filesystem Types
2118@comment  node-name,  next,  previous,  up
2119@section Program Filesystem (@samp{type:=program})
2120@cindex Program filesystem
2121@cindex Mount a filesystem under program control
2122@cindex program, filesystem type
2123@cindex Filesystem type; program
2124
2125The @dfn{program} filesystem type allows a program to be run whenever a
2126mount or unmount is required.  This allows easy addition of support for
2127other filesystem types, such as MIT's Remote Virtual Disk (RVD)
2128which has a programmatic interface via the commands
2129@samp{rvdmount} and @samp{rvdunmount}.
2130
2131@noindent
2132The following options must be specified:
2133
2134@table @code
2135@cindex mount, mount option
2136@cindex Mount option; mount
2137@item mount
2138the program which will perform the mount.
2139
2140@cindex unmount, mount option
2141@cindex Mount option; unmount
2142@item unmount
2143the program which will perform the unmount.
2144@end table
2145
2146The exit code from these two programs is interpreted as a Unix error
2147code.  As usual, exit code zero indicates success.  To execute the
2148program @i{Amd} splits the string on whitespace to create an array of
2149substrings.  Single quotes @samp{'} can be used to quote whitespace
2150if that is required in an argument.  There is no way to escape or change
2151the quote character.
2152
2153To run the program @samp{rvdmount} with a host name and filesystem as
2154arguments would be specified by @samp{mount:="/etc/rvdmount rvdmount
2155fserver $@{path@}"}.
2156
2157The first element in the array is taken as the pathname of the program
2158to execute.  The other members of the array form the argument vector to
2159be passed to the program, @dfn{including argument zero}.  This means
2160that the split string must have at least two elements.  The program is
2161directly executed by @i{Amd}, not via a shell.  This means that scripts
2162must begin with a @code{#!} interpreter specification.
2163
2164If a filesystem type is to be heavily used, it may be worthwhile adding
2165a new filesystem type into @i{Amd}, but for most uses the program
2166filesystem should suffice.
2167
2168When the program is run, standard input and standard error are inherited
2169from the current values used by @i{Amd}.  Standard output is a
2170duplicate of standard error.  The value specified with the ``-l''
2171command line option has no effect on standard error.
2172
2173@node     Symbolic Link Filesystem, Symbolic Link Filesystem II, Program Filesystem, Filesystem Types
2174@comment  node-name,  next,  previous,  up
2175@section Symbolic Link Filesystem (@samp{type:=link})
2176@cindex Symbolic link filesystem
2177@cindex Referencing part of the local name space
2178@cindex Mounting part of the local name space
2179@cindex How to reference part of the local name space
2180@cindex link, filesystem type
2181@cindex symlink, link filesystem type
2182@cindex Filesystem type; link
2183
2184Each filesystem type creates a symbolic link to point from the volume
2185name to the physical mount point.  The @samp{link} filesystem does the
2186same without any other side effects.  This allows any part of the
2187machines name space to be accessed via @i{Amd}.
2188
2189One common use for the symlink filesystem is @file{/homes} which can be
2190made to contain an entry for each user which points to their
2191(auto-mounted) home directory.  Although this may seem rather expensive,
2192it provides a great deal of administrative flexibility.
2193
2194@noindent
2195The following option must be defined:
2196
2197@table @code
2198@item fs
2199The value of @var{fs} option specifies the destination of the link, as
2200modified by the @var{sublink} option.  If @var{sublink} is non-null, it
2201is appended to @code{$@{fs@}}@code{/} and the resulting string is used
2202as the target.
2203@end table
2204
2205The @samp{link} filesystem can be though of as identical to the
2206@samp{ufs} filesystem but without actually mounting anything.
2207
2208An example entry might be:
2209
2210@example
2211jsp   host==charm;type:=link;fs:=/home/charm;sublink:=jsp
2212@end example
2213which would return a symbolic link pointing to @file{/home/charm/jsp}.
2214
2215@node     Symbolic Link Filesystem II, Automount Filesystem, Symbolic Link Filesystem, Filesystem Types
2216@comment  node-name,  next,  previous,  up
2217@section Symbolic Link Filesystem II (@samp{type:=linkx})
2218@cindex Symbolic link filesystem II
2219@cindex Referencing an existing part of the local name space
2220@cindex Mounting an existing part of the local name space
2221@cindex How to reference an existing part of the local name space
2222@cindex linkx, filesystem type
2223@cindex symlink, linkx filesystem type
2224@cindex Filesystem type; linkx
2225
2226The @samp{linkx} filesystem type is identical to @samp{link} with the
2227exception that the target of the link must exist.  Existence is checked
2228with the @samp{lstat} system call.
2229
2230The @samp{linkx} filesystem type is particularly useful for wildcard map
2231entries.  In this case, a list of possible targets can be give and
2232@i{Amd} will choose the first one which exists on the local machine.
2233
2234@node     Automount Filesystem, Direct Automount Filesystem, Symbolic Link Filesystem II, Filesystem Types
2235@comment  node-name,  next,  previous,  up
2236@section Automount Filesystem (@samp{type:=auto})
2237@cindex Automount filesystem
2238@cindex Map cache types
2239@cindex Setting map cache parameters
2240@cindex How to set map cache parameters
2241@cindex How to start an indirect automount point
2242@cindex auto, filesystem type
2243@cindex Filesystem type; auto
2244@cindex SIGHUP signal
2245@cindex Map cache synchronising
2246@cindex Synchronising the map cache
2247@cindex Map cache options
2248@cindex Regular expressions in maps
2249
2250The @dfn{auto} filesystem type creates a new automount point below an
2251existing automount point.  Top-level automount points appear as system
2252mount points.  An automount mount point can also appear as a
2253sub-directory of an existing automount point.  This allows some
2254additional structure to be added, for example to mimic the mount tree of
2255another machine.
2256
2257The following options may be specified:
2258
2259@table @code
2260@cindex cache, mount option
2261@cindex Mount option; cache
2262@item cache
2263specifies whether the data in this mount-map should be
2264cached.  The default value is @samp{none}, in which case
2265no caching is done in order to conserve memory.
2266However, better performance and reliability can be obtained by caching
2267some or all of a mount-map.
2268
2269If the cache option specifies @samp{all},
2270the entire map is enumerated when the mount point is created.
2271
2272If the cache option specifies @samp{inc}, caching is done incrementally
2273as and when data is required.
2274Some map types do not support cache mode @samp{all}, in which case @samp{inc}
2275is used whenever @samp{all} is requested.
2276
2277Caching can be entirely disabled by using cache mode @samp{none}.
2278
2279If the cache option specifies @samp{regexp} then the entire map will be
2280enumerated and each key will be treated as an egrep-style regular
2281expression.  The order in which a cached map is searched does not
2282correspond to the ordering in the source map so the regular expressions
2283should be mutually exclusive to avoid confusion.
2284
2285Each mount map type has a default cache type, usually @samp{inc}, which
2286can be selected by specifying @samp{mapdefault}.
2287
2288The cache mode for a mount map can only be selected on the command line.
2289Starting @i{Amd} with the command:
2290
2291@example
2292amd /homes hesiod.homes -cache:=inc
2293@end example
2294
2295will cause @samp{/homes} to be automounted using the @dfn{Hesiod} name
2296server with local incremental caching of all successfully resolved names.
2297
2298All cached data is forgotten whenever @i{Amd} receives a @samp{SIGHUP}
2299signal and, if cache @samp{all} mode was selected, the cache will be
2300reloaded.  This can be used to inform @i{Amd} that a map has been
2301updated.  In addition, whenever a cache lookup fails and @i{Amd} needs
2302to examine a map, the map's modify time is examined.  If the cache is
2303out of date with respect to the map then it is flushed as if a
2304@samp{SIGHUP} had been received.
2305
2306An additional option (@samp{sync}) may be specified to force @i{Amd} to
2307check the map's modify time whenever a cached entry is being used.  For
2308example, an incremental, synchronised cache would be created by the
2309following command:
2310
2311@example
2312amd /homes hesiod.homes -cache:=inc,sync
2313@end example
2314
2315@item fs
2316specifies the name of the mount map to use for the new mount point.
2317
2318Arguably this should have been specified with the @code{$@{rfs@}} option but
2319we are now stuck with it due to historical accident.
2320
2321@c %If the string @samp{.} is used then the same map is used;
2322@c %in addition the lookup prefix is set to the name of the mount point followed
2323@c %by a slash @samp{/}.
2324@c %This is the same as specifying @samp{fs:=\$@{map@};pref:=\$@{key@}/}.
2325@c
2326
2327@item pref
2328alters the name that is looked up in the mount map.  If
2329@code{$@{pref@}}, the @dfn{prefix}, is non-null then it is prepended to
2330the name requested by the kernel @dfn{before} the map is searched.
2331@end table
2332
2333The server @samp{dylan.doc.ic.ac.uk} has two user disks:
2334@samp{/dev/dsk/2s0} and @samp{/dev/dsk/5s0}.  These are accessed as
2335@samp{/home/dylan/dk2} and @samp{/home/dylan/dk5} respectively.  Since
2336@samp{/home} is already an automount point, this naming is achieved with
2337the following map entries:@refill
2338
2339@example
2340dylan        type:=auto;fs:=$@{map@};pref:=$@{key@}/
2341dylan/dk2    type:=ufs;dev:=/dev/dsk/2s0
2342dylan/dk5    type:=ufs;dev:=/dev/dsk/5s0
2343@end example
2344
2345@node     Direct Automount Filesystem, Union Filesystem, Automount Filesystem, Filesystem Types
2346@comment  node-name,  next,  previous,  up
2347@section Direct Automount Filesystem (@samp{type:=direct})
2348@cindex Direct automount filesystem
2349@cindex How to start a direct automount point
2350@cindex direct, filesystem type
2351@cindex Filesystem type; direct
2352
2353The @dfn{direct} filesystem is almost identical to the automount
2354filesystem.  Instead of appearing to be a directory of mount points, it
2355appears as a symbolic link to a mounted filesystem.  The mount is done
2356at the time the link is accessed.  @xref{Automount Filesystem}, for a
2357list of required options.
2358
2359Direct automount points are created by specifying the @samp{direct}
2360filesystem type on the command line:
2361
2362@example
2363amd ... /usr/man auto.direct -type:=direct
2364@end example
2365
2366where @samp{auto.direct} would contain an entry such as:
2367
2368@example
2369usr/man    -type:=nfs;rfs:=/usr/man \
2370           rhost:=man-server1  rhost:=man-server2
2371@end example
2372
2373In this example, @samp{man-server1} and @samp{man-server2} are file
2374servers which export copies of the manual pages.  Note that the key
2375which is looked up is the name of the automount point without the
2376leading @samp{/}.
2377
2378@node     Union Filesystem, Error Filesystem, Direct Automount Filesystem, Filesystem Types
2379@comment  node-name,  next,  previous,  up
2380@section Union Filesystem (@samp{type:=union})
2381@cindex Union filesystem
2382@cindex union, filesystem type
2383@cindex Filesystem type; union
2384
2385The @dfn{union} filesystem type allows the contents of several
2386directories to be merged and made visible in a single directory.  This
2387can be used to overcome one of the major limitations of the Unix mount
2388mechanism which only allows complete directories to be mounted.
2389
2390For example, supposing @file{/tmp} and @file{/var/tmp} were to be merged
2391into a new directory called @file{/mtmp}, with files in @file{/var/tmp}
2392taking precedence.  The following command could be used to achieve this
2393effect:
2394
2395@example
2396amd ... /mtmp union:/tmp:/var/tmp -type:=union
2397@end example
2398
2399Currently, the unioned directories must @emph{not} be automounted.  That
2400would cause a deadlock.  This seriously limits the current usefulness of
2401this filesystem type and the problem will be addressed in a future
2402release of @i{Amd}.
2403
2404Files created in the union directory are actually created in the last
2405named directory.  This is done by creating a wildcard entry which points
2406to the correct directory.  The wildcard entry is visible if the union
2407directory is listed, so allowing you to see which directory has
2408priority.
2409
2410The files visible in the union directory are computed at the time
2411@i{Amd} is started, and are not kept uptodate with respect to the
2412underlying directories.  Similarly, if a link is removed, for example
2413with the @samp{rm} command, it will be lost forever.
2414
2415@node     Error Filesystem, Top-level Filesystem, Union Filesystem, Filesystem Types
2416@comment  node-name,  next,  previous,  up
2417@section Error Filesystem (@samp{type:=error})
2418@cindex Error filesystem
2419@cindex error, filesystem type
2420@cindex Filesystem type; error
2421
2422The @dfn{error} filesystem type is used internally as a catch-all in
2423the case where none of the other filesystems was selected, or some other
2424error occurred.
2425Lookups and mounts always fail with ``No such file or directory''.
2426All other operations trivially succeed.
2427
2428The error filesystem is not directly accessible.
2429
2430@node     Top-level Filesystem, Root Filesystem, Error Filesystem, Filesystem Types
2431@comment  node-name,  next,  previous,  up
2432@section Top-level Filesystem (@samp{type:=toplvl})
2433@cindex Top level filesystem
2434@cindex toplvl, filesystem type
2435@cindex Filesystem type; toplvl
2436
2437The @dfn{toplvl} filesystems is derived from the @samp{auto} filesystem
2438and is used to mount the top-level automount nodes.  Requests of this
2439type are automatically generated from the command line arguments and
2440can also be passed in by using the ``-M'' option of the @dfn{Amq} command.
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 -M-option::     Mounting a volume.
2611* Amq -s option::     Obtaining global statistics.
2612* Amq -u option::     Forcing volumes to time out.
2613* Amq -v option::     Version information.
2614* Other Amq options:: Three other special options.
2615@end menu
2616
2617@node     Amq default, Amq -f option, Controlling Amd, Controlling Amd
2618@comment  node-name,  next,  previous,  up
2619@subsection @i{Amq} default information
2620
2621With no arguments, @dfn{Amq} obtains a brief list of all existing
2622mounts created by @i{Amd}.  This is different from the list displayed by
2623@b{df}(1) since the latter only includes system mount points.
2624
2625@noindent
2626The output from this option includes the following information:
2627
2628@itemize @bullet
2629@item
2630the automount point,
2631@item
2632the filesystem type,
2633@item
2634the mount map or mount information,
2635@item
2636the internal, or system mount point.
2637@end itemize
2638
2639@noindent
2640For example:
2641
2642@example
2643/            root   "root"                    sky:(pid75)
2644/homes       toplvl /usr/local/etc/amd.homes  /homes
2645/home        toplvl /usr/local/etc/amd.home   /home
2646/homes/jsp   nfs    charm:/home/charm         /a/charm/home/charm/jsp
2647/homes/phjk  nfs    toytown:/home/toytown     /a/toytown/home/toytown/ai/phjk
2648@end example
2649
2650@noindent
2651If an argument is given then statistics for that volume name will
2652be output.  For example:
2653
2654@example
2655What            Uid   Getattr Lookup RdDir   RdLnk   Statfs Mounted@@
2656/homes          0     1196    512    22      0       30     90/09/14 12:32:55
2657/homes/jsp      0     0       0      0       1180    0      90/10/13 12:56:58
2658@end example
2659
2660@table @code
2661@item What
2662the volume name.
2663
2664@item Uid
2665ignored.
2666
2667@item Getattr
2668the count of NFS @dfn{getattr} requests on this node.  This should only be
2669non-zero for directory nodes.
2670
2671@item Lookup
2672the count of NFS @dfn{lookup} requests on this node.  This should only be
2673non-zero for directory nodes.
2674
2675@item RdDir
2676the count of NFS @dfn{readdir} requests on this node.  This should only
2677be non-zero for directory nodes.
2678
2679@item RdLnk
2680the count of NFS @dfn{readlink} requests on this node.  This should be
2681zero for directory nodes.
2682
2683@item Statfs
2684the could of NFS @dfn{statfs} requests on this node.  This should only
2685be non-zero for top-level automount points.
2686
2687@item Mounted@@
2688the date and time the volume name was first referenced.
2689@end table
2690
2691@node     Amq -f option, Amq -h option, Amq default, Controlling Amd
2692@comment  node-name,  next,  previous,  up
2693@subsection @i{Amq} -f option
2694@cindex Flushing the map cache
2695@cindex Map cache, flushing
2696
2697The ``-f'' option causes @i{Amd} to flush the internal mount map cache.
2698This is useful for Hesiod maps since @i{Amd} will not automatically
2699notice when they have been updated.  The map cache can also be
2700synchronised with the map source by using the @samp{sync} option
2701(@pxref{Automount Filesystem}).@refill
2702
2703@node     Amq -h option, Amq -m option, Amq -f option, Controlling Amd
2704@comment  node-name,  next,  previous,  up
2705@subsection @i{Amq} -h option
2706@cindex Querying an alternate host
2707
2708By default the local host is used.  In an HP-UX cluster the root server
2709is used since that is the only place in the cluster where @i{Amd} will
2710be running.  To query @i{Amd} on another host the ``-h'' option should
2711be used.
2712
2713@node     Amq -m option, Amq -M-option, Amq -h option, Controlling Amd
2714@comment  node-name,  next,  previous,  up
2715@subsection @i{Amq} -m option
2716
2717The ``-m'' option displays similar information about mounted
2718filesystems, rather than automount points.  The output includes the
2719following information:
2720
2721@itemize @bullet
2722@item
2723the mount information,
2724@item
2725the mount point,
2726@item
2727the filesystem type,
2728@item
2729the number of references to this filesystem,
2730@item
2731the server hostname,
2732@item
2733the state of the file server,
2734@item
2735any error which has occured.
2736@end itemize
2737
2738For example:
2739
2740@example
2741"root"           truth:(pid602)     root   1 localhost is up
2742hesiod.home      /home              toplvl 1 localhost is up
2743hesiod.vol       /vol               toplvl 1 localhost is up
2744hesiod.homes     /homes             toplvl 1 localhost is up
2745amy:/home/amy    /a/amy/home/amy    nfs    5 amy is up
2746swan:/home/swan  /a/swan/home/swan  nfs    0 swan is up (Permission denied)
2747ex:/home/ex      /a/ex/home/ex      nfs    0 ex is down
2748@end example
2749
2750When the reference count is zero the filesystem is not mounted but
2751the mount point and server information is still being maintained
2752by @i{Amd}.
2753
2754@node     Amq -M-option, Amq -s option, Amq -m option, Controlling Amd
2755@comment  node-name,  next,  previous,  up
2756@subsection @i{Amq} -M option
2757
2758The ``-M'' option passes a new map entry to @i{Amd} and waits for it to
2759be evaluated, possibly causing a mount.  For example, the following
2760command would cause @samp{/home/toytown} on host @samp{toytown} to be
2761mounted locally on @samp{/mnt/toytown}.
2762
2763@example
2764amq -M '/mnt/toytown type:=nfs;rfs:=/home/toytown;rhost:=toytown;fs:=$@{key@}'
2765@end example
2766
2767@i{Amd} applies some simple security checks before allowing this
2768operation.  The check tests whether the incoming request is from a
2769privileged UDP port on the local machine.  ``Permission denied'' is
2770returned if the check fails.
2771
2772A future release of @i{Amd} will include code to allow the @b{mount}(8)
2773command to mount automount points:
2774
2775@example
2776mount -t amd /vol hesiod.vol
2777@end example
2778
2779This will then allow @i{Amd} to be controlled from the standard system
2780filesystem mount list.
2781
2782@node     Amq -s option, Amq -u option, Amq -M-option, Controlling Amd
2783@comment  node-name,  next,  previous,  up
2784@subsection @i{Amq} -s option
2785@cindex Global statistics
2786@cindex Statistics
2787
2788The ``-s'' option displays global statistics.  If any other options are specified
2789or any filesystems named then this option is ignored.  For example:
2790
2791@example
2792requests  stale     mount     mount     unmount
2793deferred  fhandles  ok        failed    failed
27941054      1         487       290       7017
2795@end example
2796
2797@table @samp
2798@item Deferred requests
2799are those for which an immediate reply could not be constructed.  For
2800example, this would happen if a background mount was required.
2801
2802@item Stale filehandles
2803counts the number of times the kernel passes a stale filehandle to @i{Amd}.
2804Large numbers indicate problems.
2805
2806@item Mount ok
2807counts the number of automounts which were successful.
2808
2809@item Mount failed
2810counts the number of automounts which failed.
2811
2812@item Unmount failed
2813counts the number of times a filesystem could not be unmounted.  Very
2814large numbers here indicate that the time between unmount attempts
2815should be increased.
2816@end table
2817
2818@node     Amq -u option, Amq -v option, Amq -s option, Controlling Amd
2819@comment  node-name,  next,  previous,  up
2820@subsection @i{Amq} -u option
2821@cindex Forcing filesystem to time out
2822@cindex Unmounting a filesystem
2823
2824The ``-u'' option causes the time-to-live interval of the named mount
2825points to be expired, thus causing an unmount attempt.  This is the only
2826safe way to unmount an automounted filesystem.  It is not possible to
2827unmount a filesystem which has been mounted with the @samp{nounmount}
2828flag.
2829
2830@c The ``-H'' option informs @i{Amd} that the specified mount point has hung -
2831@c as if its keepalive timer had expired.
2832
2833@node     Amq -v option, Other Amq options, Amq -u option, Controlling Amd
2834@comment  node-name,  next,  previous,  up
2835@subsection @i{Amq} -v option
2836@cindex Version information at run-time
2837
2838The ``-v'' option displays the version of @i{Amd} in a similar way to
2839@i{Amd}'s ``-v'' option.
2840
2841@node     Other Amq options, , Amq -v option, Controlling Amd
2842@comment  node-name,  next,  previous,  up
2843@subsection Other @i{Amq} options
2844
2845Three other operations are implemented.  These modify the state of
2846@i{Amd} as a whole, rather than any particular filesystem.  The ``-l'',
2847``-x'' and ``-D'' options have exactly the same effect as @i{Amd}'s
2848corresponding command line options.  The ``-l'' option is rejected by
2849@i{Amd} in the current version for obvious security reasons.  When
2850@i{Amd} receives a ``-x''flag it limits the log options being modified
2851to those which were not enabled at startup.  This prevents a user
2852turning @emph{off} any logging option which was specified at startup,
2853though any which have been turned off since then can still be turned
2854off.  The ``-D'' option has a similar behaviour.
2855
2856@node     Examples, Internals, Run-time Administration, Top
2857@comment  node-name,  next,  previous,  up
2858@chapter Examples
2859
2860@menu
2861* User Filesystems::
2862* Home Directories::
2863* Architecture Sharing::
2864* Wildcard Names::
2865* rwho servers::
2866* /vol::
2867@end menu
2868
2869@node     User Filesystems, Home Directories, Examples, Examples
2870@comment  node-name,  next,  previous,  up
2871@section User Filesystems
2872@cindex User filesystems
2873@cindex Mounting user filesystems
2874
2875With more than one fileserver, the directories most frequently
2876cross-mounted are those containing user home directories.  A common
2877convention used at Imperial College is to mount the user disks under
2878@t{/home/}@i{machine}.
2879
2880Typically, the @samp{/etc/fstab} file contained a long list of entries
2881such as:
2882
2883@example
2884@i{machine}:/home/@i{machine} /home/@i{machine} nfs ...
2885@end example
2886
2887for each fileserver on the network.
2888
2889There are numerous problems with this system.  The mount list can become
2890quite large and some of the machines may be down when a system is
2891booted.  When a new fileserver is installed, @samp{/etc/fstab} must be
2892updated on every machine, the mount directory created and the filesystem
2893mounted.
2894
2895In many environments most people use the same few workstations, but
2896it is convenient to go to a colleague's machine and access your own
2897files.  When a server goes down, it can cause a process on a client
2898machine to hang.  By minimising the mounted filesystems to only include
2899those actively being used, there is less chance that a filesystem will
2900be mounted when a server goes down.
2901
2902The following is a short extract from a map taken from a research fileserver
2903at Imperial College.
2904
2905Note the entry for @samp{localhost} which is used for users such as
2906the operator (@samp{opr}) who have a home directory on most machine as
2907@samp{/home/localhost/opr}.
2908
2909@example
2910/defaults       opts:=rw,intr,grpid,nosuid
2911charm           host!=$@{key@};type:=nfs;rhost:=$@{key@};rfs:=/home/$@{key@} \
2912                host==$@{key@};type:=ufs;dev:=/dev/xd0g
2913#
2914...
2915
2916#
2917localhost       type:=link;fs:=$@{host@}
2918...
2919#
2920# dylan has two user disks so have a
2921# top directory in which to mount them.
2922#
2923dylan           type:=auto;fs:=$@{map@};pref:=$@{key@}/
2924#
2925dylan/dk2       host!=dylan;type:=nfs;rhost:=dylan;rfs:=/home/$@{key@} \
2926                host==dylan;type:=ufs;dev:=/dev/dsk/2s0
2927#
2928dylan/dk5       host!=dylan;type:=nfs;rhost:=dylan;rfs:=/home/$@{key@} \
2929                host==dylan;type:=ufs;dev:=/dev/dsk/5s0
2930...
2931#
2932toytown         host!=$@{key@};type:=nfs;rhost:=$@{key@};rfs:=/home/$@{key@} \
2933                host==$@{key@};type:=ufs;dev:=/dev/xy1g
2934...
2935#
2936zebedee         host!=$@{key@};type:=nfs;rhost:=$@{key@};rfs:=/home/$@{key@} \
2937                host==$@{key@};type:=ufs;dev:=/dev/dsk/1s0
2938#
2939# Just for access...
2940#
2941gould           type:=auto;fs:=$@{map@};pref:=$@{key@}/
2942gould/staff     host!=gould;type:=nfs;rhost:=gould;rfs:=/home/$@{key@}
2943#
2944gummo           host!=$@{key@};type:=nfs;rhost:=$@{key@};rfs:=/home/$@{key@}
2945...
2946@end example
2947
2948This map is shared by most of the machines listed so on those
2949systems any of the user disks is accessible via a consistent name.
2950@i{Amd} is started with the following command
2951
2952@example
2953amd /home amd.home
2954@end example
2955
2956Note that when mounting a remote filesystem, the @dfn{automounted}
2957mount point is referenced, so that the filesystem will be mounted if
2958it is not yet (at the time the remote @samp{mountd} obtains the file handle).
2959
2960@node     Home Directories, Architecture Sharing, User Filesystems, Examples
2961@comment  node-name,  next,  previous,  up
2962@section Home Directories
2963@cindex Home directories
2964@cindex Example of mounting home directories
2965@cindex Mount home directories
2966
2967One convention for home directories is to locate them in @samp{/homes}
2968so user @samp{jsp}'s home directory is @samp{/homes/jsp}.  With more
2969than a single fileserver it is convenient to spread user files across
2970several machines.  All that is required is a mount-map which converts
2971login names to an automounted directory.
2972
2973Such a map might be started by the command:
2974
2975@example
2976amd /homes amd.homes
2977@end example
2978
2979where the map @samp{amd.homes} contained the entries:
2980
2981@example
2982/defaults   type:=link   # All the entries are of type:=link
2983jsp         fs:=/home/charm/jsp
2984njw         fs:=/home/dylan/dk5/njw
2985...
2986phjk        fs:=/home/toytown/ai/phjk
2987sjv         fs:=/home/ganymede/sjv
2988@end example
2989
2990Whenever a login name is accessed in @samp{/homes} a symbolic link
2991appears pointing to the real location of that user's home directory.  In
2992this example, @samp{/homes/jsp} would appear to be a symbolic link
2993pointing to @samp{/home/charm/jsp}.  Of course, @samp{/home} would also
2994be an automount point.
2995
2996This system causes an extra level of symbolic links to be used.
2997Although that turns out to be relatively inexpensive, an alternative is
2998to directly mount the required filesystems in the @samp{/homes}
2999map.  The required map is simple, but long, and its creation is best automated.
3000The entry for @samp{jsp} could be:
3001
3002@example
3003jsp   -sublink:=$@{key@};rfs:=/home/charm \
3004               host==charm;type:=ufs;dev:=/dev/xd0g \
3005               host!=charm;type:=nfs;rhost:=charm
3006@end example
3007
3008This map can become quite big if it contains a large number of entries.
3009By combining two other features of @i{Amd} it can be greatly simplified.
3010
3011First the UFS partitions should be mounted under the control of
3012@samp{/etc/fstab}, taking care that they are mounted in the same place
3013that @i{Amd} would have automounted them.  In most cases this would be
3014something like @samp{/a/@dfn{host}/home/@dfn{host}} and
3015@samp{/etc/fstab} on host @samp{charm} would have a line:@refill
3016
3017@example
3018/dev/xy0g /a/charm/home/charm 4.2 rw,nosuid,grpid 1 5
3019@end example
3020
3021The map can then be changed to:
3022
3023@example
3024/defaults    type:=nfs;sublink:=$@{key@};opts:=rw,intr,nosuid,grpid
3025jsp          rhost:=charm;rfs:=/home/charm
3026njw          rhost:=dylan;rfs:=/home/dylan/dk5
3027...
3028phjk         rhost:=toytown;rfs:=/home/toytown;sublink:=ai/$@{key@}
3029sjv          rhost:=ganymede;rfs:=/home/ganymede
3030@end example
3031
3032This map operates as usual on a remote machine (@i{ie} @code{$@{host@}}
3033not equal to @code{$@{rhost@}}).  On the machine where the filesystem is
3034stored (@i{ie} @code{$@{host@}} equal to @code{$@{rhost@}}), @i{Amd}
3035will construct a local filesystem mount point which corresponds to the
3036name of the locally mounted UFS partition.  If @i{Amd} is started with
3037the ``-r'' option then instead of attempting an NFS mount, @i{Amd} will
3038simply inherit the UFS mount (@pxref{Inheritance Filesystem}).  If
3039``-r'' is not used then a loopback NFS mount will be made.  This type of
3040mount is known to cause a deadlock on many systems.
3041
3042@node     Architecture Sharing, Wildcard Names, Home Directories, Examples
3043@comment  node-name,  next,  previous,  up
3044@section Architecture Sharing
3045@cindex Architecture sharing
3046@cindex Sharing a fileserver between architectures
3047@cindex Architecture dependent volumes
3048
3049@c %At the moment some of the research machines have sets of software
3050@c %mounted in @samp{/vol}.  This contains subdirectories for \TeX,
3051@c %system sources, local sources, prolog libraries and so on.
3052Often a filesystem will be shared by machines of different architectures.
3053Separate trees can be maintained for the executable images for each
3054architecture, but it may be more convenient to have a shared tree,
3055with distinct subdirectories.
3056
3057A shared tree might have the following structure on the fileserver (called
3058@samp{fserver} in the example):
3059
3060@example
3061local/tex
3062local/tex/fonts
3063local/tex/lib
3064local/tex/bin
3065local/tex/bin/sun3
3066local/tex/bin/sun4
3067local/tex/bin/hp9000
3068...
3069@end example
3070
3071In this example, the subdirectories of @samp{local/tex/bin} should be
3072hidden when accessed via the automount point (conventionally @samp{/vol}).
3073A mount-map for @samp{/vol} to achieve this would look like:
3074
3075@example
3076/defaults   sublink:=$@{/key@};rhost:=fserver;type:=link
3077tex         type:=auto;fs:=$@{map@};pref:=$@{key@}/
3078tex/fonts   host!=fserver;type:=nfs;rfs:=/vol/tex \
3079            host==fserver;fs:=/usr/local/tex
3080tex/lib     host!=fserver;type:=nfs;rfs:=/vol/tex \
3081            host==fserver;fs:=/usr/local/tex
3082tex/bin     -sublink:=$@{/key@}/$@{arch@} host!=fserver;type:=nfs;rfs:=/vol/tex \
3083            host:=fserver;fs:=/usr/local/tex
3084@end example
3085
3086When @samp{/vol/tex/bin} is referenced, the current machine architecture
3087is automatically appended to the path by the @code{$@{sublink@}}
3088variable.  This means that users can have @samp{/vol/tex/bin} in their
3089@samp{PATH} without concern for architecture dependencies.
3090
3091@node     Wildcard Names, rwho servers, Architecture Sharing, Examples
3092@comment  node-name,  next,  previous,  up
3093@section Wildcard names & Replicated Servers
3094
3095By using the wildcard facility, @i{Amd} can @dfn{overlay} an existing
3096directory with additional entries.
3097The system files are usually mounted under @samp{/usr}.  If instead
3098@i{Amd} is mounted on @samp{/usr}, additional
3099names can be overlayed to augment or replace names in the ``master'' @samp{/usr}.
3100A map to do this would have the form:
3101
3102@example
3103local  type:=auto;fs:=local-map
3104share  type:=auto;fs:=share-map
3105*      -type:=nfs;rfs:=/export/exec/$@{arch@};sublink:="$@{key@}" \
3106        rhost:=fserv1  rhost:=fserv2  rhost:=fserv3
3107@end example
3108
3109Note that the assignment to @code{$@{sublink@}} is surrounded by double
3110quotes to prevent the incoming key from causing the map to be
3111misinterpreted.  This map has the effect of directing any access to
3112@samp{/usr/local} or @samp{/usr/share} to another automount point.
3113
3114In this example, it is assumed that the @samp{/usr} files are replicated
3115on three fileservers: @samp{fserv1}, @samp{fserv2} and @samp{fserv3}.
3116For any references other than to @samp{local} and @samp{share} one of
3117the servers is used and a symbolic link to
3118@t{$@{autodir@}/$@{rhost@}/export/exec/$@{arch@}/@i{whatever}} is
3119returned once an appropriate filesystem has been mounted.@refill
3120
3121@node     rwho servers, /vol, Wildcard Names, Examples
3122@comment  node-name,  next,  previous,  up
3123@section @samp{rwho} servers
3124@cindex rwho servers
3125@cindex Architecture specific mounts
3126@cindex Example of architecture specific mounts
3127
3128The @samp{/usr/spool/rwho} directory is a good candidate for automounting.
3129For efficiency reasons it is best to capture the rwho data on a small
3130number of machines and then mount that information onto a large number
3131of clients.  The data written into the rwho files is byte order dependent
3132so only servers with the correct byte ordering can be used by a client:
3133
3134@example
3135/defaults         type:=nfs
3136usr/spool/rwho    -byte==little;rfs:=/usr/spool/rwho \
3137                      rhost:=vaxA  rhost:=vaxB \
3138                  || -rfs:=/usr/spool/rwho \
3139                      rhost:=sun4  rhost:=hp300
3140@end example
3141
3142@node     /vol, , rwho servers, Examples
3143@comment  node-name,  next,  previous,  up
3144@section @samp{/vol}
3145@cindex /vol
3146@cindex Catch-all mount point
3147@cindex Generic volume name
3148
3149@samp{/vol} is used as a catch-all for volumes which do not have other
3150conventional names.
3151
3152Below is part of the @samp{/vol} map for the domain @samp{doc.ic.ac.uk}.
3153The @samp{r+d} tree is used for new or experimental software that needs
3154to be available everywhere without installing it on all the fileservers.
3155Users wishing to try out the new software then simply include
3156@samp{/vol/r+d/@{bin,ucb@}} in their path.@refill
3157
3158The main tree resides on one host @samp{gould.doc.ic.ac.uk}, which has
3159different @samp{bin}, @samp{etc}, @samp{lib} and @samp{ucb}
3160sub-directories for each machine architecture.  For example,
3161@samp{/vol/r+d/bin} for a Sun-4 would be stored in the sub-directory
3162@samp{bin/sun4} of the filesystem @samp{/usr/r+d}.  When it was accessed
3163a symbolic link pointing to @samp{/a/gould/usr/r+d/bin/sun4} would be
3164returned.@refill
3165
3166@example
3167/defaults    type:=nfs;opts:=rw,grpid,nosuid,intr,soft
3168wp           -opts:=rw,grpid,nosuid;rhost:=charm \
3169             host==charm;type:=link;fs:=/usr/local/wp \
3170             host!=charm;type:=nfs;rfs:=/vol/wp
3171...
3172#
3173src          -opts:=rw,grpid,nosuid;rhost:=charm \
3174             host==charm;type:=link;fs:=/usr/src \
3175             host!=charm;type:=nfs;rfs:=/vol/src
3176#
3177r+d          type:=auto;fs:=$@{map@};pref:=r+d/
3178# per architecture bin,etc,lib&ucb...
3179r+d/bin      rhost:=gould.doc.ic.ac.uk;rfs:=/usr/r+d;sublink:=$@{/key@}/$@{arch@}
3180r+d/etc      rhost:=gould.doc.ic.ac.uk;rfs:=/usr/r+d;sublink:=$@{/key@}/$@{arch@}
3181r+d/include  rhost:=gould.doc.ic.ac.uk;rfs:=/usr/r+d;sublink:=$@{/key@}
3182r+d/lib      rhost:=gould.doc.ic.ac.uk;rfs:=/usr/r+d;sublink:=$@{/key@}/$@{arch@}
3183r+d/man      rhost:=gould.doc.ic.ac.uk;rfs:=/usr/r+d;sublink:=$@{/key@}
3184r+d/src      rhost:=gould.doc.ic.ac.uk;rfs:=/usr/r+d;sublink:=$@{/key@}
3185r+d/ucb      rhost:=gould.doc.ic.ac.uk;rfs:=/usr/r+d;sublink:=$@{/key@}/$@{arch@}
3186# hades pictures
3187pictures     -opts:=rw,grpid,nosuid;rhost:=thpfs \
3188             host==thpfs;type:=link;fs:=/nbsd/pictures \
3189             host!=thpfs;type:=nfs;rfs:=/nbsd;sublink:=pictures
3190# hades tools
3191hades        -opts:=rw,grpid,nosuid;rhost:=thpfs \
3192             host==thpfs;type:=link;fs:=/nbsd/hades \
3193             host!=thpfs;type:=nfs;rfs:=/nbsd;sublink:=hades
3194# bsd tools for hp.
3195bsd          -opts:=rw,grpid,nosuid;arch==hp9000;rhost:=thpfs \
3196             host==thpfs;type:=link;fs:=/nbsd/bsd \
3197             host!=thpfs;type:=nfs;rfs:=/nbsd;sublink:=bsd
3198@end example
3199
3200@node     Internals, Acknowledgements & Trademarks, Examples, Top
3201@comment  node-name,  next,  previous,  up
3202@chapter Internals
3203
3204@menu
3205* Log Messages::
3206@end menu
3207
3208@node     Log Messages, , Internals, Internals
3209@comment  node-name,  next,  previous,  up
3210@section Log Messages
3211
3212In the following sections a brief explanation is given of some of the
3213log messages made by @i{Amd}.  Where the message is in @samp{typewriter}
3214font, it corresponds exactly to the message produced by @i{Amd}.  Words
3215in @dfn{italic} are replaced by an appropriate string.  Variables,
3216@code{$@{var@}}, indicate that the value of the appropriate variable is
3217output.
3218
3219Log messages are either sent direct to a file,
3220or logged via the @b{syslog}(3) mechanism.
3221Messages are logged with facility @samp{LOG_DAEMON} when using @b{syslog}(3).
3222In either case, entries in the file are of the form:
3223@example
3224@i{date-string}  @i{hostname} @t{amd[}@i{pid}@t{]}  @i{message}
3225@end example
3226
3227@menu
3228* Fatal errors::
3229* Info messages::
3230@end menu
3231
3232@node     Fatal errors, Info messages, Log Messages, Log Messages
3233@comment  node-name,  next,  previous,  up
3234@subsection Fatal errors
3235
3236@i{Amd} attempts to deal with unusual events.  Whenever it is not
3237possible to deal with such an error, @i{Amd} will log an appropriate
3238message and, if it cannot possibly continue, will either exit or abort.
3239These messages are selected by @samp{-x fatal} on the command line.
3240When @b{syslog}(3) is being used, they are logged with level
3241@samp{LOG_FATAL}.  Even if @i{Amd} continues to operate it is likely to
3242remain in a precarious state and should be restarted at the earliest
3243opportunity.
3244
3245@table @asis
3246@item @t{Attempting to inherit not-a-filesystem}
3247The prototype mount point created during a filesystem restart did not
3248contain a reference to the restarted filesystem.  This erorr ``should
3249never happen''.
3250
3251@item @t{Can't bind to domain "@i{NIS-domain}"}
3252A specific NIS domain was requested on the command line, but no server
3253for that domain is available on the local net.
3254
3255@item @t{Can't determine IP address of this host (@i{hostname})}
3256When @i{Amd} starts it determines its own IP address.  If this lookup
3257fails then @i{Amd} cannot continue.  The hostname it looks up is that
3258obtained returned by @b{gethostname}(2) system call.
3259
3260@item @t{Can't find root file handle for @i{automount point}}
3261@i{Amd} creates its own file handles for the automount points.  When it
3262mounts itself as a server, it must pass these file handles to the local
3263kernel.  If the filehandle is not obtainable the mount point is ignored.
3264This error ``should never happen''.
3265
3266@item @t{Must be root to mount filesystems (euid = @i{euid})}
3267To prevent embarrassment, @i{Amd} makes sure it has appropriate system
3268privileges.  This amounts to having an euid of 0.  The check is made
3269after argument processing complete to give non-root users a chance to
3270access the ``-v'' option.
3271
3272@item @t{No work to do - quitting}
3273No automount points were given on the command line and so there is no
3274work to do.
3275
3276@item @t{Out of memory in realloc}
3277While attempting to realloc some memory, the memory space available to
3278@i{Amd} was exhausted.  This is an unrecoverable error.
3279
3280@item @t{Out of memory}
3281While attempting to malloc some memory, the memory space available to
3282@i{Amd} was exhausted.  This is an unrecoverable error.
3283
3284@item @t{cannot create rpc/udp service}
3285Either the NFS or AMQ endpoint could not be created.
3286
3287@item @t{gethostname:} @i{description}
3288The @b{gethostname}(2) system call failed during startup.
3289
3290@item @t{host name is not set}
3291The @b{gethostname}(2) system call returned a zero length host name.
3292This can happen if @i{Amd} is started in single user mode just after
3293booting the system.
3294
3295@item @t{ifs_match called!}
3296An internal error occurred while restarting a pre-mounted filesystem.
3297This error ``should never happen''.
3298
3299@item @t{mount_afs:} @i{description}
3300An error occured while @i{Amd} was mounting itself.
3301
3302@item @t{run_rpc failed}
3303Somehow the main NFS server loop failed.  This error ``should never
3304happen''.
3305
3306@item @t{unable to free rpc arguments in amqprog_1}
3307The incoming arguments to the AMQ server could not be free'ed.
3308
3309@item @t{unable to free rpc arguments in nfs_program_1}
3310The incoming arguments to the NFS server could not be free'ed.
3311
3312@item @t{unable to register (AMQ_PROGRAM, AMQ_VERSION, udp)}
3313The AMQ server could not be registered with the local portmapper or the
3314internal RPC dispatcher.
3315
3316@item @t{unable to register (NFS_PROGRAM, NFS_VERSION, 0)}
3317The NFS server could not be registered with the internal RPC dispatcher.
3318
3319@end table
3320
3321@node     Info messages, , Fatal errors, Log Messages
3322@comment  node-name,  next,  previous,  up
3323@subsection Info messages
3324
3325@i{Amd} generates information messages to record state changes.  These
3326messages are selected by @samp{-x info} on the command line.  When
3327@b{syslog}(3) is being used, they are logged with level @samp{LOG_INFO}.
3328
3329The messages listed below can be generated and are in a format suitable
3330for simple statistical analysis.  @dfn{mount-info} is the string
3331that is displayed by @dfn{Amq} in its mount information column and
3332placed in the system mount table.
3333
3334@table @asis
3335@item @t{mount of "@t{$@{@i{path}@}}" on @t{$@{@i{fs}@}} timed out}
3336Attempts to mount a filesystem for the given automount point have failed
3337to complete within 30 seconds.
3338
3339@item @t{"@t{$@{@i{path}@}}" forcibly timed out}
3340An automount point has been timed out by the @i{Amq} command.
3341
3342@item @t{restarting @i{mount-info} on @t{$@{@i{fs}@}}}
3343A pre-mounted file system has been noted.
3344
3345@item @t{"@t{$@{@i{path}@}}" has timed out}
3346No access to the automount point has been made within the timeout
3347period.
3348
3349@item @t{file server @t{$@{@i{rhost}@}} is down - timeout of "@t{$@{@i{path}@}}" ignored}
3350An automount point has timed out, but the corresponding file server is
3351known to be down.  This message is only produced once for each mount
3352point for which the server is down.
3353
3354@item @t{Re-synchronizing cache for map @t{$@{@i{map}@}}}
3355The named map has been modified and the internal cache is being re-synchronized.
3356
3357@item @t{Filehandle denied for "@t{$@{@i{rhost}@}}:@t{$@{@i{rfs}@}}"}
3358The mount daemon refused to return a file handle for the requested filesystem.
3359
3360@item @t{Filehandle error for "$@{@i{rhost}@}:$@{@i{rfs}@}":} @i{description}
3361The mount daemon gave some other error for the requested filesystem.
3362
3363@item @t{file server @t{$@{@i{rhost}@}} type nfs starts up}
3364A new NFS file server has been referenced and is known to be up.
3365
3366@item @t{file server @t{$@{@i{rhost}@}} type nfs starts down}
3367A new NFS file server has been referenced and is known to be down.
3368
3369@item @t{file server @t{$@{@i{rhost}@}} type nfs is up}
3370An NFS file server that was previously down is now up.
3371
3372@item @t{file server @t{$@{@i{rhost}@}} type nfs is down}
3373An NFS file server that was previously up is now down.
3374
3375@item @t{Finishing with status @i{exit-status}}
3376@i{Amd} is about to exit with the given exit status.
3377
3378@item @t{@i{mount-info} mounted fstype @t{$@{@i{type}@}} on @t{$@{@i{fs}@}}}
3379A new file system has been mounted.
3380
3381@item @t{@i{mount-info} restarted fstype @t{$@{@i{type}@}} on @t{$@{@i{fs}@}}}
3382@i{Amd} is using a pre-mounted filesystem to satisfy a mount request.
3383
3384@item @t{@i{mount-info} unmounted fstype @t{$@{@i{type}@}} from @t{$@{@i{fs}@}}}
3385A file system has been unmounted.
3386
3387@item @t{@i{mount-info} unmounted fstype @t{$@{@i{type}@}} from @t{$@{@i{fs}@}} link @t{$@{@i{fs}@}}/@t{$@{@i{sublink}@}}}
3388A file system of which only a sub-directory was in use has been unmounted.
3389
3390@end table
3391
3392@node     Acknowledgements & Trademarks, Index, Internals, Top
3393@comment  node-name,  next,  previous,  up
3394@unnumbered Acknowledgements & Trademarks
3395
3396Thanks to the Formal Methods Group at Imperial College for
3397suffering patiently while @i{Amd} was being developed on their machines.
3398
3399Thanks to the many people who have helped with the development of
3400@i{Amd}, especially Piete Brooks at the Cambridge University Computing
3401Lab for many hours of testing, experimentation and discussion.
3402
3403@itemize @bullet
3404@item
3405@b{DEC}, @b{VAX} and @b{Ultrix} are registered trademarks of Digital
3406Equipment Corporation.
3407@item
3408@b{AIX} and @b{IBM} are registered trademarks of International Business
3409Machines Corporation.
3410@item
3411@b{Sun}, @b{NFS} and @b{SunOS} are registered trademarks of Sun
3412Microsystems, Inc.
3413@item
3414@b{Unix} is a registered trademark of AT&T Unix Systems Laboratories
3415in the USA and other countries.
3416@end itemize
3417
3418@node Index, Intro, Acknowledgements & Trademarks, Top
3419@comment  node-name,  next,  previous,  up
3420@unnumbered Index
3421
3422@printindex cp
3423
3424@contents
3425@bye
3426