am-utils.texi revision 52894
1\input texinfo          @c -*-texinfo-*-
2@c
3@c Copyright (c) 1997-1999 Erez Zadok
4@c Copyright (c) 1989 Jan-Simon Pendry
5@c Copyright (c) 1989 Imperial College of Science, Technology & Medicine
6@c Copyright (c) 1989 The Regents of the University of California.
7@c All rights reserved.
8@c
9@c This code is derived from software contributed to Berkeley by
10@c Jan-Simon Pendry at Imperial College, London.
11@c
12@c Redistribution and use in source and binary forms, with or without
13@c modification, are permitted provided that the following conditions
14@c are met:
15@c 1. Redistributions of source code must retain the above copyright
16@c    notice, this list of conditions and the following disclaimer.
17@c 2. Redistributions in binary form must reproduce the above copyright
18@c    notice, this list of conditions and the following disclaimer in the
19@c    documentation and/or other materials provided with the distribution.
20@c 3. All advertising materials mentioning features or use of this software
21@c    must display the following acknowledgment:
22@c      This product includes software developed by the University of
23@c      California, Berkeley and its contributors.
24@c 4. Neither the name of the University nor the names of its contributors
25@c    may be used to endorse or promote products derived from this software
26@c    without specific prior written permission.
27@c
28@c THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
29@c ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
30@c IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
31@c ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
32@c FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
33@c DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
34@c OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
35@c HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
36@c LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
37@c OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
38@c
39@c      %W% (Berkeley) %G%
40@c
41@c $Id: am-utils.texi,v 1.12 1999/09/30 21:01:39 ezk Exp $
42@c
43@setfilename am-utils.info
44
45@include version.texi
46
47@c info directory entry
48@direntry
49* Am-utils: (am-utils).          The Amd automounter suite of utilities
50@end direntry
51
52@settitle
53@setchapternewpage odd
54
55@titlepage
56@title Am-utils (4.4BSD Automounter Utilities)
57@subtitle For version @value{VERSION}, @value{UPDATED}
58
59@author Erez Zadok
60(Originally by Jan-Simon Pendry and Nick Williams)
61
62@page
63Copyright @copyright{} 1997-1999 Erez Zadok
64@*
65Copyright @copyright{} 1989 Jan-Simon Pendry
66@*
67Copyright @copyright{} 1989 Imperial College of Science, Technology & Medicine
68@*
69Copyright @copyright{} 1989 The Regents of the University of California.
70@sp
71All Rights Reserved.
72@vskip 1ex
73Permission to copy this document, or any portion of it, as
74necessary for use of this software is granted provided this
75copyright notice and statement of permission are included.
76@end titlepage
77@page
78
79@c Define a new index for options.
80@syncodeindex pg cp
81@syncodeindex vr cp
82
83@ifinfo
84
85@c ################################################################
86@node Top, License, , (DIR)
87Am-utils - The 4.4BSD Automounter Tool Suite
88*********************************************
89
90Am-utils is the 4.4BSD Automounter Tool Suite, which includes the Amd
91automounter, the Amq query and control program, the Hlfsd daemon, and
92other tools.  This Info file describes how to use and understand the
93tools within Am-utils.
94@end ifinfo
95
96@menu
97* License::                  Explains the terms and conditions for using
98                             and distributing Am-utils.
99* Distrib::                  How to get the latest Am-utils distribution.
100* Intro::                    An introduction to Automounting concepts.
101* History::                  History of am-utils' development.
102* Overview::                 An overview of Amd.
103* Supported Platforms::      Machines and Systems supported by Amd.
104* Mount Maps::               Details of mount maps
105* Amd Command Line Options:: All the Amd command line options explained. 
106* Filesystem Types::         The different mount types supported by Amd.
107* Amd Configuration File::   The amd.conf file syntax and meaning.
108* Run-time Administration::  How to start, stop and control Amd.
109* FSinfo::                   The FSinfo filesystem management tool.
110* Hlfsd::                    The Home-Link Filesystem server.
111* Assorted Tools::           Other tools which come with am-utils.
112* Examples::                 Some examples showing how Amd might be used.
113* Internals::                Implementation details.
114* Acknowledgments & Trademarks:: Legal Notes
115
116Indexes
117* Index::                    An item for each concept.
118@end menu
119
120@iftex
121@unnumbered Preface
122
123This manual documents the use of the 4.4BSD automounter tool suite,
124which includes @i{Amd}, @i{Amq}, @i{Hlfsd}, and other programs.  This is
125primarily a reference manual.  While no tutorial exists, there are
126examples available.  @xref{Examples}.
127
128This manual comes in two forms: the published form and the Info form.
129The Info form is for on-line perusal with the INFO program which is
130distributed along with GNU texinfo package (a version of which is
131available for GNU Emacs).@footnote{GNU packages can be found in
132@url{ftp://ftp.gnu.org/pub/gnu/}.}  Both forms contain substantially
133the same text and are generated from a common source file, which is
134distributed with the @i{Am-utils} source.
135@end iftex
136
137@c ################################################################
138@node License, Distrib, Top, Top
139@unnumbered License
140@cindex License Information
141
142@i{Am-utils} is not in the public domain; it is copyrighted and there are
143restrictions on its distribution.
144
145Redistribution and use in source and binary forms, with or without
146modification, are permitted provided that the following conditions are
147met:
148
149@enumerate
150
151@item
152Redistributions of source code must retain the above copyright notice,
153this list of conditions and the following disclaimer.
154
155@item
156Redistributions in binary form must reproduce the above copyright
157notice, this list of conditions and the following disclaimer in the
158documentation and/or other materials provided with the distribution.
159
160@item
161All advertising materials mentioning features or use of this software
162must display the following acknowledgment:
163
164@cartouche
165``This product includes software developed by the University of
166California, Berkeley and its contributors, as well as the Trustees of
167Columbia University.''
168@end cartouche
169
170@item
171Neither the name of the University nor the names of its contributors may
172be used to endorse or promote products derived from this software
173without specific prior written permission.
174
175@end enumerate
176
177THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
178ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
179IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
180PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS
181BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
182CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
183SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
184INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
185CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
186ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
187THE POSSIBILITY OF SUCH DAMAGE.
188
189@c ################################################################
190@node Distrib, Intro, License, Top
191@unnumbered Source Distribution
192@cindex Source code distribution
193@cindex Obtaining the source code
194
195The @i{Am-utils} home page is located in
196@example
197@url{http://www.cs.columbia.edu/~ezk/am-utils/}
198@end example
199
200You can get the latest distribution version of @i{Am-utils} from
201@example
202@url{ftp://shekel.mcl.cs.columbia.edu/pub/am-utils/am-utils.tar.gz}
203@end example
204
205Alpha and beta distributions are available in
206@example
207@url{ftp://shekel.mcl.cs.columbia.edu/pub/am-utils/}.
208@end example
209
210Revision 5.2 was part of the 4.3BSD Reno distribution.
211
212Revision 5.3bsdnet, a late alpha version of 5.3, was part
213of the BSD network version 2 distribution
214
215Revision 6.0 was made independently by @email{ezk@@cs.columbia.edu,Erez
216Zadok} at the @uref{http://www.cs.columbia.edu/,Computer Science
217Department} of @uref{http://www.columbia.edu/,Columbia University}, as
218part of his @uref{http://www.cs.columbia.edu/~ezk/research/tp/thesis_proposal.html,PhD thesis work}. @xref{History}, for more details.
219
220@unnumberedsec Bug Reports
221@cindex Bug reports
222
223Before reporting a bug, see if it is a known one in the
224@uref{http://www.cs.columbia.edu/~ezk/am-utils/BUGS.txt,bugs} file.
225Send all bug reports to @email{amd-dev@@majordomo.cs.columbia.edu}
226quoting the details of the release and your configuration.  These can be
227obtained by running the command @samp{amd -v}.  It would greatly help if
228you could provide a reproducible procedure for detecting the bug you are
229reporting.
230
231Providing working patches is highly encouraged.  Every patch
232incorporated, however small, will get its author an honorable mention in
233the @uref{http://www.cs.columbia.edu/~ezk/am-utils/AUTHORS.txt,authors
234file}.
235
236@unnumberedsec Mailing List
237@cindex Mailing list
238
239There are two mailing lists for people interested in keeping up-to-date
240with developments.
241
242@c ###############
243
244@enumerate
245
246@item
247The older list, @samp{amd-workers} is for general "how to" questions and
248announcements.  To subscribe, send a note to
249@email{amd-workers-request@@majordomo.glue.umd.edu}.@footnote{Note that
250the older address, @email{amd-workers-request@@acl.lanl.gov}, is
251defunct.}  To post a message to this list, send mail to
252@email{amd-workers@@majordomo.glue.umd.edu}.
253
254@item
255The developers only list, @samp{amd-dev} is for
256
257@itemize @minus
258@item
259announcements of alpha and beta releases of am-utils
260@item
261reporting of bugs and patches
262@item
263discussions of new features for am-utils
264@item
265implementation and porting issues
266@end itemize
267
268To subscribe, send a note to @email{majordomo@@majordomo.cs.columbia.edu}
269with the single body text line @samp{subscribe amd-dev}.  To post a
270message to this list, send mail to
271@email{amd-dev@@majordomo.cs.columbia.edu}.  To avoid as much spam as
272possible, only subscribers to this list may post to it.
273
274Subscribers of @samp{amd-dev} are most suitable if they have the time
275and resources to test new and buggy versions of amd, on as many
276different platforms as possible.  They should also be prepared to learn
277and use the GNU Autoconf, Automake, and Libtool packages, and of course,
278be very familiar with the complex code in the am-utils package.  In
279other words, subscribers on this list should be able to contribute
280meaningfully to the development of amd.
281
282@end enumerate
283
284@c ################################################################
285@node Intro, History, Distrib, Top
286@unnumbered Introduction
287@cindex Introduction
288
289An @dfn{automounter} maintains a cache of mounted filesystems.
290Filesystems are mounted on demand when they are first referenced,
291and unmounted after a period of inactivity.
292
293@i{Amd} may be used as a replacement for Sun's automounter.  The choice
294of which filesystem to mount can be controlled dynamically with
295@dfn{selectors}.  Selectors allow decisions of the form ``hostname is
296@var{this},'' or ``architecture is not @var{that}.''  Selectors may be
297combined arbitrarily.  @i{Amd} also supports a variety of filesystem
298types, including NFS, UFS and the novel @dfn{program} filesystem.  The
299combination of selectors and multiple filesystem types allows identical
300configuration files to be used on all machines thus reducing the
301administrative overhead.
302
303@i{Amd} ensures that it will not hang if a remote server goes down.
304Moreover, @i{Amd} can determine when a remote server has become
305inaccessible and then mount replacement filesystems as and when they
306become available.
307
308@i{Amd} contains no proprietary source code and has been ported to
309numerous flavors of Unix.
310
311@c ################################################################
312@node History, Overview, Intro, Top
313@unnumbered History
314@cindex History
315
316The @i{Amd} package has been without an official maintainer since 1992.
317Several people have stepped in to maintain it unofficially.  Most
318notable were the `upl' (Unofficial Patch Level) releases of @i{Amd},
319created by me (@email{ezk@@cs.columbia.edu,Erez Zadok}), and available from
320@url{ftp://ftp.cs.columbia.edu/pub/amd/}.  The last such unofficial
321release was `upl102'.
322
323Through the process of patching and aging, it was becoming more and more
324apparent that @i{Amd} was in much need of revitalizing.  Maintaining
325@i{Amd} had become a difficult task.  I took it upon myself to cleanup
326the code, so that it would be easier to port to new platforms, add new
327features, keep up with the many new feature requests, and deal with the
328never ending stream of bug reports.
329
330I have been working on such a release of @i{Amd} on and off since
331January of 1996.  The new suite of tools is currently named "am-utils"
332(AutoMounter Utilities), in line with GNU naming conventions, befitting
333the contents of the package.  In October of 1996 I had received enough
334offers to help me with this task that I decided to make a mailing list
335for this group of people.  Around the same time, @i{Amd} had become a
336necessary part of my PhD thesis work, resulting in more work performed
337on am-utils.
338
339Am-utils version 6.0 was numbered with a major new release number to
340distinguish it from the last official release of @i{Amd} (5.x).  Many
341new features have been added such as a GNU @code{configure} system, NFS
342Version 3, Autofs support, a run-time configuration file (`amd.conf'),
343many new ports, more scripts and programs, as well as numerous bug
344fixes.  Another reason for the new major release number was to alert
345users of am-utils that user-visible interfaces may have changed.  In
346order to make @i{Amd} work well for the next 10 years, and be easier to
347maintain, it was necessary to remove old or unused features, change
348various syntax files, etc.  However, great care was taken to ensure the
349maximum possible backwards compatibility.
350
351@c ################################################################
352@node Overview, Supported Platforms, History, Top
353@chapter Overview
354
355@i{Amd} maintains a cache of mounted filesystems.  Filesystems are
356@dfn{demand-mounted} when they are first referenced, and unmounted after
357a period of inactivity.  @i{Amd} may be used as a replacement for Sun's
358@b{automount}(8) program.  It contains no proprietary source code and
359has been ported to numerous flavors of Unix.  @xref{Supported
360Platforms}.@refill
361
362@i{Amd} was designed as the basis for experimenting with filesystem
363layout and management.  Although @i{Amd} has many direct applications it
364is loaded with additional features which have little practical use.  At
365some point the infrequently used components may be removed to streamline
366the production system.
367
368@c @i{Amd} supports the notion of @dfn{replicated} filesystems by evaluating
369@c each member of a list of possible filesystem locations in parallel.
370@c @i{Amd} checks that each cached mapping remains valid.  Should a mapping be
371@c lost -- such as happens when a fileserver goes down -- @i{Amd} automatically
372@c selects a replacement should one be available.
373@c
374@menu
375* Fundamentals::
376* Filesystems and Volumes::
377* Volume Naming::
378* Volume Binding::
379* Operational Principles::
380* Mounting a Volume::
381* Automatic Unmounting::
382* Keep-alives::
383* Non-blocking Operation::
384@end menu
385
386@node Fundamentals, Filesystems and Volumes, Overview, Overview
387@comment  node-name,  next,  previous,  up
388@section Fundamentals
389@cindex Automounter fundamentals
390
391The fundamental concept behind @i{Amd} is the ability to separate the
392name used to refer to a file from the name used to refer to its physical
393storage location.  This allows the same files to be accessed with the
394same name regardless of where in the network the name is used.  This is
395very different from placing @file{/n/hostname} in front of the pathname
396since that includes location dependent information which may change if
397files are moved to another machine.
398
399By placing the required mappings in a centrally administered database,
400filesystems can be re-organized without requiring changes to
401configuration files, shell scripts and so on.
402
403@node Filesystems and Volumes, Volume Naming, Fundamentals, Overview
404@comment  node-name,  next,  previous,  up
405@section Filesystems and Volumes
406@cindex Filesystem
407@cindex Volume
408@cindex Fileserver
409@cindex sublink
410
411@i{Amd} views the world as a set of fileservers, each containing one or
412more filesystems where each filesystem contains one or more
413@dfn{volumes}.  Here the term @dfn{volume} is used to refer to a
414coherent set of files such as a user's home directory or a @TeX{}
415distribution.@refill
416
417In order to access the contents of a volume, @i{Amd} must be told in
418which filesystem the volume resides and which host owns the filesystem.
419By default the host is assumed to be local and the volume is assumed to
420be the entire filesystem.  If a filesystem contains more than one
421volume, then a @dfn{sublink} is used to refer to the sub-directory
422within the filesystem where the volume can be found.
423
424@node Volume Naming, Volume Binding, Filesystems and Volumes, Overview
425@comment  node-name,  next,  previous,  up
426@section Volume Naming
427@cindex Volume names
428@cindex Network-wide naming
429@cindex Replicated volumes
430@cindex Duplicated volumes
431@cindex Replacement volumes
432
433Volume names are defined to be unique across the entire network.  A
434volume name is the pathname to the volume's root as known by the users
435of that volume.  Since this name uniquely identifies the volume
436contents, all volumes can be named and accessed from each host, subject
437to administrative controls.
438
439Volumes may be replicated or duplicated.  Replicated volumes contain
440identical copies of the same data and reside at two or more locations in
441the network.  Each of the replicated volumes can be used
442interchangeably.  Duplicated volumes each have the same name but contain
443different, though functionally identical, data.  For example,
444@samp{/vol/tex} might be the name of a @TeX{} distribution which varied
445for each machine architecture.@refill
446
447@i{Amd} provides facilities to take advantage of both replicated and
448duplicated volumes.  Configuration options allow a single set of
449configuration data to be shared across an entire network by taking
450advantage of replicated and duplicated volumes.
451
452@i{Amd} can take advantage of replacement volumes by mounting them as
453required should an active fileserver become unavailable.
454
455@node Volume Binding, Operational Principles, Volume Naming, Overview
456@comment  node-name,  next,  previous,  up
457@section Volume Binding
458@cindex Volume binding
459@cindex Unix namespace
460@cindex Namespace
461@cindex Binding names to filesystems
462
463Unix implements a namespace of hierarchically mounted filesystems.  Two
464forms of binding between names and files are provided.  A @dfn{hard
465link} completes the binding when the name is added to the filesystem.  A
466@dfn{soft link} delays the binding until the name is accessed.  An
467@dfn{automounter} adds a further form in which the binding of name to
468filesystem is delayed until the name is accessed.@refill
469
470The target volume, in its general form, is a tuple (host, filesystem,
471sublink) which can be used to name the physical location of any volume
472in the network.
473
474When a target is referenced, @i{Amd} ignores the sublink element and
475determines whether the required filesystem is already mounted.  This is
476done by computing the local mount point for the filesystem and checking
477for an existing filesystem mounted at the same place.  If such a
478filesystem already exists then it is assumed to be functionally
479identical to the target filesystem.  By default there is a one-to-one
480mapping between the pair (host, filesystem) and the local mount point so
481this assumption is valid.
482
483@node Operational Principles, Mounting a Volume, Volume Binding, Overview
484@comment  node-name,  next,  previous,  up
485@section Operational Principles
486@cindex Operational principles
487
488@i{Amd} operates by introducing new mount points into the namespace.
489These are called @dfn{automount} points.  The kernel sees these
490automount points as NFS filesystems being served by @i{Amd}.  Having
491attached itself to the namespace, @i{Amd} is now able to control the
492view the rest of the system has of those mount points.  RPC calls are
493received from the kernel one at a time.
494
495When a @dfn{lookup} call is received @i{Amd} checks whether the name is
496already known.  If it is not, the required volume is mounted.  A
497symbolic link pointing to the volume root is then returned.  Once the
498symbolic link is returned, the kernel will send all other requests
499direct to the mounted filesystem.
500
501If a volume is not yet mounted, @i{Amd} consults a configuration
502@dfn{mount-map} corresponding to the automount point.  @i{Amd} then
503makes a runtime decision on what and where to mount a filesystem based
504on the information obtained from the map.
505
506@i{Amd} does not implement all the NFS requests; only those relevant
507to name binding such as @dfn{lookup}, @dfn{readlink} and @dfn{readdir}.
508Some other calls are also implemented but most simply return an error
509code; for example @dfn{mkdir} always returns ``read-only filesystem''.
510
511@node Mounting a Volume, Automatic Unmounting, Operational Principles, Overview
512@comment  node-name,  next,  previous,  up
513@section Mounting a Volume
514@cindex Mounting a volume
515@cindex Location lists
516@cindex Alternate locations
517@cindex Mount retries
518@cindex Background mounts
519
520Each automount point has a corresponding mount map.  The mount map
521contains a list of key--value pairs.  The key is the name of the volume
522to be mounted.  The value is a list of locations describing where the
523filesystem is stored in the network.  In the source for the map the
524value would look like
525
526@display
527location1  location2  @dots{}  locationN
528@end display
529
530@i{Amd} examines each location in turn.  Each location may contain
531@dfn{selectors} which control whether @i{Amd} can use that location.
532For example, the location may be restricted to use by certain hosts.
533Those locations which cannot be used are ignored.
534
535@i{Amd} attempts to mount the filesystem described by each remaining
536location until a mount succeeds or @i{Amd} can no longer proceed.  The
537latter can occur in three ways:
538
539@itemize @bullet
540@item
541If none of the locations could be used, or if all of the locations
542caused an error, then the last error is returned.
543
544@item
545If a location could be used but was being mounted in the background then
546@i{Amd} marks that mount as being ``in progress'' and continues with
547the next request; no reply is sent to the kernel.
548
549@item
550Lastly, one or more of the mounts may have been @dfn{deferred}.  A mount
551is deferred if extra information is required before the mount can
552proceed.  When the information becomes available the mount will take
553place, but in the mean time no reply is sent to the kernel.  If the
554mount is deferred, @i{Amd} continues to try any remaining locations.
555@end itemize
556
557Once a volume has been mounted, @i{Amd} establishes a @dfn{volume
558mapping} which is used to satisfy subsequent requests.@refill
559
560@node Automatic Unmounting, Keep-alives, Mounting a Volume, Overview
561@comment  node-name,  next,  previous,  up
562@section Automatic Unmounting
563
564To avoid an ever increasing number of filesystem mounts, @i{Amd} removes
565volume mappings which have not been used recently.  A time-to-live
566interval is associated with each mapping and when that expires the
567mapping is removed.  When the last reference to a filesystem is removed,
568that filesystem is unmounted.  If the unmount fails, for example the
569filesystem is still busy, the mapping is re-instated and its
570time-to-live interval is extended.  The global default for this grace
571period is controlled by the @code{-w} command-line option (@pxref{-w
572Option, -w}) or the @i{amd.conf} parameter @samp{dismount_interval}
573(@pxref{dismount_interval Parameter}).  It is also possible to set this
574value on a per-mount basis (@pxref{opts Option, opts, opts}).
575
576Filesystems can be forcefully timed out using the @i{Amq} command.
577@xref{Run-time Administration}.
578
579@node Keep-alives, Non-blocking Operation, Automatic Unmounting, Overview
580@comment  node-name,  next,  previous,  up
581@section Keep-alives
582@cindex Keep-alives
583@cindex Server crashes
584@cindex NFS ping
585
586Use of some filesystem types requires the presence of a server on
587another machine.  If a machine crashes then it is of no concern to
588processes on that machine that the filesystem is unavailable.  However,
589to processes on a remote host using that machine as a fileserver this
590event is important.  This situation is most widely recognized when an
591NFS server crashes and the behavior observed on client machines is that
592more and more processes hang.  In order to provide the possibility of
593recovery, @i{Amd} implements a @dfn{keep-alive} interval timer for some
594filesystem types.  Currently only NFS makes use of this service.
595
596The basis of the NFS keep-alive implementation is the observation that
597most sites maintain replicated copies of common system data such as
598manual pages, most or all programs, system source code and so on.  If
599one of those servers goes down it would be reasonable to mount one of
600the others as a replacement.
601
602The first part of the process is to keep track of which fileservers are
603up and which are down.  @i{Amd} does this by sending RPC requests to the
604servers' NFS @code{NullProc} and checking whether a reply is returned.
605While the server state is uncertain the requests are re-transmitted at
606three second intervals and if no reply is received after four attempts
607the server is marked down.  If a reply is received the fileserver is
608marked up and stays in that state for 30 seconds at which time another
609NFS ping is sent.
610
611Once a fileserver is marked down, requests continue to be sent every 30
612seconds in order to determine when the fileserver comes back up.  During
613this time any reference through @i{Amd} to the filesystems on that
614server fail with the error ``Operation would block''.  If a replacement
615volume is available then it will be mounted, otherwise the error is
616returned to the user.
617
618@c @i{Amd} keeps track of which servers are up and which are down.
619@c It does this by sending RPC requests to the servers' NFS {\sc NullProc} and
620@c checking whether a reply is returned.  If no replies are received after a
621@c short period, @i{Amd} marks the fileserver @dfn{down}.
622@c RPC requests continue to be sent so that it will notice when a fileserver
623@c comes back up.
624@c ICMP echo packets \cite{rfc:icmp} are not used because it is the availability
625@c of the NFS service that is important, not the existence of a base kernel.
626@c Whenever a reference to a fileserver which is down is made via @i{Amd}, an alternate
627@c filesystem is mounted if one is available.
628@c
629Although this action does not protect user files, which are unique on
630the network, or processes which do not access files via @i{Amd} or
631already have open files on the hung filesystem, it can prevent most new
632processes from hanging.
633
634By default, fileserver state is not maintained for NFS/TCP mounts.  The
635remote fileserver is always assumed to be up.
636@c
637@c With a suitable combination of filesystem management and mount-maps,
638@c machines can be protected against most server downtime.  This can be
639@c enhanced by allocating boot-servers dynamically which allows a diskless
640@c workstation to be quickly restarted if necessary.  Once the root filesystem
641@c is mounted, @i{Amd} can be started and allowed to mount the remainder of
642@c the filesystem from whichever fileservers are available.
643
644@node Non-blocking Operation, , Keep-alives, Overview
645@comment  node-name,  next,  previous,  up
646@section Non-blocking Operation
647@cindex Non-blocking operation
648@cindex Multiple-threaded server
649@cindex RPC retries
650
651Since there is only one instance of @i{Amd} for each automount point,
652and usually only one instance on each machine, it is important that it
653is always available to service kernel calls.  @i{Amd} goes to great
654lengths to ensure that it does not block in a system call.  As a last
655resort @i{Amd} will fork before it attempts a system call that may block
656indefinitely, such as mounting an NFS filesystem.  Other tasks such as
657obtaining filehandle information for an NFS filesystem, are done using a
658purpose built non-blocking RPC library which is integrated with
659@i{Amd}'s task scheduler.  This library is also used to implement NFS
660keep-alives (@pxref{Keep-alives}).
661
662Whenever a mount is deferred or backgrounded, @i{Amd} must wait for it
663to complete before replying to the kernel.  However, this would cause
664@i{Amd} to block waiting for a reply to be constructed.  Rather than do
665this, @i{Amd} simply @dfn{drops} the call under the assumption that the
666kernel RPC mechanism will automatically retry the request.
667
668@c ################################################################
669@node Supported Platforms, Mount Maps, Overview, Top
670@comment  node-name,  next,  previous,  up
671@chapter Supported Platforms
672@cindex Supported Platforms
673@cindex shared libraries
674@cindex NFS V.3 support
675
676@i{Am-utils} has been ported to a wide variety of machines and operating
677systems.  @i{Am-utils}'s code works for little-endian and big-endian
678machines, as well as 32 bit and 64 bit architectures.  Furthermore, when
679@i{Am-utils} ports to an Operating System on one architecture, it is generally
680readily portable to the same Operating System on all platforms on which
681it is available.
682
683The table below lists those platforms supported by the latest release.
684The listing is based on the standard output from GNU's
685@code{config.guess} script.  Since significant changes have been made to
686am-utils, not all systems listed here have been verified working for all
687features.
688
689@multitable {Auto-Configured System Name} {Config} {Compile} {Amd} {NFS3} {Shlib} {Hlfsd}
690@c @multitable @columnfractions .5 .1 .1 .1 .1 .1
691
692@item @b{Auto-Configured System Name}
693@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
694@tab @b{Config} @tab @b{Compile} @tab @b{Amd} @tab @b{NFS3} @tab @b{Shlib} @tab @b{Hlfsd}
695
696@item @b{alpha-dec-osf2.1}
697@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
698@tab yes     @tab yes   @tab yes  @tab ?     @tab no   @tab ?
699
700@item @b{alpha-dec-osf4.0}
701@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
702@tab yes     @tab yes   @tab yes  @tab yes   @tab yes  @tab ?
703
704@item @b{alphaev5-unknown-linux-gnu}
705@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
706@tab yes     @tab yes   @tab yes  @tab n/a   @tab yes  @tab ?
707
708@item @b{alphaev5-unknown-linux-gnu-rh5.2}
709@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
710@tab yes     @tab yes   @tab yes  @tab n/a   @tab yes  @tab ?
711
712@item @b{hppa1.0-hp-hpux11.00}
713@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
714@tab yes     @tab yes   @tab yes  @tab no    @tab yes  @tab ?
715
716@item @b{hppa1.1-hp-hpux10.10}
717@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
718@tab yes     @tab yes   @tab yes  @tab n/a   @tab no   @tab ?
719
720@item @b{hppa1.1-hp-hpux10.20}
721@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
722@tab yes     @tab yes   @tab yes  @tab no    @tab no   @tab ?
723
724@item @b{hppa1.1-hp-hpux9.01}
725@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
726@tab yes     @tab yes   @tab yes  @tab n/a   @tab yes  @tab ?
727
728@item @b{hppa1.1-hp-hpux9.05}
729@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
730@tab yes     @tab yes   @tab yes  @tab n/a   @tab yes  @tab ?
731
732@item @b{hppa1.1-hp-hpux9.07}
733@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
734@tab yes     @tab yes   @tab yes  @tab n/a   @tab yes  @tab ?
735
736@item @b{hppa2.0w-hp-hpux11.00}
737@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
738@tab yes     @tab yes   @tab yes  @tab n/a   @tab yes  @tab ?
739
740@item @b{i386-pc-bsdi2.1}
741@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
742@tab yes     @tab yes   @tab yes  @tab n/a   @tab no   @tab ?
743
744@item @b{i386-pc-bsdi3.0}
745@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
746@tab yes     @tab yes   @tab yes  @tab yes   @tab no   @tab ?
747
748@item @b{i386-pc-bsdi3.1}
749@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
750@tab yes     @tab yes   @tab yes  @tab yes   @tab no   @tab ?
751
752@item @b{i386-pc-bsdi4.0}
753@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
754@tab yes     @tab yes   @tab yes  @tab yes   @tab yes  @tab ?
755
756@item @b{i386-pc-bsdi4.0.1}
757@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
758@tab yes     @tab yes   @tab yes  @tab yes   @tab yes  @tab ?
759
760@item @b{i386-pc-solaris2.5.1}
761@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
762@tab yes     @tab yes   @tab yes  @tab yes   @tab yes  @tab yes
763
764@item @b{i386-pc-solaris2.6}
765@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
766@tab yes     @tab yes   @tab yes  @tab yes   @tab yes  @tab yes
767
768@item @b{i386-pc-solaris2.7}
769@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
770@tab yes     @tab yes   @tab yes  @tab yes   @tab yes  @tab yes
771
772@item @b{i386-unknown-freebsd2.1.0}
773@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
774@tab yes     @tab yes   @tab yes  @tab n/a   @tab ?    @tab ?
775
776@item @b{i386-unknown-freebsd2.2.1}
777@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
778@tab yes     @tab yes   @tab yes  @tab n/a   @tab yes  @tab ?
779
780@item @b{i386-unknown-freebsd2.2.6}
781@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
782@tab yes     @tab yes   @tab yes  @tab n/a   @tab yes  @tab ?
783
784@item @b{i386-unknown-freebsd2.2.7}
785@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
786@tab yes     @tab yes   @tab yes  @tab n/a   @tab yes  @tab ?
787
788@item @b{i386-unknown-freebsd2.2.8}
789@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
790@tab yes     @tab yes   @tab yes  @tab n/a   @tab yes  @tab ?
791
792@item @b{i386-unknown-freebsd3.0}
793@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
794@tab yes     @tab yes   @tab yes  @tab yes   @tab yes  @tab ?
795
796@item @b{i386-unknown-freebsdelf3.0}
797@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
798@tab yes     @tab yes   @tab yes  @tab yes   @tab yes  @tab ?
799
800@item @b{i386-unknown-freebsdelf3.1}
801@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
802@tab yes     @tab yes   @tab yes  @tab yes   @tab yes  @tab ?
803
804@item @b{i386-unknown-freebsdelf3.2}
805@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
806@tab yes     @tab yes   @tab yes  @tab yes   @tab yes  @tab ?
807
808@item @b{i386-unknown-freebsdelf3.3}
809@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
810@tab yes     @tab yes   @tab yes  @tab yes   @tab yes  @tab ?
811
812@item @b{i386-unknown-freebsdelf4.0}
813@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
814@tab yes     @tab yes   @tab yes  @tab yes   @tab yes  @tab ?
815
816@item @b{i386-unknown-netbsd1.2.1}
817@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
818@tab yes     @tab yes   @tab yes  @tab yes   @tab yes  @tab ?
819
820@item @b{i386-unknown-netbsd1.3}
821@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
822@tab yes     @tab yes   @tab yes  @tab yes   @tab yes  @tab ?
823
824@item @b{i386-unknown-netbsd1.3.1}
825@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
826@tab yes     @tab yes   @tab yes  @tab yes   @tab yes  @tab ?
827
828@item @b{i386-unknown-netbsd1.3.2}
829@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
830@tab yes     @tab yes   @tab yes  @tab yes   @tab yes  @tab ?
831
832@item @b{i386-unknown-netbsd1.3.3}
833@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
834@tab yes     @tab yes   @tab yes  @tab yes   @tab yes  @tab ?
835
836@item @b{i386-unknown-netbsd1.4}
837@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
838@tab yes     @tab yes   @tab yes  @tab yes   @tab yes  @tab ?
839
840@item @b{i386-unknown-openbsd2.1}
841@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
842@tab yes     @tab yes   @tab yes  @tab yes   @tab yes  @tab ?
843
844@item @b{i386-unknown-openbsd2.2}
845@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
846@tab yes     @tab yes   @tab yes  @tab yes   @tab yes  @tab ?
847
848@item @b{i386-unknown-openbsd2.3}
849@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
850@tab yes     @tab yes   @tab yes  @tab yes   @tab yes  @tab ?
851
852@item @b{i386-unknown-openbsd2.4}
853@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
854@tab yes     @tab yes   @tab yes  @tab yes   @tab yes  @tab ?
855
856@item @b{i386-unknown-openbsd2.5}
857@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
858@tab yes     @tab yes   @tab yes  @tab yes   @tab yes  @tab ?
859
860@item @b{i486-ncr-sysv4.3.03}
861@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
862@tab yes     @tab yes   @tab ?    @tab yes   @tab yes  @tab ?
863
864@item @b{i486-pc-linux-gnu-rh6.0}
865@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
866@tab yes     @tab yes   @tab yes  @tab n/a   @tab yes  @tab ?
867
868@item @b{i486-pc-linux-gnulibc1}
869@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
870@tab yes     @tab yes   @tab yes  @tab n/a   @tab yes  @tab ?
871
872@item @b{i486-pc-linux-gnulibc1-rh4.2}
873@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
874@tab yes     @tab yes   @tab yes  @tab n/a   @tab yes  @tab ?
875
876@item @b{i486-pc-linux-gnuoldld}
877@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
878@tab yes     @tab yes   @tab yes  @tab n/a   @tab yes  @tab ?
879
880@item @b{i586-pc-linux-gnu}
881@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
882@tab yes     @tab yes   @tab yes  @tab n/a   @tab yes  @tab ?
883
884@item @b{i586-pc-linux-gnu-rh5.2}
885@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
886@tab yes     @tab yes   @tab yes  @tab n/a   @tab yes  @tab ?
887
888@item @b{i586-pc-linux-gnu-rh6.0}
889@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
890@tab yes     @tab yes   @tab yes  @tab n/a   @tab yes  @tab ?
891
892@item @b{i586-pc-linux-gnu-rh6.1}
893@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
894@tab yes     @tab yes   @tab yes  @tab n/a   @tab yes  @tab ?
895
896@item @b{i586-pc-linux-gnulibc1}
897@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
898@tab yes     @tab yes   @tab yes  @tab n/a   @tab yes  @tab ?
899
900@item @b{i586-pc-linux-gnulibc1-rh4.2}
901@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
902@tab yes     @tab yes   @tab yes  @tab n/a   @tab yes  @tab ?
903
904
905@item @b{i686-pc-linux-gnu}
906@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
907@tab yes     @tab yes   @tab yes  @tab n/a   @tab yes  @tab ?
908
909@item @b{i686-pc-linux-gnu-rh5.2}
910@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
911@tab yes     @tab yes   @tab yes  @tab n/a   @tab yes  @tab ?
912
913@item @b{i686-pc-linux-gnu-rh6.0}
914@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
915@tab yes     @tab yes   @tab yes  @tab n/a   @tab yes  @tab ?
916
917@item @b{i686-pc-linux-gnulibc}
918@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
919@tab yes     @tab yes   @tab yes  @tab n/a   @tab yes  @tab ?
920
921@item @b{i686-pc-linux-gnulibc1}
922@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
923@tab yes     @tab yes   @tab yes  @tab n/a   @tab yes  @tab ?
924
925@item @b{m68k-hp-hpux9.00}
926@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
927@tab yes     @tab yes   @tab yes  @tab n/a   @tab ?    @tab ?
928
929@item @b{m68k-sun-sunos4.1.1}
930@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
931@tab yes     @tab yes   @tab yes  @tab n/a   @tab no   @tab ?
932
933@item @b{m68k-next-nextstep3}
934@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
935@tab yes     @tab yes   @tab yes  @tab n/a   @tab no   @tab ?
936
937@item @b{mips-dec-ultrix4.3}
938@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
939@tab yes     @tab yes   @tab yes  @tab n/a   @tab ?    @tab ?
940
941@item @b{mips-sgi-irix5.2}
942@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
943@tab ?       @tab ?     @tab ?    @tab ?     @tab ?    @tab ?
944
945@item @b{mips-sgi-irix5.3}
946@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
947@tab yes     @tab yes   @tab yes  @tab yes   @tab yes  @tab ?
948
949@item @b{mips-sgi-irix6.2}
950@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
951@tab yes     @tab yes   @tab yes  @tab yes   @tab yes  @tab ?
952
953@item @b{mips-sgi-irix6.4}
954@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
955@tab yes     @tab yes   @tab yes  @tab yes   @tab yes  @tab ?
956
957@item @b{mips-sgi-irix6.5}
958@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
959@tab yes     @tab yes   @tab ?    @tab yes   @tab yes  @tab ?
960
961@item @b{powerpc-ibm-aix4.1.5.0}
962@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
963@tab yes     @tab yes   @tab yes  @tab n/a   @tab no/broken @tab ?
964
965@item @b{powerpc-ibm-aix4.2.1.0}
966@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
967@tab yes     @tab yes   @tab yes  @tab yes   @tab no/broken @tab ?
968
969@item @b{powerpc-ibm-aix4.3.1.0}
970@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
971@tab yes     @tab yes   @tab ?    @tab yes   @tab ?    @tab ?
972
973@item @b{powerpc-unknown-linux-gnu}
974@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
975@tab yes     @tab yes   @tab yes  @tab n/a   @tab yes  @tab ?
976
977@item @b{rs6000-ibm-aix3.2}
978@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
979@tab yes     @tab yes   @tab yes  @tab n/a   @tab ?    @tab ?
980
981@item @b{rs6000-ibm-aix3.2.5}
982@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
983@tab yes     @tab yes   @tab yes  @tab n/a   @tab ?    @tab ?
984
985@item @b{rs6000-ibm-aix4.1.4.0}
986@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
987@tab yes     @tab yes   @tab yes  @tab n/a   @tab no/broken @tab ?
988
989@item @b{rs6000-ibm-aix4.1.5.0}
990@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
991@tab yes     @tab yes   @tab yes  @tab n/a   @tab no/broken @tab ?
992
993@item @b{sparc-sun-solaris2.3}
994@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
995@tab yes     @tab yes   @tab yes  @tab n/a   @tab yes  @tab ?
996
997@item @b{sparc-sun-solaris2.4}
998@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
999@tab yes     @tab yes   @tab yes  @tab n/a   @tab yes  @tab ?
1000
1001@item @b{sparc-sun-solaris2.5}
1002@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
1003@tab yes     @tab yes   @tab yes  @tab yes   @tab yes  @tab ?
1004
1005@item @b{sparc-sun-solaris2.5.1}
1006@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
1007@tab yes     @tab yes   @tab yes  @tab yes   @tab yes  @tab yes
1008
1009@item @b{sparc-sun-solaris2.6}
1010@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
1011@tab yes     @tab yes   @tab yes  @tab yes   @tab yes  @tab yes
1012
1013@item @b{sparc-sun-solaris2.7}
1014@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
1015@tab yes     @tab yes   @tab yes  @tab yes   @tab yes  @tab yes
1016
1017@item @b{sparc-sun-sunos4.1.1}
1018@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
1019@tab yes     @tab yes   @tab yes  @tab n/a   @tab yes  @tab ?
1020
1021@item @b{sparc-sun-sunos4.1.3}
1022@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
1023@tab yes     @tab yes   @tab yes  @tab n/a   @tab yes  @tab ?
1024
1025@item @b{sparc-sun-sunos4.1.3C}
1026@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
1027@tab yes     @tab yes   @tab yes  @tab n/a   @tab yes  @tab ?
1028
1029@item @b{sparc-sun-sunos4.1.3_U1}
1030@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
1031@tab yes     @tab yes   @tab yes  @tab n/a   @tab yes  @tab ?
1032
1033@item @b{sparc-sun-sunos4.1.4}
1034@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
1035@tab yes     @tab yes   @tab yes  @tab n/a   @tab yes  @tab ?
1036
1037@item @b{sparc-unknown-linux-gnulibc1}
1038@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
1039@tab yes     @tab yes   @tab yes  @tab n/a   @tab yes  @tab ?
1040
1041@item @b{sparc-unknown-netbsd1.2E}
1042@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
1043@tab yes     @tab yes   @tab yes  @tab ?     @tab ?    @tab ?
1044
1045@item @b{sparc-unknown-netbsd1.2G}
1046@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
1047@tab yes     @tab yes   @tab yes  @tab ?     @tab ?    @tab ?
1048
1049@item @b{sparc64-unknown-linux-gnu}
1050@c {Config}  {Compile}  {Amd}     {NFS V.3}  {Shlib}   {Hlfsd}
1051@tab yes     @tab yes   @tab yes  @tab n/a   @tab yes  @tab ?
1052
1053@end multitable
1054
1055See the @file{INSTALL} in the distribution for more specific details on
1056building and/or configuring for some systems.
1057
1058@c ################################################################
1059@node Mount Maps, Amd Command Line Options, Supported Platforms, Top
1060@comment  node-name,  next,  previous,  up
1061@chapter Mount Maps
1062@cindex Mount maps
1063@cindex Automounter configuration maps
1064@cindex Mount information
1065
1066@i{Amd} has no built-in knowledge of machines or filesystems.
1067External @dfn{mount-maps} are used to provide the required information.
1068Specifically, @i{Amd} needs to know when and under what conditions it
1069should mount filesystems.
1070
1071The map entry corresponding to the requested name contains a list of
1072possible locations from which to resolve the request.  Each location
1073specifies filesystem type, information required by that filesystem (for
1074example the block special device in the case of UFS), and some
1075information describing where to mount the filesystem (@pxref{fs Option}).  A
1076location may also contain @dfn{selectors} (@pxref{Selectors}).@refill
1077
1078@menu
1079* Map Types::
1080* Key Lookup::
1081* Location Format::
1082@end menu
1083
1084@node Map Types, Key Lookup, Mount Maps, Mount Maps
1085@comment  node-name,  next,  previous,  up
1086@section Map Types
1087@cindex Mount map types
1088@cindex Map types
1089@cindex Configuration map types
1090@cindex Types of mount map
1091@cindex Types of configuration map
1092@cindex Determining the map type
1093
1094A mount-map provides the run-time configuration information to @i{Amd}.
1095Maps can be implemented in many ways.  Some of the forms supported by
1096@i{Amd} are regular files, ndbm databases, NIS maps, the @dfn{Hesiod}
1097name server, and even the password file.
1098
1099A mount-map @dfn{name} is a sequence of characters.  When an automount
1100point is created a handle on the mount-map is obtained.  For each map
1101type configured, @i{Amd} attempts to reference the map of the
1102appropriate type.  If a map is found, @i{Amd} notes the type for future
1103use and deletes the reference, for example closing any open file
1104descriptors.  The available maps are configured when @i{Amd} is built
1105and can be displayed by running the command @samp{amd -v}.
1106
1107When using an @i{Amd} configuration file (@pxref{Amd Configuration File})
1108and the keyword @samp{map_type} (@pxref{map_type Parameter}), you may
1109force the map used to any type.
1110
1111By default, @i{Amd} caches data in a mode dependent on the type of map.
1112This is the same as specifying @samp{cache:=mapdefault} and selects a
1113suitable default cache mode depending on the map type.  The individual
1114defaults are described below.  The @var{cache} option can be specified
1115on automount points to alter the caching behavior (@pxref{Automount
1116Filesystem}).@refill
1117
1118The following map types have been implemented, though some are not
1119available on all machines.  Run the command @samp{amd -v} to obtain a
1120list of map types configured on your machine.
1121
1122@menu
1123* File maps::
1124* ndbm maps::
1125* NIS maps::
1126* NIS+ maps::
1127* Hesiod maps::
1128* Password maps::
1129* Union maps::
1130* LDAP maps::
1131@end menu
1132
1133@node File maps, ndbm maps, Map Types, Map Types
1134@comment  node-name,  next,  previous,  up
1135@subsection File maps
1136@cindex File maps
1137@cindex Flat file maps
1138@cindex File map syntactic conventions
1139
1140When @i{Amd} searches a file for a map entry it does a simple scan of
1141the file and supports both comments and continuation lines.
1142
1143Continuation lines are indicated by a backslash character (@samp{\}) as
1144the last character of a line in the file.  The backslash, newline character
1145@emph{and any leading white space on the following line} are discarded.  A maximum
1146line length of 2047 characters is enforced after continuation lines are read
1147but before comments are stripped.  Each line must end with
1148a newline character; that is newlines are terminators, not separators.
1149The following examples illustrate this:
1150
1151@example
1152key     valA   valB;   \
1153          valC
1154@end example
1155
1156specifies @emph{three} locations, and is identical to
1157
1158@example
1159key     valA   valB;   valC
1160@end example
1161
1162However,
1163
1164@example
1165key     valA   valB;\
1166          valC
1167@end example
1168
1169specifies only @emph{two} locations, and is identical to
1170
1171@example
1172key     valA   valB;valC
1173@end example
1174
1175After a complete line has been read from the file, including
1176continuations, @i{Amd} determines whether there is a comment on the
1177line.  A comment begins with a hash (``@samp{#}'') character and
1178continues to the end of the line.  There is no way to escape or change
1179the comment lead-in character.
1180
1181Note that continuation lines and comment support @dfn{only} apply to
1182file maps, or ndbm maps built with the @code{mk-amd-map} program.
1183
1184When caching is enabled, file maps have a default cache mode of
1185@code{all} (@pxref{Automount Filesystem}).
1186
1187@node ndbm maps, NIS maps, File maps, Map Types
1188@comment  node-name,  next,  previous,  up
1189@subsection ndbm maps
1190@cindex ndbm maps
1191
1192An ndbm map may be used as a fast access form of a file map.  The program,
1193@code{mk-amd-map}, converts a normal map file into an ndbm database.
1194This program supports the same continuation and comment conventions that
1195are provided for file maps.  Note that ndbm format files may @emph{not}
1196be sharable across machine architectures.  The notion of speed generally
1197only applies to large maps; a small map, less than a single disk block,
1198is almost certainly better implemented as a file map.
1199
1200ndbm maps have a default cache mode of @samp{all} (@pxref{Automount Filesystem}).
1201
1202@node NIS maps, NIS+ maps, ndbm maps, Map Types
1203@comment  node-name,  next,  previous,  up
1204@subsection NIS maps
1205@cindex NIS (YP) maps
1206
1207When using NIS (formerly YP), an @i{Amd} map is implemented directly
1208by the underlying NIS map.  Comments and continuation lines are
1209@emph{not} supported in the automounter and must be stripped when
1210constructing the NIS server's database.
1211
1212NIS maps have a default cache mode of @code{all} (@pxref{Automount
1213Filesystem}).
1214
1215The following rule illustrates what could be added to your NIS @file{Makefile},
1216in this case causing the @file{amd.home} map to be rebuilt:
1217@example
1218$(YPTSDIR)/amd.home.time: $(ETCDIR)/amd.home
1219    -@@sed -e "s/#.*$$//" -e "/^$$/d" $(ETCDIR)/amd.home | \
1220      awk '@{  \
1221         for (i = 1; i <= NF; i++) \
1222             if (i == NF) @{ \
1223             if (substr($$i, length($$i), 1) == "\\") \
1224                 printf("%s", substr($$i, 1, length($$i) - 1)); \
1225             else \
1226                 printf("%s\n", $$i); \
1227             @} \
1228             else \
1229             printf("%s ", $$i); \
1230         @}' | \
1231    $(MAKEDBM) - $(YPDBDIR)/amd.home; \
1232    touch $(YPTSDIR)/amd.home.time; \
1233    echo "updated amd.home"; \
1234    if [ ! $(NOPUSH) ]; then \
1235        $(YPPUSH) amd.home; \
1236        echo "pushed amd.home"; \
1237    else \
1238        : ; \
1239    fi
1240@end example
1241
1242Here @code{$(YPTSDIR)} contains the time stamp files, and @code{$(YPDBDIR)} contains
1243the dbm format NIS files.
1244
1245@node NIS+ maps, Hesiod maps, NIS maps, Map Types
1246@comment  node-name,  next,  previous,  up
1247@subsection NIS+ maps
1248@cindex NIS+ maps
1249
1250NIS+ maps do not support cache mode @samp{all} and, when caching is
1251enabled, have a default cache mode of @samp{inc}.
1252
1253XXX: FILL IN WITH AN EXAMPLE.
1254
1255@node Hesiod maps, Password maps, NIS+ maps, Map Types
1256@comment  node-name,  next,  previous,  up
1257@subsection Hesiod maps
1258@cindex Hesiod maps
1259
1260When the map name begins with the string @samp{hesiod.} lookups are made
1261using the @dfn{Hesiod} name server.  The string following the dot is
1262used as a name qualifier and is prepended with the key being located.
1263The entire string is then resolved in the @code{automount} context, or
1264the @i{amd.conf} parameter @samp{hesiod_base} (@pxref{hesiod_base
1265Parameter}).  For example, if the the key is @samp{jsp} and map name is
1266@samp{hesiod.homes} then @dfn{Hesiod} is asked to resolve
1267@samp{jsp.homes.automount}.
1268
1269Hesiod maps do not support cache mode @samp{all} and, when caching is
1270enabled, have a default cache mode of @samp{inc} (@pxref{Automount
1271Filesystem}).
1272
1273The following is an example of a @dfn{Hesiod} map entry:
1274
1275@example
1276jsp.homes.automount HS TXT "rfs:=/home/charm;rhost:=charm;sublink:=jsp"
1277njw.homes.automount HS TXT "rfs:=/home/dylan/dk2;rhost:=dylan;sublink:=njw"
1278@end example
1279
1280@node Password maps, Union maps, Hesiod maps, Map Types
1281@comment  node-name,  next,  previous,  up
1282@subsection Password maps
1283@cindex Password file maps
1284@cindex /etc/passwd maps
1285@cindex User maps, automatic generation
1286@cindex Automatic generation of user maps
1287@cindex Using the password file as a map
1288
1289The password map support is unlike the four previous map types.  When
1290the map name is the string @file{/etc/passwd} @i{Amd} can lookup a user
1291name in the password file and re-arrange the home directory field to
1292produce a usable map entry.
1293
1294@i{Amd} assumes the home directory has the format
1295`@t{/}@i{anydir}@t{/}@i{dom1}@t{/../}@i{domN}@t{/}@i{login}'.
1296@c @footnote{This interpretation is not necessarily exactly what you want.}
1297It breaks this string into a map entry where @code{$@{rfs@}} has the
1298value `@t{/}@i{anydir}@t{/}@i{domN}', @code{$@{rhost@}} has the value
1299`@i{domN}@t{.}@i{...}@t{.}@i{dom1}', and @code{$@{sublink@}} has the
1300value @i{login}.@refill
1301
1302Thus if the password file entry was
1303
1304@example
1305/home/achilles/jsp
1306@end example
1307
1308the map entry used by @i{Amd} would be
1309
1310@example
1311rfs:=/home/achilles;rhost:=achilles;sublink:=jsp
1312@end example
1313
1314Similarly, if the password file entry was
1315
1316@example
1317/home/cc/sugar/mjh
1318@end example
1319
1320the map entry used by @i{Amd} would be 
1321
1322@example
1323rfs:=/home/sugar;rhost:=sugar.cc;sublink:=jsp
1324@end example
1325
1326@node Union maps, LDAP maps , Password maps, Map Types
1327@comment  node-name,  next,  previous,  up
1328@subsection Union maps
1329@cindex Union file maps
1330
1331The union map support is provided specifically for use with the union
1332filesystem, @pxref{Union Filesystem}.
1333
1334It is identified by the string @samp{union:} which is followed by a
1335colon separated list of directories.  The directories are read in order,
1336and the names of all entries are recorded in the map cache.  Later
1337directories take precedence over earlier ones.  The union filesystem
1338type then uses the map cache to determine the union of the names in all
1339the directories.
1340
1341@node LDAP maps, , Union maps, Map Types
1342@comment  node-name,  next,  previous,  up
1343@subsection LDAP maps
1344@cindex LDAP maps
1345@cindex Lightweight Directory Access Protocol
1346
1347LDAP (Lightweight Directory Access Protocol) maps do not support cache
1348mode @samp{all} and, when caching is enabled, have a default cache mode
1349of @samp{inc}.
1350
1351For example, an @i{Amd} map @samp{amd.home} that looks as follows:
1352
1353@example
1354/defaults    opts:=rw,intr;type:=link
1355
1356zing         -rhost:=shekel \
1357             host==shekel \
1358             host!=shekel;type:=nfs
1359@end example
1360@noindent
1361when converted to LDAP (@pxref{amd2ldif}), will result in the following
1362LDAP database:
1363@example
1364$ amd2ldif amd.home CUCS < amd.home
1365dn: cn=amdmap timestamp, CUCS
1366cn             : amdmap timestamp
1367objectClass    : amdmapTimestamp
1368amdmapTimestamp: 873071363
1369
1370dn: cn=amdmap amd.home[/defaults], CUCS
1371cn          : amdmap amd.home[/defaults]
1372objectClass : amdmap
1373amdmapName  : amd.home
1374amdmapKey   : /defaults
1375amdmapValue : opts:=rw,intr;type:=link
1376
1377dn: cn=amdmap amd.home[], CUCS
1378cn          : amdmap amd.home[]
1379objectClass : amdmap
1380amdmapName  : amd.home
1381amdmapKey   : 
1382amdmapValue : 
1383
1384dn: cn=amdmap amd.home[zing], CUCS
1385cn          : amdmap amd.home[zing]
1386objectClass : amdmap
1387amdmapName  : amd.home
1388amdmapKey   : zing
1389amdmapValue : -rhost:=shekel host==shekel host!=shekel;type:=nfs
1390@end example
1391
1392@c subsection Gdbm
1393
1394@node Key Lookup, Location Format, Map Types, Mount Maps
1395@comment  node-name,  next,  previous,  up
1396@section How keys are looked up
1397@cindex Key lookup
1398@cindex Map lookup
1399@cindex Looking up keys
1400@cindex How keys are looked up
1401@cindex Wildcards in maps
1402
1403The key is located in the map whose type was determined when the
1404automount point was first created.  In general the key is a pathname
1405component.  In some circumstances this may be modified by variable
1406expansion (@pxref{Variable Expansion}) and prefixing.  If the automount
1407point has a prefix, specified by the @var{pref} option, then that is
1408prepended to the search key before the map is searched.
1409
1410If the map cache is a @samp{regexp} cache then the key is treated as an
1411egrep-style regular expression, otherwise a normal string comparison is
1412made.
1413
1414If the key cannot be found then a @dfn{wildcard} match is attempted.
1415@i{Amd} repeatedly strips the basename from the key, appends @samp{/*} and
1416attempts a lookup.  Finally, @i{Amd} attempts to locate the special key @samp{*}.
1417
1418For example, the following sequence would be checked if @file{home/dylan/dk2} was
1419being located:
1420
1421@example
1422   home/dylan/dk2
1423   home/dylan/*
1424   home/*
1425   *
1426@end example
1427
1428At any point when a wildcard is found, @i{Amd} proceeds as if an exact
1429match had been found and the value field is then used to resolve the
1430mount request, otherwise an error code is propagated back to the kernel.
1431(@pxref{Filesystem Types}).@refill
1432
1433@node Location Format, , Key Lookup, Mount Maps
1434@comment  node-name,  next,  previous,  up
1435@section Location Format
1436@cindex Location format
1437@cindex Map entry format
1438@cindex How locations are parsed
1439
1440The value field from the lookup provides the information required to
1441mount a filesystem.  The information is parsed according to the syntax
1442shown below.
1443
1444@display
1445@i{location-list}:
1446                  @i{location-selection}
1447                  @i{location-list} @i{white-space} @t{||} @i{white-space} @i{location-selection}
1448@i{location-selection}:
1449                  @i{location}
1450                  @i{location-selection} @i{white-space} @i{location}
1451@i{location}:
1452                  @i{location-info}
1453                  @t{-}@i{location-info}
1454                  @t{-}
1455@i{location-info}:
1456                  @i{sel-or-opt}
1457                  @i{location-info}@t{;}@i{sel-or-opt}
1458                  @t{;}
1459@i{sel-or-opt}:
1460                  @i{selection}
1461                  @i{opt-ass}
1462@i{selection}:
1463                  selector@t{==}@i{value}
1464                  selector@t{!=}@i{value}
1465@i{opt-ass}:
1466                  option@t{:=}@i{value}
1467@i{white-space}:
1468                  space
1469                  tab
1470@end display
1471
1472Note that unquoted whitespace is not allowed in a location description.
1473White space is only allowed, and is mandatory, where shown with non-terminal
1474@i{white-space}.
1475
1476A @dfn{location-selection} is a list of possible volumes with which to
1477satisfy the request.  @dfn{location-selection}s are separated by the
1478@samp{||} operator.  The effect of this operator is to prevent use of
1479location-selections to its right if any of the location-selections on
1480its left were selected whether or not any of them were successfully
1481mounted (@pxref{Selectors}).@refill
1482
1483The location-selection, and singleton @dfn{location-list},
1484@samp{type:=ufs;dev:=/dev/xd1g} would inform @i{Amd} to mount a UFS
1485filesystem from the block special device @file{/dev/xd1g}.
1486
1487The @dfn{sel-or-opt} component is either the name of an option required
1488by a specific filesystem, or it is the name of a built-in, predefined
1489selector such as the architecture type.  The value may be quoted with
1490double quotes @samp{"}, for example
1491@samp{type:="ufs";dev:="/dev/xd1g"}.  These quotes are stripped when the
1492value is parsed and there is no way to get a double quote into a value
1493field.  Double quotes are used to get white space into a value field,
1494which is needed for the program filesystem (@pxref{Program Filesystem}).@refill
1495
1496@menu
1497* Map Defaults::
1498* Variable Expansion::
1499* Selectors::
1500* Map Options::
1501@end menu
1502
1503@node Map Defaults, Variable Expansion, Location Format, Location Format
1504@comment  node-name,  next,  previous,  up
1505@subsection Map Defaults
1506@cindex Map defaults
1507@cindex How to set default map parameters
1508@cindex Setting default map parameters
1509
1510A location beginning with a dash @samp{-} is used to specify default
1511values for subsequent locations.  Any previously specified defaults in
1512the location-list are discarded.  The default string can be empty in
1513which case no defaults apply.
1514
1515The location @samp{-fs:=/mnt;opts:=ro} would set the local mount point
1516to @file{/mnt} and cause mounts to be read-only by default.  Defaults
1517specified this way are appended to, and so override, any global map
1518defaults given with @samp{/defaults}).
1519
1520@c
1521@c A @samp{/defaults} value @dfn{gdef} and a location list
1522@c \begin{quote}
1523@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$
1524@c \end{quote}
1525@c is equivalent to
1526@c \begin{quote}
1527@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$
1528@c \end{quote}
1529@c which is equivalent to
1530@c \begin{quote}
1531@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$
1532@c \end{quote}
1533
1534@node Variable Expansion, Selectors, Map Defaults, Location Format
1535@comment  node-name,  next,  previous,  up
1536@subsection Variable Expansion
1537@cindex Variable expansion
1538@cindex How variables are expanded
1539@cindex Pathname operators
1540@cindex Domain stripping
1541@cindex Domainname operators
1542@cindex Stripping the local domain name
1543@cindex Environment variables
1544@cindex How to access environment variables in maps
1545
1546To allow generic location specifications @i{Amd} does variable expansion
1547on each location and also on some of the option strings.  Any option or
1548selector appearing in the form @code{$@dfn{var}} is replaced by the
1549current value of that option or selector.  For example, if the value of
1550@code{$@{key@}} was @samp{bin}, @code{$@{autodir@}} was @samp{/a} and
1551@code{$@{fs@}} was `@t{$@{autodir@}}@t{/local/}@t{$@{key@}}' then
1552after expansion @code{$@{fs@}} would have the value @samp{/a/local/bin}.
1553Any environment variable can be accessed in a similar way.@refill
1554
1555Two pathname operators are available when expanding a variable.  If the
1556variable name begins with @samp{/} then only the last component of the
1557pathname is substituted.  For example, if @code{$@{path@}} was
1558@samp{/foo/bar} then @code{$@{/path@}} would be expanded to @samp{bar}.
1559Similarly, if the variable name ends with @samp{/} then all but the last
1560component of the pathname is substituted.  In the previous example,
1561@code{$@{path/@}} would be expanded to @samp{/foo}.@refill
1562
1563Two domain name operators are also provided.  If the variable name
1564begins with @samp{.} then only the domain part of the name is
1565substituted.  For example, if @code{$@{rhost@}} was
1566@samp{swan.doc.ic.ac.uk} then @code{$@{.rhost@}} would be expanded to
1567@samp{doc.ic.ac.uk}.  Similarly, if the variable name ends with @samp{.}
1568then only the host component is substituted.  In the previous example,
1569@code{$@{rhost.@}} would be expanded to @samp{swan}.@refill
1570
1571Variable expansion is a two phase process.  Before a location is parsed,
1572all references to selectors, @i{eg} @code{$@{path@}}, are expanded.  The
1573location is then parsed, selections are evaluated and option assignments
1574recorded.  If there were no selections or they all succeeded the
1575location is used and the values of the following options are expanded in
1576the order given: @var{sublink}, @var{rfs}, @var{fs}, @var{opts},
1577@var{remopts}, @var{mount} and @var{unmount}.
1578
1579Note that expansion of option values is done after @dfn{all} assignments
1580have been completed and not in a purely left to right order as is done
1581by the shell.  This generally has the desired effect but care must be
1582taken if one of the options references another, in which case the
1583ordering can become significant.
1584
1585There are two special cases concerning variable expansion:
1586
1587@enumerate
1588@item
1589before a map is consulted, any selectors in the name received
1590from the kernel are expanded.  For example, if the request from the
1591kernel was for `@t{$@{arch@}}@t{.bin}' and the machine architecture
1592was @samp{vax}, the value given to @code{$@{key@}} would be
1593@samp{vax.bin}.@refill
1594
1595@item
1596the value of @code{$@{rhost@}} is expanded and normalized before the
1597other options are expanded.  The normalization process strips any local
1598sub-domain components.  For example, if @code{$@{domain@}} was
1599@samp{Berkeley.EDU} and @code{$@{rhost@}} was initially
1600@samp{snow.Berkeley.EDU}, after the normalization it would simply be
1601@samp{snow}.  Hostname normalization is currently done in a
1602@emph{case-dependent} manner.@refill
1603@end enumerate
1604
1605@c======================================================================
1606@node Selectors, Map Options, Variable Expansion, Location Format
1607@comment  node-name,  next,  previous,  up
1608@subsection Selectors
1609@cindex Selectors
1610
1611Selectors are used to control the use of a location.  It is possible to
1612share a mount map between many machines in such a way that filesystem
1613location, architecture and operating system differences are hidden from
1614the users.  A selector of the form @samp{arch==sun3;os==sunos4} would only
1615apply on Sun-3s running SunOS 4.x.
1616
1617Selectors can be negated by using @samp{!=} instead of @samp{==}.  For
1618example to select a location on all non-Vax machines the selector
1619@samp{arch!=vax} would be used.
1620
1621Selectors are evaluated left to right.  If a selector fails then that
1622location is ignored.  Thus the selectors form a conjunction and the
1623locations form a disjunction.  If all the locations are ignored or
1624otherwise fail then @i{Amd} uses the @dfn{error} filesystem
1625(@pxref{Error Filesystem}).  This is equivalent to having a location
1626@samp{type:=error} at the end of each mount-map entry.@refill
1627
1628The default value of many of the selectors listed here can be overridden
1629by an @i{Amd} command line switch or in an @i{Amd} configuration file.
1630@xref{Amd Configuration File}.
1631
1632These are the selectors currently implemented.
1633
1634@menu
1635* arch Selector Variable::
1636* autodir Selector Variable::
1637* byte Selector Variable::
1638* cluster Selector Variable::
1639* domain Selector Variable::
1640* host Selector Variable::
1641* hostd Selector Variable::
1642* karch Selector Variable::
1643* os Selector Variable::
1644* osver Selector Variable::
1645* full_os Selector Variable::
1646* vendor Selector Variable::
1647
1648* key Selector Variable::
1649* map Selector Variable::
1650* netnumber Selector Variable::
1651* network Selector Variable::
1652* path Selector Variable::
1653* wire Selector Variable::
1654
1655* exists Selector Function::
1656* false Selector Function::
1657* netgrp Selector Function::
1658* netgrpd Selector Function::
1659* in_network Selector Function::
1660* true Selector Function::
1661@end menu
1662
1663@c ----------------------------------------------------------------
1664@node arch Selector Variable, autodir Selector Variable, Selectors, Selectors
1665@comment  node-name,  next,  previous,  up
1666@subsubsection arch Selector Variable
1667@cindex arch Selector Variable
1668@cindex arch, mount selector
1669@cindex Mount selector; arch
1670@cindex Selector; arch
1671
1672The machine architecture which was automatically determined at compile
1673time.  The architecture type can be displayed by running the command
1674@samp{amd -v}.  @xref{Supported Platforms}.@refill
1675
1676@c ----------------------------------------------------------------
1677@node autodir Selector Variable, byte Selector Variable, arch Selector Variable, Selectors
1678@comment  node-name,  next,  previous,  up
1679@subsubsection autodir Selector Variable
1680@cindex autodir Selector Variable
1681@cindex autodir, mount selector
1682@cindex Mount selector; autodir
1683@cindex Selector; autodir
1684
1685The default directory under which to mount filesystems.  This may be
1686changed by the @code{-a} command line option.  @xref{fs Option}.
1687
1688@c ----------------------------------------------------------------
1689@node byte Selector Variable, cluster Selector Variable, autodir Selector Variable, Selectors
1690@comment  node-name,  next,  previous,  up
1691@subsubsection byte Selector Variable
1692@cindex byte Selector Variable
1693@cindex byte, mount selector
1694@cindex Mount selector; byte
1695@cindex Selector; byte
1696
1697The machine's byte ordering.  This is either @samp{little}, indicating
1698little-endian, or @samp{big}, indicating big-endian.  One possible use
1699is to share @samp{rwho} databases (@pxref{rwho servers}).  Another is to
1700share ndbm databases, however this use can be considered a courageous
1701juggling act.
1702
1703@c ----------------------------------------------------------------
1704@node cluster Selector Variable, domain Selector Variable, byte Selector Variable, Selectors
1705@comment  node-name,  next,  previous,  up
1706@subsubsection cluster Selector Variable
1707@cindex cluster Selector Variable
1708@cindex cluster, mount selector
1709@cindex Mount selector; cluster
1710@cindex Selector; cluster
1711
1712This is provided as a hook for the name of the local cluster.  This can
1713be used to decide which servers to use for copies of replicated
1714filesystems.  @code{$@{cluster@}} defaults to the value of
1715@code{$@{domain@}} unless a different value is set with the @code{-C}
1716command line option.
1717
1718@c ----------------------------------------------------------------
1719@node domain Selector Variable, host Selector Variable, cluster Selector Variable, Selectors
1720@comment  node-name,  next,  previous,  up
1721@subsubsection domain Selector Variable
1722@cindex domain Selector Variable
1723@cindex domain, mount selector
1724@cindex Mount selector; domain
1725@cindex Selector; domain
1726
1727The local domain name as specified by the @code{-d} command line option.
1728@xref{host Selector Variable}.
1729
1730@c ----------------------------------------------------------------
1731@node host Selector Variable, hostd Selector Variable, domain Selector Variable, Selectors
1732@comment  node-name,  next,  previous,  up
1733@subsubsection host Selector Variable
1734@cindex host Selector Variable
1735@cindex host, mount selector
1736@cindex Mount selector; host
1737@cindex Selector; host
1738
1739The local hostname as determined by @b{gethostname}(2).  If no domain
1740name was specified on the command line and the hostname contains a
1741period @samp{.} then the string before the period is used as the host
1742name, and the string after the period is assigned to @code{$@{domain@}}.
1743For example, if the hostname is @samp{styx.doc.ic.ac.uk} then
1744@code{host} would be @samp{styx} and @code{domain} would be
1745@samp{doc.ic.ac.uk}.  @code{hostd} would be
1746@samp{styx.doc.ic.ac.uk}.@refill
1747
1748@c ----------------------------------------------------------------
1749@node hostd Selector Variable, karch Selector Variable, host Selector Variable, Selectors
1750@comment  node-name,  next,  previous,  up
1751@subsubsection hostd Selector Variable
1752@cindex hostd Selector Variable
1753@cindex hostd, mount selector
1754@cindex Mount selector; hostd
1755@cindex Selector; hostd
1756
1757This resolves to the @code{$@{host@}} and @code{$@{domain@}}
1758concatenated with a @samp{.} inserted between them if required.  If
1759@code{$@{domain@}} is an empty string then @code{$@{host@}} and
1760@code{$@{hostd@}} will be identical.
1761
1762@c ----------------------------------------------------------------
1763@node karch Selector Variable, os Selector Variable, hostd Selector Variable, Selectors
1764@comment  node-name,  next,  previous,  up
1765@subsubsection karch Selector Variable
1766@cindex karch Selector Variable
1767@cindex karch, mount selector
1768@cindex Mount selector; karch
1769@cindex Selector; karch
1770
1771This is provided as a hook for the kernel architecture.  This is used on
1772SunOS 4 and SunOS 5, for example, to distinguish between different
1773@samp{/usr/kvm} volumes.  @code{$@{karch@}} defaults to the ``machine''
1774value gotten from @b{uname}(2).  If the @b{uname}(2) system call is not
1775available, the value of @code{$@{karch@}} defaults to that of
1776@code{$@{arch@}}.  Finally, a different value can be set with the @code{-k}
1777command line option.
1778
1779@c ----------------------------------------------------------------
1780@node os Selector Variable, osver Selector Variable, karch Selector Variable, Selectors
1781@comment  node-name,  next,  previous,  up
1782@subsubsection os Selector Variable
1783@cindex os Selector Variable
1784@cindex os, mount selector
1785@cindex Mount selector; os
1786@cindex Selector; os
1787
1788The operating system.  Like the machine architecture, this is
1789automatically determined at compile time.  The operating system name can
1790be displayed by running the command @samp{amd -v}.  @xref{Supported
1791Platforms}.@refill
1792
1793@c ----------------------------------------------------------------
1794@node osver Selector Variable, full_os Selector Variable, os Selector Variable, Selectors
1795@comment  node-name,  next,  previous,  up
1796@subsubsection osver Selector Variable
1797@cindex osver Selector Variable
1798@cindex osver, mount selector
1799@cindex Mount selector; osver
1800@cindex Selector; osver
1801
1802The operating system version.  Like the machine architecture, this is
1803automatically determined at compile time.  The operating system name can
1804be displayed by running the command @samp{amd -v}.  @xref{Supported
1805Platforms}.@refill
1806
1807@c ----------------------------------------------------------------
1808@node full_os Selector Variable, vendor Selector Variable, osver Selector Variable, Selectors
1809@comment  node-name,  next,  previous,  up
1810@subsubsection full_os Selector Variable
1811@cindex full_os Selector Variable
1812@cindex full_os, mount selector
1813@cindex Mount selector; full_os
1814@cindex Selector; full_os
1815
1816The full name of the operating system, including its version.  This
1817value is automatically determined at compile time.  The full operating
1818system name and version can be displayed by running the command
1819@samp{amd -v}.  @xref{Supported Platforms}.@refill
1820
1821@c ----------------------------------------------------------------
1822@node vendor Selector Variable, key Selector Variable, full_os Selector Variable, Selectors
1823@comment  node-name,  next,  previous,  up
1824@subsubsection vendor Selector Variable
1825@cindex vendor Selector Variable
1826@cindex vendor, mount selector
1827@cindex Mount selector; vendor
1828@cindex Selector; vendor
1829
1830The name of the vendor of the operating system.  This value is
1831automatically determined at compile time.  The name of the vendor can be
1832displayed by running the command @samp{amd -v}.  @xref{Supported
1833Platforms}.@refill
1834
1835@c ----------------------------------------------------------------
1836@ifhtml
1837<HR>
1838@end ifhtml
1839@sp 3
1840The following selectors are also provided.  Unlike the other selectors,
1841they vary for each lookup.  Note that when the name from the kernel is
1842expanded prior to a map lookup, these selectors are all defined as empty
1843strings.
1844
1845@c ----------------------------------------------------------------
1846@node key Selector Variable, map Selector Variable, vendor Selector Variable, Selectors
1847@comment  node-name,  next,  previous,  up
1848@subsubsection key Selector Variable
1849@cindex key Selector Variable
1850@cindex key, mount selector
1851@cindex Mount selector; key
1852@cindex Selector; key
1853
1854The name being resolved.  For example, if @file{/home} is an automount
1855point, then accessing @file{/home/foo} would set @code{$@{key@}} to the
1856string @samp{foo}.  The key is prefixed by the @var{pref} option set in
1857the parent mount point.  The default prefix is an empty string.  If the
1858prefix was @file{blah/} then @code{$@{key@}} would be set to
1859@file{blah/foo}.@refill
1860
1861@c ----------------------------------------------------------------
1862@node map Selector Variable, netnumber Selector Variable, key Selector Variable, Selectors
1863@comment  node-name,  next,  previous,  up
1864@subsubsection map Selector Variable
1865@cindex map Selector Variable
1866@cindex map, mount selector
1867@cindex Mount selector; map
1868@cindex Selector; map
1869
1870The name of the mount map being used.
1871
1872@c ----------------------------------------------------------------
1873@node netnumber Selector Variable, network Selector Variable, map Selector Variable, Selectors
1874@comment  node-name,  next,  previous,  up
1875@subsubsection netnumber Selector Variable
1876@cindex netnumber Selector Variable
1877@cindex netnumber, mount selector
1878@cindex Mount selector; netnumber
1879@cindex Selector; netnumber
1880
1881This selector is identical to the @samp{in_network} selector function,
1882see @ref{in_network Selector Function}.  It will match either the name
1883or number of @i{any} network interface on which this host is connected
1884to.  The names and numbers of all attached interfaces are available from
1885the output of @samp{amd -v}.
1886
1887@c ----------------------------------------------------------------
1888@node network Selector Variable, path Selector Variable, netnumber Selector Variable, Selectors
1889@comment  node-name,  next,  previous,  up
1890@subsubsection network Selector Variable
1891@cindex network Selector Variable
1892@cindex network, mount selector
1893@cindex Mount selector; network
1894@cindex Selector; network
1895
1896This selector is identical to the @samp{in_network} selector function,
1897see @ref{in_network Selector Function}.  It will match either the name
1898or number of @i{any} network interface on which this host is connected
1899to.  The names and numbers of all attached interfaces are available from
1900the output of @samp{amd -v}.
1901
1902@c ----------------------------------------------------------------
1903@node path Selector Variable, wire Selector Variable, network Selector Variable, Selectors
1904@comment  node-name,  next,  previous,  up
1905@subsubsection path Selector Variable
1906@cindex path Selector Variable
1907@cindex path, mount selector
1908@cindex Mount selector; path
1909@cindex Selector; path
1910
1911The full pathname of the name being resolved.  For example
1912@file{/home/foo} in the example above.
1913
1914@c ----------------------------------------------------------------
1915@node wire Selector Variable, exists Selector Function, path Selector Variable, Selectors
1916@comment  node-name,  next,  previous,  up
1917@subsubsection wire Selector Variable
1918@cindex wire Selector Variable
1919@cindex wire, mount selector
1920@cindex Mount selector; wire
1921@cindex Selector; wire
1922
1923This selector is identical to the @samp{in_network} selector function,
1924see @ref{in_network Selector Function}.  It will match either the name
1925or number of @i{any} network interface on which this host is connected
1926to.  The names and numbers of all attached interfaces are available from
1927the output of @samp{amd -v}.
1928
1929@c ----------------------------------------------------------------
1930@ifhtml
1931<HR>
1932@end ifhtml
1933@sp 2
1934The following boolean functions are selectors which take an argument
1935@i{ARG}.  They return a value of true or false, and thus do not need to
1936be compared with a value.  Each of these may be negated by prepending
1937@samp{!} to their name.
1938
1939@c ----------------------------------------------------------------
1940@node exists Selector Function, false Selector Function, wire Selector Variable, Selectors
1941@comment  node-name,  next,  previous,  up
1942@subsubsection exists Selector Function
1943@cindex exists Selector Function
1944@cindex exists, boolean mount selector
1945@cindex !exists, boolean mount selector
1946@cindex Mount selector; exists
1947@cindex Selector; exists
1948
1949If the file listed by @i{ARG} exists (via @b{lstat}(2)), this function
1950evaluates to true.  Otherwise it evaluates to false.
1951
1952@c ----------------------------------------------------------------
1953@node false Selector Function, netgrp Selector Function, exists Selector Function, Selectors
1954@comment  node-name,  next,  previous,  up
1955@subsubsection false Selector Function
1956@cindex false Selector Function
1957@cindex false, boolean mount selector
1958@cindex !false, boolean mount selector
1959@cindex Mount selector; false
1960@cindex Selector; false
1961
1962Always evaluates to false.  @i{ARG} is ignored.
1963
1964@c ----------------------------------------------------------------
1965@node netgrp Selector Function, netgrpd Selector Function, false Selector Function, Selectors
1966@comment  node-name,  next,  previous,  up
1967@subsubsection netgrp Selector Function
1968@cindex netgrp Selector Function
1969@cindex netgrp, boolean mount selector
1970@cindex !netgrp, boolean mount selector
1971@cindex Mount selector; netgrp
1972@cindex Selector; netgrp
1973
1974If the current host as determined by the value of @code{$@{host@}}
1975(e.g., short host name) is a member of the netgroup @i{ARG}, this
1976selector evaluates to true.  Otherwise it evaluates to false.
1977
1978For example, suppose you have a netgroup @samp{ppp-hosts}, and for
1979reasons of performance, these have a local @file{/home} partition, while
1980all other clients on the faster network can access a shared home
1981directory.  A common map to use for both might look like the following:
1982
1983@example
1984home/*  netgrp(ppp-hosts);type:=link;fs:=/local/$@{key@} \
1985        !netgrp(ppp-hosts);type:=nfs;rhost:=serv1;rfs:=/remote/$@{key@}
1986@end example
1987
1988@c ----------------------------------------------------------------
1989@node netgrpd Selector Function, in_network Selector Function, netgrp Selector Function, Selectors
1990@comment  node-name,  next,  previous,  up
1991@subsubsection netgrpd Selector Function
1992@cindex netgrpd Selector Function
1993@cindex netgrpd, boolean mount selector
1994@cindex !netgrpd, boolean mount selector
1995@cindex Mount selector; netgrpd
1996@cindex Selector; netgrpd
1997
1998If the current host as determined by the value of @code{$@{hostd@}} is a
1999member of the netgroup @i{ARG}, this selector evaluates to true.
2000Otherwise it evaluates to false.
2001
2002The @samp{netgrpd} function uses fully-qualified host names
2003(@code{$@{hostd@}}) to match netgroup names, while the @samp{netgrp}
2004function (@pxref{netgrp Selector Function}) uses short host names
2005(@code{$@{host@}}).
2006
2007@c ----------------------------------------------------------------
2008@node in_network Selector Function, true Selector Function, netgrpd Selector Function, Selectors
2009@comment  node-name,  next,  previous,  up
2010@subsubsection in_network Selector Function
2011@cindex in_network Selector Function
2012@cindex in_network, boolean mount selector
2013@cindex !in_network, boolean mount selector
2014@cindex Mount selector; in_network
2015@cindex Selector; in_network
2016
2017If the current host has any network interface that is locally attached
2018to the network specified in @i{ARG} (either via name or number), this
2019selector evaluates to true.  Otherwise it evaluates to false.
2020
2021For example, suppose you have two servers that have an exportable
2022@file{/opt} that smaller clients can NFS mount.  The two servers are
2023say, @samp{serv1} on network @samp{foo-net.site.com} and @samp{serv2} on
2024network @samp{123.4.5.0}.  You can write a map to be used by all clients
2025that will attempt to mount the closest one as follows:
2026
2027@example
2028opt in_network(foo-net.site.com);rhost:=serv1;rfs:=/opt \
2029    in_network(123.4.5.0);rhost:=serv2;rfs:=/opt \
2030    rhost:=fallback-server
2031@end example
2032
2033@c ----------------------------------------------------------------
2034@node true Selector Function, , in_network Selector Function, Selectors
2035@comment  node-name,  next,  previous,  up
2036@subsubsection true Selector Function
2037@cindex true Selector Function
2038@cindex true, boolean mount selector
2039@cindex !true, boolean mount selector
2040@cindex Mount selector; true
2041@cindex Selector; true
2042
2043Always evaluates to true.  @i{ARG} is ignored.
2044
2045@c ================================================================
2046@node Map Options,  , Selectors, Location Format
2047@comment  node-name,  next,  previous,  up
2048@subsection Map Options
2049@cindex Map options
2050@cindex Setting map options
2051
2052Options are parsed concurrently with selectors.  The difference is that
2053when an option is seen the string following the @samp{:=} is
2054recorded for later use.  As a minimum the @var{type} option must be
2055specified.  Each filesystem type has other options which must also be
2056specified.  @xref{Filesystem Types}, for details on the filesystem
2057specific options.@refill
2058
2059Superfluous option specifications are ignored and are not reported
2060as errors.
2061
2062The following options apply to more than one filesystem type.
2063
2064@menu
2065* addopts Option::
2066* delay Option::
2067* fs Option::
2068* opts Option::
2069* remopts Option::
2070* sublink Option::
2071* type Option::
2072@end menu
2073
2074@node addopts Option, delay Option, Map Options, Map Options
2075@comment  node-name,  next,  previous,  up
2076@subsubsection addopts Option
2077@cindex Setting additional options on a mount location
2078@cindex Overriding or adding options to a mount
2079@cindex addopts, mount option
2080@cindex Mount option; addopts
2081
2082This option adds additional options to default options normally
2083specified in the @samp{/defaults} entry or the defaults of the key entry
2084being processed (@pxref{opts Option}).  Normally when you specify
2085@samp{opts} in both the @samp{/defaults} and the map entry, the latter
2086overrides the former completely.  But with @samp{addopts} it will append
2087the options and override any conflicting ones.
2088
2089@samp{addopts} also overrides the value of the @samp{remopts} option
2090(@pxref{remopts Option}), which unless specified defaults to the value
2091of @samp{opts}.
2092
2093Options which start with @samp{no} will override those with the same
2094name that do not start with @samp{no} and vice verse.  Special handling
2095is given to inverted options such as @samp{soft} and @samp{hard},
2096@samp{bg} and @samp{fg}, @samp{ro} and @samp{rw}, etc.
2097
2098For example, if the default options specified were
2099@example
2100opts:=rw,nosuid,intr,rsize=1024,wsize=1024,quota,posix
2101@end example
2102
2103and the ones specified in a map entry were
2104
2105@example
2106addopts:=grpid,suid,ro,rsize=2048,quota,nointr
2107@end example
2108
2109then the actual options used would be
2110
2111@example
2112wsize=1024,posix,grpid,suid,ro,rsize=2048,quota,nointr
2113@end example
2114
2115@node delay Option, fs Option, addopts Option, Map Options
2116@comment  node-name,  next,  previous,  up
2117@subsubsection delay Option
2118@cindex Setting a delay on a mount location
2119@cindex Delaying mounts from specific locations
2120@cindex Primary server
2121@cindex Secondary server
2122@cindex delay, mount option
2123@cindex Mount option; delay
2124
2125The delay, in seconds, before an attempt will be made to mount from the
2126current location.  Auxiliary data, such as network address, file handles
2127and so on are computed regardless of this value.
2128
2129A delay can be used to implement the notion of primary and secondary
2130file servers.  The secondary servers would have a delay of a few
2131seconds, thus giving the primary servers a chance to respond first.
2132
2133@node fs Option, opts Option, delay Option, Map Options
2134@comment  node-name,  next,  previous,  up
2135@subsubsection fs Option
2136@cindex Setting the local mount point
2137@cindex Overriding the default mount point
2138@cindex fs, mount option
2139@cindex Mount option; fs
2140
2141The local mount point.  The semantics of this option vary between
2142filesystems.
2143
2144For NFS and UFS filesystems the value of @code{$@{fs@}} is used as the
2145local mount point.  For other filesystem types it has other meanings
2146which are described in the section describing the respective filesystem
2147type.  It is important that this string uniquely identifies the
2148filesystem being mounted.  To satisfy this requirement, it should
2149contain the name of the host on which the filesystem is resident and the
2150pathname of the filesystem on the local or remote host.
2151
2152The reason for requiring the hostname is clear if replicated filesystems
2153are considered.  If a fileserver goes down and a replacement filesystem
2154is mounted then the @dfn{local} mount point @dfn{must} be different from
2155that of the filesystem which is hung.  Some encoding of the filesystem
2156name is required if more than one filesystem is to be mounted from any
2157given host.
2158
2159If the hostname is first in the path then all mounts from a particular
2160host will be gathered below a single directory.  If that server goes
2161down then the hung mount points are less likely to be accidentally
2162referenced, for example when @b{getcwd}(3) traverses the namespace to
2163find the pathname of the current directory.
2164
2165The @samp{fs} option defaults to
2166@code{$@{autodir@}/$@{rhost@}$@{rfs@}}.  In addition,
2167@samp{rhost} defaults to the local host name (@code{$@{host@}}) and
2168@samp{rfs} defaults to the value of @code{$@{path@}}, which is the full
2169path of the requested file; @samp{/home/foo} in the example above
2170(@pxref{Selectors}).  @code{$@{autodir@}} defaults to @samp{/a} but may
2171be changed with the @code{-a} command line option.  Sun's automounter
2172defaults to @samp{/tmp_mnt}.  Note that there is no @samp{/} between
2173the @code{$@{rhost@}} and @code{$@{rfs@}} since @code{$@{rfs@}} begins
2174with a @samp{/}.@refill
2175
2176@node opts Option, remopts Option, fs Option, Map Options
2177@comment  node-name,  next,  previous,  up
2178@subsubsection opts Option
2179@cindex Setting system mount options
2180@cindex Passing parameters to the mount system call
2181@cindex mount system call
2182@cindex mount system call flags
2183@cindex The mount system call
2184@cindex opts, mount option
2185@cindex Mount option; opts
2186
2187The options to pass to the mount system call.  A leading @samp{-} is
2188silently ignored.  The mount options supported generally correspond to
2189those used by @b{mount}(8) and are listed below.  Some additional
2190pseudo-options are interpreted by @i{Amd} and are also listed.
2191
2192Unless specifically overridden, each of the system default mount options
2193applies.  Any options not recognized are ignored.  If no options list is
2194supplied the string @samp{rw,defaults} is used and all the system
2195default mount options apply.  Options which are not applicable for a
2196particular operating system are silently ignored.  For example, only 4.4BSD
2197is known to implement the @code{compress} and @code{spongy} options.
2198
2199@table @code
2200
2201@item acdirmax=@var{n}
2202@cindex Mount flags; acdirmax
2203Set the maximum directory attribute cache timeout to @var{n}.
2204
2205@item acdirmin=@var{n}
2206@cindex Mount flags; acdirmin
2207Set the minimum directory attribute cache timeout to @var{n}.
2208
2209@item acregmax=@var{n}
2210@cindex Mount flags; acregmax
2211Set the maximum file attribute cache timeout to @var{n}.
2212
2213@item acregmin=@var{n}
2214@cindex Mount flags; acregmin
2215Set the minimum file attribute cache timeout to @var{n}.
2216
2217@item actimeo=@var{n}
2218@cindex Mount flags; actimeo
2219Set the overall attribute cache timeout to @var{n}.
2220
2221@item auto
2222@cindex Mount flags; auto
2223@itemx ignore
2224@cindex Mount flags; ignore
2225Ignore this mount by @b{df}(1).
2226
2227@item cache
2228@cindex Mount flags; cache
2229Allow data to be cached from a remote server for this mount.
2230
2231@item compress
2232@cindex Mount flags; compress
2233Use NFS compression protocol.
2234
2235@item defperm
2236@cindex Mount flags; defperm
2237Ignore the permission mode bits, and default file permissions to 0555,
2238UID 0, and GID 0.  Useful for CD-ROMs formatted as ISO-9660.
2239
2240@item dev
2241@cindex Mount flags; dev
2242Allow local special devices on this filesystem.
2243
2244@item dumbtimr
2245@cindex Mount flags; dumbtimr
2246Turn off the dynamic retransmit timeout estimator.  This may be useful
2247for UDP mounts that exhibit high retry rates, since it is possible that
2248the dynamically estimated timeout interval is too short.
2249
2250@item extatt
2251@cindex Mount flags; extatt
2252Enable extended attributes in ISO-9660 file systems.
2253
2254@item fsid
2255@cindex Mount flags; fsid
2256Set ID of filesystem.
2257
2258@item gens
2259@cindex Mount flags; gens
2260Enable generations in ISO-9660 file systems.  Generations allow you to
2261see all versions of a given file.
2262
2263@item grpid
2264@cindex Mount flags; grpid
2265Use BSD directory group-id semantics.
2266
2267@item int
2268@cindex Mount flags; int
2269@itemx intr
2270@cindex Mount flags; intr
2271Allow keyboard interrupts on hard mounts.
2272
2273@item multi
2274@cindex Mount flags; multi
2275Perform multi-component lookup on files.
2276
2277@item maxgroups
2278@cindex Mount flags; maxgroups
2279Set the maximum number of groups to allow for this mount.
2280
2281@item nfsv3
2282@cindex Mount flags; nfsv3
2283Use NFS Version 3 for this mount.
2284
2285@item noac
2286@cindex Mount flags; noac
2287Turn off the attribute cache.
2288
2289@item noauto
2290@cindex Mount flags; noauto
2291This option is used by the mount command in @samp{/etc/fstab} or
2292@samp{/etc/vfstab} and means not to mount this file system when mount -a
2293is used.
2294
2295@item nocache
2296@cindex Mount flags; nocache
2297Do not allow data to be cached from a remote server for this
2298mount.
2299
2300@item noconn
2301@cindex Mount flags; noconn
2302Don't make a connection on datagram transports.
2303
2304@item nocto
2305@cindex Mount flags; nocto
2306No close-to-open consistency.
2307
2308@item nodefperm
2309@cindex Mount flags; nodefperm
2310Do not ignore the permission mode bits.  Useful for CD-ROMS formatted as
2311ISO-9660.
2312
2313@item nodev
2314@cindex Mount flags; nodev
2315@itemx nodevs
2316@cindex Mount flags; nodevs
2317Don't allow local special devices on this filesystem.
2318
2319@item noint
2320@cindex Mount flags; noint
2321Do not allow keyboard interrupts for this mount
2322
2323@item norrip
2324@cindex Mount flags; norrip
2325Turn off using of the Rock Ridge Interchange Protocol (RRIP) extensions
2326to ISO-9660.
2327
2328@item nosub
2329@cindex Mount flags; nosub
2330Disallow mounts beneath this mount.
2331
2332@item nosuid
2333@cindex Mount flags; nosuid
2334Don't allow set-uid or set-gid executables on this filesystem.
2335
2336@item noversion
2337@cindex Mount flags; noversion
2338Strip the extension @samp{;#} from the version string of files recorded
2339on an ISO-9660 CD-ROM.
2340
2341@item overlay
2342@cindex Mount flags; overlay
2343Overlay this mount on top of an existing mount, if any.
2344
2345@item pgthresh=@var{n}
2346@cindex Mount flags; pgthresh
2347Set the paging threshold to @var{n} kilobytes.
2348
2349@item port=@var{n}
2350@cindex Mount flags; port
2351Set the NFS port to @var{n}.
2352
2353@item posix
2354@cindex Mount flags; posix
2355Turn on POSIX static pathconf for mounts.
2356
2357@item proto=@var{s}
2358@cindex Mount flags; proto
2359Use transport protocol @var{s} for NFS (can be @code{"tcp"} or @code{"udp"}).
2360
2361@item quota
2362@cindex Mount flags; quota
2363Enable quota checking on this mount.
2364
2365@item rdonly
2366@cindex Mount flags; rdonly
2367@itemx ro
2368@cindex Mount flags; ro
2369Mount this filesystem readonly.
2370
2371@item resvport
2372@cindex Mount flags; resvport
2373Use a reserved port (smaller than 1024) for remote NFS mounts.  Most
2374systems assume that, but some allow for mounts to occur on non-reserved
2375ports.   This causes problems when such a system tries to NFS mount one
2376that requires reserved ports.  It is recommended that this option always
2377be on.
2378
2379@item retrans=@i{n}
2380@cindex Mount flags; retrans
2381The number of NFS retransmits made before a user error is generated by a
2382@samp{soft} mounted filesystem, and before a @samp{hard} mounted
2383filesystem reports @samp{NFS server @dfn{yoyo} not responding still
2384trying}.
2385
2386@item retry
2387@cindex Mount flags; retry
2388Set the NFS retry counter.
2389
2390@item rrip
2391@cindex Mount flags; rrip
2392Uses the Rock Ridge Interchange Protocol (RRIP) extensions to ISO-9660.
2393
2394@item rsize=@var{n}
2395@cindex Mount flags; rsize
2396The NFS read packet size.  You may need to set this if you are using
2397NFS/UDP through a gateway or a slow link.
2398
2399@item rw
2400@cindex Mount flags; rw
2401Allow reads and writes on this filesystem.
2402
2403@item soft
2404@cindex Mount flags; soft
2405Give up after @dfn{retrans} retransmissions.
2406
2407@item spongy
2408@cindex Mount flags; spongy
2409Like @samp{soft} for status requests, and @samp{hard} for data transfers.
2410
2411@item suid
2412@cindex Mount flags; suid
2413Allow set-uid programs on this mount.
2414
2415@item symttl
2416@cindex Mount flags; symttl
2417Turn of the symbolic link cache time-to-live.
2418
2419@item sync
2420@cindex Mount flags; sync
2421Perform synchronous filesystem operations on this mount.
2422
2423@item tcp
2424@cindex Mount flags; tcp
2425Use TCP/IP instead of UDP/IP, ignored if the NFS implementation does not
2426support TCP/IP mounts.
2427
2428@item timeo=@var{n}
2429@cindex Mount flags; timeo
2430The NFS timeout, in tenth-seconds, before a request is retransmitted.
2431
2432@item vers=@var{n}
2433@cindex Mount flags; vers
2434 Use NFS protocol version number @var{n} (can be 2 or 3).
2435
2436@item wsize=@var{n}
2437@cindex Mount flags; wsize
2438The NFS write packet size.  You may need to set this if you are using
2439NFS/UDP through a gateway or a slow link.
2440
2441@end table
2442
2443The following options are implemented by @i{Amd}, rather than being
2444passed to the kernel.
2445
2446@table @code
2447
2448@item nounmount
2449@cindex Mount flags; nounmount
2450Configures the mount so that its time-to-live will
2451never expire.  This is also the default for some filesystem types.
2452@c
2453@c Implementation broken:
2454
2455@item ping=@var{n}
2456@cindex Mount flags; ping
2457The interval, in seconds, between keep-alive pings.  When four
2458consecutive pings have failed the mount point is marked as hung.  This
2459interval defaults to 30 seconds.  If the ping interval is less than zero,
2460no pings are sent and the host is assumed to be always
2461up.  By default, pings are not sent for an NFS/TCP mount.
2462
2463@item retry=@var{n}
2464@cindex Mount flags; retry=@var{n}
2465The number of times to retry the mount system call.
2466
2467@item utimeout=@var{n}
2468@cindex Mount flags; utimeout=@var{n}
2469The interval, in seconds, by which the mount's
2470time-to-live is extended after an unmount attempt
2471has failed.  In fact the interval is extended before the unmount is
2472attempted to avoid thrashing.  The default value is 120 seconds (two
2473minutes) or as set by the @code{-w} command line option.
2474
2475@end table
2476
2477@node remopts Option, sublink Option, opts Option, Map Options
2478@comment  node-name,  next,  previous,  up
2479@subsubsection remopts Option
2480@cindex Setting system mount options for non-local networks
2481@cindex remopts, mount option
2482@cindex Mount option; remopts
2483
2484This option has the same use as @code{$@{opts@}} but applies only when
2485the remote host is on a non-local network.  For example, when using NFS
2486across a gateway it is often necessary to use smaller values for the
2487data read and write sizes.  This can simply be done by specifying the
2488small values in @var{remopts}.  When a non-local host is accessed, the
2489smaller sizes will automatically be used.
2490
2491@i{Amd} determines whether a host is local by examining the network
2492interface configuration at startup.  Any interface changes made after
2493@i{Amd} has been started will not be noticed.  The likely effect will
2494be that a host may incorrectly be declared non-local.
2495
2496Unless otherwise set, the value of @code{$@{remopts@}} is the same as
2497the value of @code{$@{opts@}}.
2498
2499@node sublink Option, type Option, remopts Option, Map Options
2500@comment  node-name,  next,  previous,  up
2501@subsubsection sublink Option
2502@cindex Setting the sublink option
2503@cindex sublink, mount option
2504@cindex Mount option; sublink
2505
2506The subdirectory within the mounted filesystem to which the reference
2507should point.  This can be used to prevent duplicate mounts in cases
2508where multiple directories in the same mounted filesystem are used.
2509
2510@node type Option, , sublink Option, Map Options
2511@comment  node-name,  next,  previous,  up
2512@subsubsection type Option
2513@cindex Setting the filesystem type option
2514@cindex type, mount option
2515@cindex Mount option; type
2516
2517The filesystem type to be used.  @xref{Filesystem Types}, for a full
2518description of each type.@refill
2519
2520@c ################################################################
2521@node Amd Command Line Options, Filesystem Types, Mount Maps, Top
2522@comment  node-name,  next,  previous,  up
2523@chapter @i{Amd} Command Line Options
2524@cindex Command line options, Amd
2525@cindex Amd command line options
2526@cindex Overriding defaults on the command line
2527
2528Many of @i{Amd}'s parameters can be set from the command line.  The
2529command line is also used to specify automount points and maps.
2530
2531The general format of a command line is
2532
2533@example
2534amd [@i{options}] [@{ @i{directory} @i{map-name} [-@i{map-options}] @} ...]
2535@end example
2536
2537For each directory and map-name given or specified in the
2538@file{amd.conf} file, @i{Amd} establishes an automount point.  The
2539@dfn{map-options} may be any sequence of options or
2540selectors---@pxref{Location Format}.  The @dfn{map-options} apply only
2541to @i{Amd}'s mount point.
2542
2543@samp{type:=toplvl;cache:=mapdefault;fs:=$@{map@}} is the default value for the
2544map options.  Default options for a map are read from a special entry in
2545the map whose key is the string @samp{/defaults}.  When default options
2546are given they are prepended to any options specified in the mount-map
2547locations as explained in @ref{Map Defaults}.
2548
2549The @dfn{options} are any combination of those listed below.
2550
2551Once the command line has been parsed, the automount points are mounted.
2552The mount points are created if they do not already exist, in which case they
2553will be removed when @i{Amd} exits.
2554Finally, @i{Amd} disassociates itself from its controlling terminal and
2555forks into the background.
2556
2557Note: Even if @i{Amd} has been built with @samp{-DDEBUG} (via
2558@code{configure --enable-debug}), it will still background itself and
2559disassociate itself from the controlling terminal.  To use a debugger it
2560is necessary to specify @samp{-D nodaemon} on the command line.
2561However, even with all of this, mounts and unmounts are performed in the
2562background, and @i{Amd} will always fork before doing them.  Therefore,
2563debugging what happens closely during un/mounts is more challenging.
2564
2565@emph{All} of @i{Amd}'s command options (save @code{-F} and @code{-T})
2566can be specified in the @file{amd.conf} file. @xref{Amd Configuration
2567File}.  If @i{Amd} is invoked without any command line options, it will
2568default to using the configuration file @file{/etc/amd.conf}, if one
2569exists.
2570
2571@menu
2572* -a Option::   Automount directory.
2573* -c Option::   Cache timeout interval.
2574* -d Option::   Domain name.
2575* -k Option::   Kernel architecture.
2576* -l Option::   Log file.
2577* -n Option::   Hostname normalization.
2578* -o Option::   Operating system version.
2579* -p Option::   Output process id.
2580* -r Option::   Restart existing mounts.
2581* -t Option::   Kernel RPC timeout.
2582* -v Option::   Version information.
2583* -w Option::   Wait interval after failed unmount.
2584* -x Option::   Log options.
2585* -y Option::   NIS domain.
2586* -C-Option::   Cluster name.
2587* -D-Option::   Debug flags.
2588* -F Option::   Amd configuration file.
2589* -H Option::   Show brief help.
2590* -O-Option::   Operating system name.
2591* -S Option::   Lock executable pages in memory.
2592* -T-Option::   Set tag for configuration file.
2593@end menu
2594
2595@c ----------------------------------------------------------------
2596@node -a Option, -c Option, Amd Command Line Options, Amd Command Line Options
2597@comment  node-name,  next,  previous,  up
2598@section @code{-a} @var{directory}
2599@cindex Automount directory
2600@cindex Setting the default mount directory
2601
2602Specifies the default mount directory.  This option changes the variable
2603@code{$@{autodir@}} which otherwise defaults to @file{/a}.  For example,
2604some sites prefer @file{/amd} or @file{/n}.
2605
2606@example
2607amd -a /amd ...
2608@end example
2609
2610@c ----------------------------------------------------------------
2611@node -c Option, -d Option, -a Option, Amd Command Line Options
2612@comment  node-name,  next,  previous,  up
2613@section @code{-c} @var{cache-interval}
2614@cindex Cache interval
2615@cindex Interval before a filesystem times out
2616@cindex Setting the interval before a filesystem times out
2617@cindex Changing the interval before a filesystem times out
2618
2619Selects the period, in seconds, for which a name is cached by @i{Amd}.
2620If no reference is made to the volume in this period, @i{Amd} discards
2621the volume name to filesystem mapping.
2622
2623Once the last reference to a filesystem has been removed, @i{Amd}
2624attempts to unmount the filesystem.  If the unmount fails the interval
2625is extended by a further period as specified by the @samp{-w} command
2626line option or by the @samp{utimeout} mount option.
2627
2628The default @dfn{cache-interval} is 300 seconds (five minutes).
2629
2630@c ----------------------------------------------------------------
2631@node -d Option, -k Option, -c Option, Amd Command Line Options
2632@comment  node-name,  next,  previous,  up
2633@section @code{-d} @var{domain}
2634@cindex Domain name
2635@cindex Setting the local domain name
2636@cindex Overriding the local domain name
2637
2638Specifies the host's domain.  This sets the internal variable
2639@code{$@{domain@}} and affects the @code{$@{hostd@}} variable.
2640
2641If this option is not specified and the hostname already contains the
2642local domain then that is used, otherwise the default value of
2643@code{$@{domain@}} is @samp{unknown.domain}.
2644
2645For example, if the local domain was @samp{doc.ic.ac.uk}, @i{Amd} could
2646be started as follows:
2647
2648@example
2649amd -d doc.ic.ac.uk ...
2650@end example
2651
2652@c ----------------------------------------------------------------
2653@node -k Option, -l Option, -d Option, Amd Command Line Options
2654@comment  node-name,  next,  previous,  up
2655@section @code{-k} @var{kernel-architecture}
2656@cindex Setting the Kernel architecture
2657
2658Specifies the kernel architecture of the system.  This is usually the
2659output of @samp{uname -m} (the ``machine'' value gotten from
2660@b{uname}(2)).  If the @b{uname}(2) system call is not available, the
2661value of @code{$@{karch@}} defaults to that of @code{$@{arch@}}.
2662
2663The only effect of this option is to set the variable @code{$@{karch@}}.
2664
2665This option would be used as follows:
2666
2667@example
2668amd -k `arch -k` ...
2669@end example
2670
2671@c ----------------------------------------------------------------
2672@node -l Option, -n Option, -k Option, Amd Command Line Options
2673@comment  node-name,  next,  previous,  up
2674@section @code{-l} @var{log-option}
2675@cindex Log filename
2676@cindex Setting the log file
2677@cindex Using syslog to log errors
2678@cindex syslog
2679
2680Selects the form of logging to be made.  Several special @dfn{log-options}
2681are recognized.
2682
2683@enumerate
2684@item
2685If @dfn{log-option} is the string @samp{syslog}, @i{Amd} will use the
2686@b{syslog}(3) mechanism.  If your system supports syslog facilities, then
2687the default facility used is @samp{LOG_DAEMON}.
2688
2689@item
2690@cindex syslog facility; specifying an alternate
2691When using syslog, if you wish to change the facility, append its name
2692to the log option name, delimited by a single colon.  For example, if
2693@dfn{log-options} is the string @samp{syslog:local7} then @b{Amd} will
2694log messages via @b{syslog}(3) using the @samp{LOG_LOCAL7} facility.  If
2695the facility name specified is not recognized, @i{Amd} will default to
2696@samp{LOG_DAEMON}.  Note: while you can use any syslog facility
2697available on your system, it is generally a bad idea to use those
2698reserved for other services such as @samp{kern}, @samp{lpr},
2699@samp{cron}, etc.
2700
2701@item
2702If @dfn{log-option} is the string @samp{/dev/stderr}, @i{Amd} will use
2703standard error, which is also the default target for log messages.  To
2704implement this, @i{Amd} simulates the effect of the @samp{/dev/fd}
2705driver.
2706@end enumerate
2707
2708Any other string is taken as a filename to use for logging.  Log
2709messages are appended to the file if it already exists, otherwise a new
2710file is created.  The file is opened once and then held open, rather
2711than being re-opened for each message.
2712
2713Normally, when long-running daemons hold an open file descriptor on a
2714log file, it is impossible to ``rotate'' the log file and compress older
2715logs on a daily basis.  The daemon needs to be told to discard (via
2716@b{close}(2)) its file handle, and re-open the log file.  This is done
2717using @code{amq -l} @i{log-option}. @xref{Amq -l option}.
2718
2719If the @samp{syslog} option is specified but the system does not support
2720syslog or if the named file cannot be opened or created, @i{Amd} will
2721use standard error.  Error messages generated before @i{Amd} has
2722finished parsing the command line are printed on standard error.
2723
2724Since @i{Amd} tends to generate a lot of logging information (especially
2725if debugging was turned on), and due to it being an important program
2726running on the system, it is usually best to log to a separate disk
2727file.  In that case @i{Amd} would be started as follows:
2728
2729@example
2730amd -l /var/log/amd ...
2731@end example
2732
2733@c ----------------------------------------------------------------
2734@node -n Option, -o Option, -l Option, Amd Command Line Options
2735@comment  node-name,  next,  previous,  up
2736@section @code{-n}
2737@cindex Hostname normalization
2738@cindex Aliased hostnames
2739@cindex Resolving aliased hostnames
2740@cindex Normalizing hostnames
2741
2742Normalizes the remote hostname before using it.  Normalization is done
2743by replacing the value of @code{$@{rhost@}} with the (generally fully
2744qualified) primary name returned by a hostname lookup.
2745
2746This option should be used if several names are used to refer to a
2747single host in a mount map.
2748
2749@c ----------------------------------------------------------------
2750@node -o Option, -p Option, -n Option, Amd Command Line Options
2751@comment  node-name,  next,  previous,  up
2752@section @code{-o} @var{op-sys-ver}
2753@cindex Operating System version
2754@cindex Setting the Operating System version
2755
2756Overrides the compiled-in version number of the operating system, with
2757@var{op-sys-ver}.  Useful when the built-in version is not desired for
2758backward compatibility reasons.  For example, if the built-in version is
2759@samp{2.5.1}, you can override it to @samp{5.5.1}, and use older maps
2760that were written with the latter in mind.
2761
2762@c ----------------------------------------------------------------
2763@node -p Option, -r Option, -o Option, Amd Command Line Options
2764@comment  node-name,  next,  previous,  up
2765@section @code{-p}
2766@cindex Process id
2767@cindex Displaying the process id
2768@cindex process id of Amd daemon
2769@cindex pid file, creating with -p option
2770@cindex Creating a pid file
2771
2772Causes @i{Amd}'s process id to be printed on standard output.
2773This can be redirected to a suitable file for use with kill:
2774
2775@example
2776amd -p > /var/run/amd.pid ...
2777@end example
2778
2779This option only has an affect if @i{Amd} is running in daemon mode.
2780If @i{Amd} is started with the @code{-D nodaemon} debug flag, this
2781option is ignored.
2782
2783@c ----------------------------------------------------------------
2784@node -r Option, -t Option, -p Option, Amd Command Line Options
2785@comment  node-name,  next,  previous,  up
2786@section @code{-r}
2787@cindex Restarting existing mounts
2788@cindex Picking up existing mounts
2789
2790Tells @i{Amd} to restart existing mounts (@pxref{Inheritance Filesystem}).
2791@c @dfn{This option will be made the default in the next release.}
2792
2793@c ----------------------------------------------------------------
2794@node -t Option, -v Option, -r Option, Amd Command Line Options
2795@comment  node-name,  next,  previous,  up
2796@section @code{-t} @var{timeout.retransmit}
2797@cindex Setting Amd's RPC parameters
2798
2799Specifies the RPC @dfn{timeout} interval and the @dfn{retransmit}
2800counter used by the kernel to communicate to @i{Amd}.  These are used to
2801set the @samp{timeo} and @samp{retrans} mount options, respectively.
2802The default timeout is 0.8 seconds, and the default number of
2803retransmissions is 11.
2804
2805@i{Amd} relies on the kernel RPC retransmit mechanism to trigger mount
2806retries.  The values of these parameters change the overall retry
2807interval.  Too long an interval gives poor interactive response; too
2808short an interval causes excessive retries.
2809
2810@c ----------------------------------------------------------------
2811@node -v Option, -w Option, -t Option, Amd Command Line Options
2812@comment  node-name,  next,  previous,  up
2813@section @code{-v}
2814@cindex Version information
2815@cindex Discovering version information
2816@cindex How to discover your version of Amd
2817
2818Print version information on standard error and then exit.  The output
2819is of the form:
2820
2821@example
2822Copyright (c) 1997-1999 Erez Zadok
2823Copyright (c) 1990 Jan-Simon Pendry
2824Copyright (c) 1990 Imperial College of Science, Technology & Medicine
2825Copyright (c) 1990 The Regents of the University of California.
2826am-utils version 6.0a15 (build 61).
2827Built by ezk@@cs.columbia.edu on date Wed Oct 22 15:21:03 EDT 1997.
2828cpu=sparc (big-endian), arch=sun4, karch=sun4u.
2829full_os=solaris2.5.1, os=sos5, osver=5.5.1, vendor=sun.
2830Map support for: root, passwd, union, nisplus, nis, ndbm, file, error.
2831AMFS: nfs, link, nfsx, nfsl, host, linkx, program, union, inherit, 
2832      ufs, lofs, hsfs, pcfs, auto, direct, toplvl, error.
2833FS: autofs, cachefs, cdfs, lofs, nfs, nfs3, pcfs, tfs, tmpfs, ufs.
2834Network 1: wire="mcl-lab-net.cs.columbia.edu" (netnumber=128.59.13).
2835Network 2: wire="14-net.cs.columbia.edu" (netnumber=128.59.14).
2836Network 3: wire="old-net.cs.columbia.edu" (netnumber=128.59.16).
2837@end example
2838
2839The information includes the version number, number of times @i{Amd} was
2840compiled on the local system, release date and name of the release.
2841Following come the cpu type, byte ordering, and the architecture and
2842kernel architecture as @code{$@{arch@}} and @code{$@{karch@}},
2843respectively.  The next line lists the operating system full name, short
2844name, version, and vendor.  These four values correspond to the
2845variables @code{$@{full_os@}}, @code{$@{os@}}, @code{$@{osver@}}, and
2846@code{$@{vendor@}}, respectively.  @xref{Supported Platforms}.
2847
2848Then come a list of map types supported, filesystems internally
2849supported by @i{Amd} (AMFS), and generic filesystems available (FS).
2850Finally all known networks (if any) of this host are listed by name
2851and number.  They are available via the variables
2852@code{$@{wire@}} or @code{$@{network@}}, and
2853@code{$@{netnumber@}} (@pxref{Selectors}) or the @samp{in_network}
2854selector function (@pxref{in_network Selector Function}).
2855
2856@c ----------------------------------------------------------------
2857@node -w Option, -x Option, -v Option, Amd Command Line Options
2858@comment  node-name,  next,  previous,  up
2859@section @code{-w} @var{wait-timeout}
2860@cindex Setting the interval between unmount attempts
2861@cindex unmount attempt backoff interval
2862
2863Selects the interval in seconds between unmount attempts after the
2864initial time-to-live has expired.
2865
2866This defaults to 120 seconds (two minutes).
2867
2868@c ----------------------------------------------------------------
2869@node -x Option, -y Option, -w Option, Amd Command Line Options
2870@comment  node-name,  next,  previous,  up
2871@section @code{-x} @var{opts}
2872@cindex Log message selection
2873@cindex Selecting specific log messages
2874@cindex How to select log messages
2875@cindex syslog priorities
2876
2877Specifies the type and verbosity of log messages.  @dfn{opts} is
2878a comma separated list selected from the following options:
2879
2880@table @code
2881@item fatal
2882Fatal errors
2883@item error
2884Non-fatal errors
2885@item user
2886Non-fatal user errors
2887@item warn
2888Recoverable errors
2889@item warning
2890Alias for @code{warn}
2891@item info
2892Information messages
2893@item map
2894Mount map usage
2895@item stats
2896Additional statistics
2897@item all
2898All of the above
2899@end table
2900
2901Initially a set of default logging flags is enabled.  This is as if
2902@samp{-x all,nomap,nostats} had been selected.  The command line is
2903parsed and logging is controlled by the @code{-x} option.  The very first
2904set of logging flags is saved and can not be subsequently disabled using
2905@i{Amq}.  This default set of options is useful for general production
2906use.@refill
2907
2908The @samp{info} messages include details of what is mounted and
2909unmounted and when filesystems have timed out.  If you want to have the
2910default set of messages without the @samp{info} messages then you simply
2911need @samp{-x noinfo}.  The messages given by @samp{user} relate to
2912errors in the mount maps, so these are useful when new maps are
2913installed.  The following table lists the syslog priorities used for each
2914of the message types.@refill
2915
2916@table @code
2917@item fatal
2918@samp{LOG_CRIT}
2919@item error
2920@samp{LOG_ERR}
2921@item user
2922@samp{LOG_WARNING}
2923@item warning
2924@samp{LOG_WARNING}
2925@item info
2926@samp{LOG_INFO}
2927@item debug
2928@samp{LOG_DEBUG}
2929@item map
2930@samp{LOG_DEBUG}
2931@item stats
2932@samp{LOG_INFO}
2933@end table
2934
2935
2936The options can be prefixed by the string @samp{no} to indicate
2937that this option should be turned off.  For example, to obtain all
2938but @samp{info} messages the option @samp{-x all,noinfo} would be used.
2939
2940If @i{Amd} was built with debugging enabled the @code{debug} option is
2941automatically enabled regardless of the command line options.
2942
2943@c ----------------------------------------------------------------
2944@node -y Option, -C-Option, -x Option, Amd Command Line Options
2945@comment  node-name,  next,  previous,  up
2946@section @code{-y} @var{NIS-domain}
2947@cindex NIS (YP) domain name
2948@cindex Overriding the NIS (YP) domain name
2949@cindex Setting the NIS (YP) domain name
2950@cindex YP domain name
2951
2952Selects an alternate NIS domain.  This is useful for debugging and
2953cross-domain shared mounting.  If this flag is specified, @i{Amd}
2954immediately attempts to bind to a server for this domain.
2955@c @i{Amd} refers to NIS maps when it starts, unless the @code{-m} option
2956@c is specified, and whenever required in a mount map.
2957
2958@c ----------------------------------------------------------------
2959@node -C-Option, -D-Option, -y Option, Amd Command Line Options
2960@comment  node-name,  next,  previous,  up
2961@section @code{-C} @var{cluster-name}
2962@cindex Cluster names
2963@cindex Setting the cluster name
2964
2965Specifies the name of the cluster of which the local machine is a member.
2966The only effect is to set the variable @code{$@{cluster@}}.
2967The @dfn{cluster-name} is will usually obtained by running another command which uses
2968a database to map the local hostname into a cluster name.
2969@code{$@{cluster@}} can then be used as a selector to restrict mounting of
2970replicated data.
2971If this option is not given, @code{$@{cluster@}} has the same value as @code{$@{domain@}}.
2972This would be used as follows:
2973
2974@example
2975amd -C `clustername` ...
2976@end example
2977
2978@c ----------------------------------------------------------------
2979@node -D-Option, -F Option, -C-Option, Amd Command Line Options
2980@comment  node-name,  next,  previous,  up
2981@section @code{-D} @var{opts}
2982@cindex Debug options
2983@cindex Setting debug flags
2984
2985Controls the verbosity and coverage of the debugging trace; @dfn{opts}
2986is a comma separated list of debugging options.  The @code{-D} option is
2987only available if @i{Amd} was compiled with @samp{-DDEBUG}, or
2988configured with @code{configure --enable-debug}.  The memory debugging
2989facilities (@samp{mem}) are only available if @i{Amd} was compiled with
2990@samp{-DDEBUG_MEM} (in addition to @samp{-DDEBUG}), or configured with
2991@code{configure --enable-debug=mem}.
2992
2993The most common options to use are @samp{-D trace} and @samp{-D test}
2994(which turns on all the useful debug options).  As usual, every option
2995can be prefixed with @samp{no} to turn it off.
2996
2997@table @code
2998@item all
2999all options
3000@item amq
3001register for amq
3002@item daemon
3003enter daemon mode
3004@item fork
3005fork server
3006@item full
3007program trace
3008@item info
3009@cindex debugging hesiod resolver service
3010@cindex Hesiod: turning on RES_DEBUG
3011info service specific debugging (hesiod, nis, etc.)  In the case of
3012hesiod maps, turns on the hesiod RES_DEBUG internal debugging option.
3013@item mem
3014trace memory allocations
3015@item mtab
3016use local @file{./mtab} file
3017@item str
3018debug string munging
3019@item test
3020full debug but no daemon
3021@item trace
3022trace RPC protocol and NFS mount arguments
3023@end table
3024
3025You may also refer to the program source for a more detailed explanation
3026of the available options.
3027
3028@c ----------------------------------------------------------------
3029@node -F Option, -H Option, -D-Option, Amd Command Line Options
3030@comment  node-name,  next,  previous,  up
3031@section @code{-F} @var{conf-file}
3032@cindex Amd configuration file; specifying name
3033@cindex Amd configuration file
3034@cindex amd.conf file
3035
3036Specify an @i{Amd} configuration file @var{conf-file} to use.  For a
3037description of the format and syntax, @pxref{Amd Configuration File}.
3038This configuration file is used to specify any options in lieu of typing
3039many of them on the command line.  The @file{amd.conf} file includes
3040directives for every command line option @i{Amd} has, and many more that
3041are only available via the configuration file facility.  The
3042configuration file specified by this option is processed after all other
3043options had been processed, regardless of the actual location of this
3044option on the command line.
3045
3046@c ----------------------------------------------------------------
3047@node -H Option, -O-Option, -F Option, Amd Command Line Options
3048@comment  node-name,  next,  previous,  up
3049@section @code{-H}
3050@cindex Displaying brief help
3051@cindex Help; showing from Amd
3052
3053Print a brief help and usage string.
3054
3055@c ----------------------------------------------------------------
3056@node -O-Option, -S Option, -H Option, Amd Command Line Options
3057@comment  node-name,  next,  previous,  up
3058@section @code{-O} @var{op-sys-name}
3059@cindex Operating System name
3060@cindex Setting the Operating System name
3061
3062Overrides the compiled-in name of the operating system, with
3063@var{op-sys-name}.  Useful when the built-in name is not desired for
3064backward compatibility reasons.  For example, if the build in name is
3065@samp{sunos5}, you can override it to the old name @samp{sos5}, and use
3066older maps which were written with the latter in mind.
3067
3068@c ----------------------------------------------------------------
3069@node -S Option, -T-Option, -O-Option, Amd Command Line Options
3070@comment  node-name,  next,  previous,  up
3071@section @code{-S}
3072@cindex plock; using
3073@cindex locking executable pages in memory
3074
3075Do @emph{not} lock the running executable pages of @i{Amd} into memory.
3076To improve @i{Amd}'s performance, systems that support the @b{plock}(3)
3077call lock the @i{Amd} process into memory.  This way there is less
3078chance the operating system will schedule, page out, and swap the
3079@i{Amd} process as needed.  This tends to improve @i{Amd}'s performance,
3080at the cost of reserving the memory used by the @i{Amd} process (making
3081it unavailable for other processes).  If this behavior is not desired,
3082use the @code{-S} option.
3083
3084@c ----------------------------------------------------------------
3085@node -T-Option, , -S Option, Amd Command Line Options
3086@comment  node-name,  next,  previous,  up
3087@section @code{-T} @var{tag}
3088@cindex Tags for Amd configuration file
3089@cindex Configuration file; tags
3090 
3091Specify a tag to use with @file{amd.conf}.  All map entries tagged with
3092@var{tag} will be processed.  Map entries that are not tagged are always
3093processed.  Map entries that are tagged with a tag other than @var{tag}
3094will not be processed.
3095
3096@c ################################################################
3097@node Filesystem Types, Amd Configuration File, Amd Command Line Options, Top
3098@comment  node-name,  next,  previous,  up
3099@chapter Filesystem Types
3100@cindex Filesystem types
3101@cindex Mount types
3102@cindex Types of filesystem
3103
3104To mount a volume, @i{Amd} must be told the type of filesystem to be
3105used.  Each filesystem type typically requires additional information
3106such as the fileserver name for NFS.
3107
3108From the point of view of @i{Amd}, a @dfn{filesystem} is anything that
3109can resolve an incoming name lookup.  An important feature is support
3110for multiple filesystem types.  Some of these filesystems are
3111implemented in the local kernel and some on remote fileservers, whilst
3112the others are implemented internally by @i{Amd}.@refill
3113
3114The two common filesystem types are UFS and NFS.  Four other user
3115accessible filesystems (@samp{link}, @samp{program}, @samp{auto} and
3116@samp{direct}) are also implemented internally by @i{Amd} and these are
3117described below.  There are two additional filesystem types internal to
3118@i{Amd} which are not directly accessible to the user (@samp{inherit}
3119and @samp{error}).  Their use is described since they may still have an
3120effect visible to the user.@refill
3121
3122@menu
3123* Network Filesystem::          A single NFS filesystem.
3124* Network Host Filesystem::     NFS mount a host's entire export tree.
3125* Network Filesystem Group::    An atomic group of NFS filesystems.
3126* Unix Filesystem::             Native disk filesystem.
3127* Caching Filesystem::          Caching from remote server filesystem.
3128* CD-ROM Filesystem::           ISO9660 CD ROM.
3129* Loopback Filesystem::         Local loopback-mount filesystem.
3130* Memory/RAM Filesystem::       A memory or RAM-based filesystem.
3131* Null Filesystem::             4.4BSD's loopback-mount filesystem.
3132* Floppy Filesystem::           MS-DOS Floppy filesystem.
3133* Translucent Filesystem::      The directory merging filesystem.
3134* Shared Memory+Swap Filesystem:: Sun's tmpfs filesystem.
3135* User ID Mapping Filesystem::  4.4BSD's umapfs filesystem.
3136* Program Filesystem::          Generic Program mounts.
3137* Symbolic Link Filesystem::    Local link.
3138* Symbolic Link Filesystem II:: Local link referencing existing filesystem.
3139* NFS-Link Filesystem::         Link if path exists, NFS otherwise.
3140* Automount Filesystem::
3141* Direct Automount Filesystem::
3142* Union Filesystem::
3143* Error Filesystem::
3144* Top-level Filesystem::
3145* Autofs Filesystem::           Sun's kernel-based automounter filesystem.
3146* Root Filesystem::
3147* Inheritance Filesystem::
3148@end menu
3149
3150@c ----------------------------------------------------------------
3151@node Network Filesystem, Network Host Filesystem, Filesystem Types, Filesystem Types
3152@comment  node-name,  next,  previous,  up
3153@section Network Filesystem (@samp{nfs})
3154@cindex NFS
3155@cindex Mounting an NFS filesystem
3156@cindex How to mount and NFS filesystem
3157@cindex nfs, filesystem type
3158@cindex Filesystem type; nfs
3159
3160The @dfn{nfs} (@samp{type:=nfs}) filesystem type provides access to Sun's NFS.
3161
3162@noindent
3163The following options must be specified:
3164
3165@table @code
3166@cindex rhost, mount option
3167@cindex Mount option; rhost
3168@item rhost
3169the remote fileserver.  This must be an entry in the hosts database.  IP
3170addresses are not accepted.  The default value is taken
3171from the local host name (@code{$@{host@}}) if no other value is
3172specified.
3173
3174@cindex rfs, mount option
3175@cindex Mount option; rfs
3176@item rfs
3177the remote filesystem.
3178If no value is specified for this option, an internal default of
3179@code{$@{path@}} is used.
3180@end table
3181
3182NFS mounts require a two stage process.  First, the @dfn{file handle} of
3183the remote file system must be obtained from the server.  Then a mount
3184system call must be done on the local system.  @i{Amd} keeps a cache
3185of file handles for remote file systems.  The cache entries have a
3186lifetime of a few minutes.
3187
3188If a required file handle is not in the cache, @i{Amd} sends a request
3189to the remote server to obtain it.  @i{Amd} @dfn{does not} wait for
3190a response; it notes that one of the locations needs retrying, but
3191continues with any remaining locations.  When the file handle becomes
3192available, and assuming none of the other locations was successfully
3193mounted, @i{Amd} will retry the mount.  This mechanism allows several
3194NFS filesystems to be mounted in parallel.
3195@c @footnote{The mechanism
3196@c is general, however NFS is the only filesystem
3197@c for which the required hooks have been written.}
3198The first one which responds with a valid file handle will be used.
3199
3200@noindent
3201An NFS entry might be:
3202
3203@example
3204jsp  host!=charm;type:=nfs;rhost:=charm;rfs:=/home/charm;sublink:=jsp
3205@end example
3206
3207The mount system call and any unmount attempts are always done
3208in a new task to avoid the possibility of blocking @i{Amd}.
3209
3210@c ----------------------------------------------------------------
3211@node Network Host Filesystem, Network Filesystem Group, Network Filesystem, Filesystem Types
3212@comment  node-name,  next,  previous,  up
3213@section Network Host Filesystem (@samp{host})
3214@cindex Network host filesystem
3215@cindex Mounting entire export trees
3216@cindex How to mount all NFS exported filesystems
3217@cindex host, filesystem type
3218@cindex Filesystem type; host
3219
3220@c NOTE: the current implementation of the @dfn{host} filesystem type
3221@c sometimes fails to maintain a consistent view of the remote mount tree.
3222@c This happens when the mount times out and only some of the remote mounts
3223@c are successfully unmounted.  To prevent this from occurring, use the
3224@c @samp{nounmount} mount option.
3225
3226The @dfn{host} (@samp{type:=host}) filesystem allows access to the entire export tree of an
3227NFS server.  The implementation is layered above the @samp{nfs}
3228implementation so keep-alives work in the same way.  The only option
3229which needs to be specified is @samp{rhost} which is the name of the
3230fileserver to mount.
3231
3232The @samp{host} filesystem type works by querying the mount daemon on
3233the given fileserver to obtain its export list.  @i{Amd} then obtains
3234filehandles for each of the exported filesystems.  Any errors at this
3235stage cause that particular filesystem to be ignored.  Finally each
3236filesystem is mounted.  Again, errors are logged but ignored.  One
3237common reason for mounts to fail is that the mount point does not exist.
3238Although @i{Amd} attempts to automatically create the mount point, it
3239may be on a remote filesystem to which @i{Amd} does not have write
3240permission.
3241
3242When an attempt to unmount a @samp{host} filesystem mount fails, @i{Amd}
3243remounts any filesystems which had successfully been unmounted.  To do
3244this @i{Amd} queries the mount daemon again and obtains a fresh copy of
3245the export list.  @i{Amd} then tries to mount any exported filesystems
3246which are not currently mounted.
3247
3248Sun's automounter provides a special @samp{-hosts} map.  To achieve the
3249same effect with @i{Amd} requires two steps.  First a mount map must
3250be created as follows:
3251
3252@example
3253*       type:=host;rhost:=$@{key@};fs:=$@{autodir@}/$@{rhost@}/root
3254@end example
3255
3256@noindent
3257and then start @i{Amd} with the following command
3258
3259@example
3260amd /net net.map
3261@end example
3262
3263@noindent
3264where @samp{net.map} is the name of map described above.  Note that the
3265value of @code{$@{fs@}} is overridden in the map.  This is done to avoid
3266a clash between the mount tree and any other filesystem already mounted
3267from the same fileserver.
3268
3269If different mount options are needed for different hosts then
3270additional entries can be added to the map, for example
3271
3272@example
3273host2       opts:=ro,nosuid,soft
3274@end example
3275
3276@noindent
3277would soft mount @samp{host2} read-only.
3278
3279@c ----------------------------------------------------------------
3280@node Network Filesystem Group, Unix Filesystem, Network Host Filesystem, Filesystem Types
3281@comment  node-name,  next,  previous,  up
3282@section Network Filesystem Group (@samp{nfsx})
3283@cindex Network filesystem group
3284@cindex Atomic NFS mounts
3285@cindex Mounting an atomic group of NFS filesystems
3286@cindex How to mount an atomic group of NFS filesystems
3287@cindex nfsx, filesystem type
3288@cindex Filesystem type; nfsx
3289
3290The @dfn{nfsx} (@samp{type:=nfsx}) filesystem allows a group of filesystems to be mounted
3291from a single NFS server.  The implementation is layered above the
3292@samp{nfs} implementation so keep-alives work in the same way.
3293
3294The options are the same as for the @samp{nfs} filesystem with one
3295difference.
3296
3297@noindent
3298The following options must be specified:
3299
3300@table @code
3301@item rhost
3302the remote fileserver.  This must be an entry in the hosts database.  IP
3303addresses are not accepted.  The default value is taken from the local
3304host name (@code{$@{host@}}) if no other value is specified.
3305
3306@item rfs
3307as a list of filesystems to mount.  The list is in the form of a comma
3308separated strings.
3309@end table
3310
3311@noindent
3312For example:
3313
3314@example
3315pub  type:=nfsx;rhost:=gould;\
3316     rfs:=/public,/,graphics,usenet;fs:=$@{autodir@}/$@{rhost@}/root
3317@end example
3318
3319The first string defines the root of the tree, and is applied as a
3320prefix to the remaining members of the list which define the individual
3321filesystems.  The first string is @emph{not} used as a filesystem name.
3322A parallel operation is used to determine the local mount points to
3323ensure a consistent layout of a tree of mounts.
3324
3325Here, the @emph{three} filesystems, @samp{/public},
3326@samp{/public/graphics} and @samp{/public/usenet}, would be mounted.@refill
3327
3328A local mount point, @code{$@{fs@}}, @emph{must} be specified.  The
3329default local mount point will not work correctly in the general case.
3330A suggestion is to use @samp{fs:=$@{autodir@}/$@{rhost@}/root}.@refill
3331
3332@c ----------------------------------------------------------------
3333@node Unix Filesystem, Caching Filesystem, Network Filesystem Group, Filesystem Types
3334@comment  node-name,  next,  previous,  up
3335@section Unix Filesystem (@samp{ufs}, @samp{xfs}, or @samp{efs})
3336@cindex Unix filesystem
3337@cindex UFS
3338@cindex XFS
3339@cindex EFS
3340@cindex Mounting a UFS filesystem
3341@cindex Mounting a local disk
3342@cindex How to mount a UFS filesystems
3343@cindex How to mount a local disk
3344@cindex Disk filesystems
3345@cindex ufs, filesystem type
3346@cindex Filesystem type; ufs
3347@cindex xfs, filesystem type
3348@cindex Filesystem type; xfs
3349@cindex efs, filesystem type
3350@cindex Filesystem type; efs
3351
3352The @dfn{ufs} (@samp{type:=ufs}) filesystem type provides access to the system's standard
3353disk filesystem---usually a derivative of the Berkeley Fast Filesystem.
3354
3355@noindent
3356The following option must be specified:
3357
3358@table @code
3359@cindex dev, mount option
3360@cindex Mount option; dev
3361@item dev
3362the block special device to be mounted.
3363@end table
3364
3365A UFS entry might be:
3366
3367@example
3368jsp   host==charm;type:=ufs;dev:=/dev/sd0d;sublink:=jsp
3369@end example
3370
3371UFS is the default Unix disk-based file system, which Am-utils picks up
3372during the autoconfiguration phase.  Some systems have more than one
3373type, such as IRIX, that comes with EFS (Extent File System) and XFS
3374(Extended File System).  In those cases, you may explicitly set the file
3375system type, by using entries such:
3376
3377@example
3378ez1   type:=efs;dev:=/dev/xd0a
3379ez2   type:=xfs;dev:=/dev/sd3c
3380@end example
3381
3382@c ----------------------------------------------------------------
3383@node Caching Filesystem, CD-ROM Filesystem, Unix Filesystem, Filesystem Types
3384@comment  node-name,  next,  previous,  up
3385@section Caching Filesystem (@samp{cachefs})
3386@cindex Caching Filesystem
3387@cindex cachefs, filesystem type
3388@cindex Filesystem type; cachefs
3389
3390The @dfn{cachefs} (@samp{type:=cachefs}) filesystem caches files from
3391one location onto another, presumably providing faster access.  It is
3392particularly useful to cache from a larger and remote (slower) NFS
3393partition to a smaller and local (faster) UFS directory.
3394
3395@noindent
3396The following options must be specified:
3397
3398@table @code
3399@cindex cachedir, mount option
3400@cindex Mount option; cachedir
3401@item cachedir
3402the directory where the cache is stored.
3403@item rfs
3404the path name to the ``back file system'' to be cached from.
3405@item fs
3406the ``front file system'' mount point to the cached files, where @i{Amd}
3407will set a symbolic link pointing to.
3408@end table
3409
3410A CacheFS entry for, say, the @file{/import} @i{Amd} mount point, might
3411be:
3412
3413@example
3414copt  type:=cachefs;cachedir:=/cache;rfs:=/import/opt;fs:=/n/import/copt
3415@end example
3416
3417Access to the pathname @file{/import/copt} will follow a symbolic link
3418to @file{/n/import/copt}.  The latter is the mount point for a caching
3419file system, that caches from @file{/import/opt} to @file{/cache}.
3420
3421@b{Caveats}:
3422@enumerate
3423@item This file system is currently only implemented for Solaris 2.x!
3424@item Before being used for the first time, the cache directory @i{must} be
3425initialized with @samp{cfsadmin -c @var{cachedir}}.  See the manual page for
3426@b{cfsadmin}(1M) for more information.
3427@item The ``back file system'' mounted must be a complete file system, not
3428a subdirectory thereof; otherwise you will get an error ``Invalid Argument''.
3429@item If @i{Amd} aborts abnormally, the state of the cache may be
3430inconsistent, requiring running the command @file{fsck -F cachefs
3431@var{cachedir}}.  Otherwise you will get the error ``No Space Left on Device''.
3432@end enumerate
3433
3434@c ----------------------------------------------------------------
3435@node CD-ROM Filesystem, Loopback Filesystem, Caching Filesystem, Filesystem Types
3436@comment  node-name,  next,  previous,  up
3437@section CD-ROM Filesystem (@samp{cdfs})
3438@cindex CD-ROM Filesystem
3439@cindex cdfs, filesystem type
3440@cindex Filesystem type; cdfs
3441
3442The @dfn{cdfs} (@samp{type:=cdfs}) filesystem mounts a CD-ROM with an
3443ISO9660 format filesystem on it.
3444
3445@noindent
3446The following option must be specified:
3447
3448@table @code
3449@cindex dev, mount option
3450@cindex Mount option; dev
3451@item dev
3452the block special device to be mounted.
3453@end table
3454
3455Some operating systems will fail to mount read-only CDs unless the
3456@samp{ro} option is specified.  A cdfs entry might be:
3457
3458@example
3459cdfs      os==sunos4;type:=cdfs;dev:=/dev/sr0 \
3460          os==sunos5;addopts:=ro;type:=cdfs;dev:=/dev/dsk/c0t6d0s2
3461@end example
3462
3463@c ----------------------------------------------------------------
3464@node Loopback Filesystem, Memory/RAM Filesystem, CD-ROM Filesystem, Filesystem Types
3465@comment  node-name,  next,  previous,  up
3466@section Loopback Filesystem (@samp{lofs})
3467@cindex Loopback Filesystem
3468@cindex lofs, filesystem type
3469@cindex Filesystem type; lofs
3470
3471The @dfn{lofs} (@samp{type:=lofs}) filesystem is also called the
3472loopback filesystem.  It mounts a local directory on another, thus
3473providing mount-time binding to another location (unlike symbolic
3474links).
3475
3476The loopback filesystem is particularly useful within the context of a
3477chroot-ed directory (via @b{chroot}(2)), to provide access to
3478directories otherwise inaccessible.
3479
3480@noindent
3481The following option must be specified:
3482
3483@table @code
3484@cindex rfs, mount option
3485@cindex Mount option; rfs
3486@item rfs
3487the pathname to be mounted on top of @code{$@{fs@}}.
3488@end table
3489
3490Usually, the FTP server runs in a chroot-ed environment, for security
3491reasons.  In this example, lofs is used to provide a subdirectory within
3492a user's home directory, also available for public ftp.
3493
3494@example
3495lofs      type:=lofs;rfs:=/home/ezk/myftpdir;fs:=/usr/ftp/pub/ezk
3496@end example
3497
3498@c ----------------------------------------------------------------
3499@node Memory/RAM Filesystem, Null Filesystem, Loopback Filesystem, Filesystem Types
3500@comment  node-name,  next,  previous,  up
3501@section Memory/RAM Filesystem (@samp{mfs})
3502@cindex Memory/RAM Filesystem
3503@cindex mfs, filesystem type
3504@cindex Filesystem type; mfs
3505
3506The @dfn{mfs} (@samp{type:=mfs}) filesystem is available in 4.4BSD,
3507Linux, and other systems.  It creates a filesystem in a portion of the
3508system's memory, thus providing very fast file (volatile) access.
3509
3510XXX: THIS FILESYSTEM IS NOT IMPLEMENTED YET!
3511
3512@c ----------------------------------------------------------------
3513@node Null Filesystem, Floppy Filesystem, Memory/RAM Filesystem, Filesystem Types
3514@comment  node-name,  next,  previous,  up
3515@section Null Filesystem (@samp{nullfs})
3516@cindex Null Filesystem
3517@cindex nullfs, filesystem type
3518@cindex Filesystem type; nullfs
3519
3520The @dfn{nullfs} (@samp{type:=nullfs}) filesystem is available from 4.4BSD,
3521and is very similar to the loopback filesystem, @dfn{lofs}.
3522
3523XXX: THIS FILESYSTEM IS NOT IMPLEMENTED YET!
3524
3525@c ----------------------------------------------------------------
3526@node Floppy Filesystem, Translucent Filesystem, Null Filesystem, Filesystem Types
3527@comment  node-name,  next,  previous,  up
3528@section Floppy Filesystem (@samp{pcfs})
3529@cindex Floppy Filesystem
3530@cindex pcfs, filesystem type
3531@cindex Filesystem type; pcfs
3532
3533The @dfn{pcfs} (@samp{type:=pcfs}) filesystem mounts a floppy previously
3534formatted for the MS-DOS format.
3535
3536@noindent
3537The following option must be specified:
3538
3539@table @code
3540@cindex dev, mount option
3541@cindex Mount option; dev
3542@item dev
3543the block special device to be mounted.
3544@end table
3545
3546A pcfs entry might be:
3547
3548@example
3549pcfs      os==sunos4;type:=pcfs;dev:=/dev/fd0 \
3550          os==sunos5;type:=pcfs;dev:=/dev/diskette
3551@end example
3552
3553@c ----------------------------------------------------------------
3554@node Translucent Filesystem, Shared Memory+Swap Filesystem, Floppy Filesystem, Filesystem Types
3555@comment  node-name,  next,  previous,  up
3556@section Translucent Filesystem (@samp{tfs})
3557@cindex Translucent Filesystem
3558@cindex tfs, filesystem type
3559@cindex Filesystem type; tfs
3560
3561The @dfn{tfs} (@samp{type:=tfs}) filesystem is an older version of the
35624.4BSD @dfn{unionfs}.
3563
3564XXX: THIS FILESYSTEM IS NOT IMPLEMENTED YET!
3565
3566@c ----------------------------------------------------------------
3567@node Shared Memory+Swap Filesystem, User ID Mapping Filesystem, Translucent Filesystem, Filesystem Types
3568@comment  node-name,  next,  previous,  up
3569@section Shared Memory+Swap Filesystem (@samp{tmpfs})
3570@cindex Shared Memory and Swap Filesystem
3571@cindex tmpfs, filesystem type
3572@cindex Filesystem type; tmpfs
3573
3574The @dfn{tmpfs} (@samp{type:=tmpfs}) filesystem shares memory between a
3575the swap device and the rest of the system.  It is generally used to
3576provide a fast access @file{/tmp} directory, one that uses memory that
3577is otherwise unused.  This filesystem is available in SunOS 4.x and 5.x.
3578
3579XXX: THIS FILESYSTEM IS NOT IMPLEMENTED YET!
3580
3581@c ----------------------------------------------------------------
3582@node User ID Mapping Filesystem, Program Filesystem, Shared Memory+Swap Filesystem, Filesystem Types
3583@comment  node-name,  next,  previous,  up
3584@section User ID Mapping Filesystem (@samp{umapfs})
3585@cindex User ID Mapping Filesystem
3586@cindex umapfs, filesystem type
3587@cindex Filesystem type; umapfs
3588
3589The @dfn{umapfs} (@samp{type:=umapfs}) filesystem maps User IDs of file
3590ownership, and is available from 4.4BSD.
3591
3592XXX: THIS FILESYSTEM IS NOT IMPLEMENTED YET!
3593
3594@c ----------------------------------------------------------------
3595@node Program Filesystem, Symbolic Link Filesystem, User ID Mapping Filesystem, Filesystem Types
3596@comment  node-name,  next,  previous,  up
3597@section Program Filesystem (@samp{program})
3598@cindex Program filesystem
3599@cindex Mount a filesystem under program control
3600@cindex program, filesystem type
3601@cindex Filesystem type; program
3602
3603The @dfn{program} (@samp{type:=program}) filesystem type allows a
3604program to be run whenever a mount or unmount is required.  This allows
3605easy addition of support for other filesystem types, such as MIT's
3606Remote Virtual Disk (RVD) which has a programmatic interface via the
3607commands @samp{rvdmount} and @samp{rvdunmount}.
3608
3609@noindent
3610The following options must be specified:
3611
3612@table @code
3613@cindex mount, mount option
3614@cindex Mount option; mount
3615@item mount
3616the program which will perform the mount.
3617
3618@cindex unmount, mount option
3619@cindex Mount option; unmount
3620@item unmount
3621the program which will perform the unmount.
3622@end table
3623
3624The exit code from these two programs is interpreted as a Unix error
3625code.  As usual, exit code zero indicates success.  To execute the
3626program @i{Amd} splits the string on whitespace to create an array of
3627substrings.  Single quotes @samp{'} can be used to quote whitespace
3628if that is required in an argument.  There is no way to escape or change
3629the quote character.
3630
3631To run the program @samp{rvdmount} with a host name and filesystem as
3632arguments would be specified by
3633@samp{fs:=$@{autodir@}$@{path@};mount:="/etc/rvdmount rvdmount fserver
3634$@{fs@}"}.
3635
3636The first element in the array is taken as the pathname of the program
3637to execute.  The other members of the array form the argument vector to
3638be passed to the program, @dfn{including argument zero}.  This means
3639that the split string must have at least two elements.  The program is
3640directly executed by @i{Amd}, not via a shell.  This means that scripts
3641must begin with a @code{#!} interpreter specification.
3642
3643If a filesystem type is to be heavily used, it may be worthwhile adding
3644a new filesystem type into @i{Amd}, but for most uses the program
3645filesystem should suffice.
3646
3647When the program is run, standard input and standard error are inherited
3648from the current values used by @i{Amd}.  Standard output is a
3649duplicate of standard error.  The value specified with the @code{-l}
3650command line option has no effect on standard error.
3651
3652@c ----------------------------------------------------------------
3653@node Symbolic Link Filesystem, Symbolic Link Filesystem II, Program Filesystem, Filesystem Types
3654@comment  node-name,  next,  previous,  up
3655@section Symbolic Link Filesystem (@samp{link})
3656@cindex Symbolic link filesystem
3657@cindex Referencing part of the local name space
3658@cindex Mounting part of the local name space
3659@cindex How to reference part of the local name space
3660@cindex link, filesystem type
3661@cindex symlink, link filesystem type
3662@cindex Filesystem type; link
3663
3664Each filesystem type creates a symbolic link to point from the volume
3665name to the physical mount point.  The @samp{link} filesystem does the
3666same without any other side effects.  This allows any part of the
3667machines name space to be accessed via @i{Amd}.
3668
3669One common use for the symlink filesystem is @file{/homes} which can be
3670made to contain an entry for each user which points to their
3671(auto-mounted) home directory.  Although this may seem rather expensive,
3672it provides a great deal of administrative flexibility.
3673
3674@noindent
3675The following option must be defined:
3676
3677@table @code
3678@item fs
3679The value of @var{fs} option specifies the destination of the link, as
3680modified by the @var{sublink} option.  If @var{sublink} is non-null, it
3681is appended to @code{$@{fs@}}@code{/} and the resulting string is used
3682as the target.
3683@end table
3684
3685The @samp{link} filesystem can be thought of as identical to the
3686@samp{ufs} filesystem but without actually mounting anything.
3687
3688An example entry might be:
3689
3690@example
3691jsp   host==charm;type:=link;fs:=/home/charm;sublink:=jsp
3692@end example
3693which would return a symbolic link pointing to @file{/home/charm/jsp}.
3694
3695@c ----------------------------------------------------------------
3696@node Symbolic Link Filesystem II, NFS-Link Filesystem, Symbolic Link Filesystem, Filesystem Types
3697@comment  node-name,  next,  previous,  up
3698@section Symbolic Link Filesystem II (@samp{linkx})
3699@cindex Symbolic link filesystem II
3700@cindex Referencing an existing part of the local name space
3701@cindex Mounting an existing part of the local name space
3702@cindex How to reference an existing part of the local name space
3703@cindex linkx, filesystem type
3704@cindex symlink, linkx filesystem type
3705@cindex Filesystem type; linkx
3706
3707The @dfn{linkx} (@samp{type:=linkx}) filesystem type is identical to @samp{link} with the
3708exception that the target of the link must exist.  Existence is checked
3709with the @b{lstat}(2) system call.
3710
3711The @samp{linkx} filesystem type is particularly useful for wildcard map
3712entries.  In this case, a list of possible targets can be given and
3713@i{Amd} will choose the first one which exists on the local machine.
3714
3715@c ----------------------------------------------------------------
3716@node NFS-Link Filesystem, Automount Filesystem, Symbolic Link Filesystem II, Filesystem Types
3717@comment  node-name,  next,  previous,  up
3718@section NFS-Link Filesystem (@samp{nfsl})
3719@cindex NFS-Link filesystem II
3720@cindex Referencing an existing part of the name space if target exists
3721@cindex Mounting a remote part of the name space if target is missing
3722@cindex Symlink if target exists, NFS otherwise
3723@cindex nfsl, filesystem type
3724@cindex symlink, nfsl filesystem type
3725@cindex Filesystem type; nfsl
3726
3727The @dfn{nfsl} (@samp{type:=nfsl}) filesystem type is a combination of two others:
3728@samp{link} and @samp{nfs}.  If the local host name is equal to the
3729value of @code{$@{rhost@}}, or if the target pathname listed in
3730@code{$@{fs@}} exists, @samp{nfsl} will behave exactly as
3731@samp{type:=link}, and refer to the target as a symbolic link.  If the
3732local host name is not equal to the value of @code{$@{rhost@}}, or if
3733the target of the link does not exist, @i{Amd} will treat it as
3734@samp{type:=nfs}, and will mount a remote pathname for it.
3735
3736The @samp{nfsl} filesystem type is particularly useful as a shorthand
3737for the more cumbersome and yet one of the most popular @i{Amd}
3738entries.  For example, you can simplify all map entries that look like:
3739
3740@example
3741zing    -fs:=/n/shekel/u/zing \
3742        host!=shekel;type:=nfs;rhost:=shekel;rfs:=$@{fs@} \
3743        host==shekel;type:=link
3744@end example
3745
3746or
3747
3748@example
3749zing    -fs:=/n/shekel/u/zing \
3750        exists($@{fs@});type:=link \
3751        !exists($@{fs@});type:=nfs;rhost:=shekel;rfs:=$@{fs@}
3752@end example
3753
3754into a shorter form
3755
3756@example
3757zing    type:=nfsl;fs:=/n/shekel/u/zing;rhost:=shekel;rfs:=$@{fs@}
3758@end example
3759
3760Not just does it make the maps smaller and simpler, but it avoids
3761possible mistakes that often happen when forgetting to set up the two
3762entries (one for @samp{type:=nfs} and the other for @samp{type:=link})
3763necessary to perform transparent mounts of existing or remote mounts.
3764
3765@c ----------------------------------------------------------------
3766@node Automount Filesystem, Direct Automount Filesystem, NFS-Link Filesystem, Filesystem Types
3767@comment  node-name,  next,  previous,  up
3768@section Automount Filesystem (@samp{auto})
3769@cindex Automount filesystem
3770@cindex Map cache types
3771@cindex Setting map cache parameters
3772@cindex How to set map cache parameters
3773@cindex How to start an indirect automount point
3774@cindex auto, filesystem type
3775@cindex Filesystem type; auto
3776@cindex SIGHUP signal
3777@cindex Map cache synchronizing
3778@cindex Synchronizing the map cache
3779@cindex Map cache options
3780@cindex Regular expressions in maps
3781
3782The @dfn{auto} (@samp{type:=auto}) filesystem type creates a new automount point below an
3783existing automount point.  Top-level automount points appear as system
3784mount points.  An automount mount point can also appear as a
3785sub-directory of an existing automount point.  This allows some
3786additional structure to be added, for example to mimic the mount tree of
3787another machine.
3788
3789The following options may be specified:
3790
3791@table @code
3792@cindex cache, mount map option
3793@cindex Mount map option; cache
3794@item cache
3795specifies whether the data in this mount-map should be
3796cached.  The default value is @samp{none}, in which case
3797no caching is done in order to conserve memory.
3798
3799However, better performance and reliability can be obtained by caching
3800some or all of a mount-map.
3801
3802If the cache option specifies @samp{all},
3803the entire map is enumerated when the mount point is created.
3804
3805If the cache option specifies @samp{inc}, caching is done incrementally
3806as and when data is required.
3807Some map types do not support cache mode @samp{all}, in which case @samp{inc}
3808is used whenever @samp{all} is requested.
3809
3810Caching can be entirely disabled by using cache mode @samp{none}.
3811
3812If the cache option specifies @samp{regexp} then the entire map will be
3813enumerated and each key will be treated as an egrep-style regular
3814expression.  The order in which a cached map is searched does not
3815correspond to the ordering in the source map so the regular expressions
3816should be mutually exclusive to avoid confusion.
3817
3818Each mount map type has a default cache type, usually @samp{inc}, which
3819can be selected by specifying @samp{mapdefault}.
3820
3821The cache mode for a mount map can only be selected on the command line.
3822Starting @i{Amd} with the command:
3823
3824@example
3825amd /homes hesiod.homes -cache:=inc
3826@end example
3827
3828will cause @samp{/homes} to be automounted using the @dfn{Hesiod} name
3829server with local incremental caching of all successfully resolved names.
3830
3831All cached data is forgotten whenever @i{Amd} receives a @samp{SIGHUP}
3832signal and, if cache @samp{all} mode was selected, the cache will be
3833reloaded.  This can be used to inform @i{Amd} that a map has been
3834updated.  In addition, whenever a cache lookup fails and @i{Amd} needs
3835to examine a map, the map's modify time is examined.  If the cache is
3836out of date with respect to the map then it is flushed as if a
3837@samp{SIGHUP} had been received.
3838
3839An additional option (@samp{sync}) may be specified to force @i{Amd} to
3840check the map's modify time whenever a cached entry is being used.  For
3841example, an incremental, synchronized cache would be created by the
3842following command:
3843
3844@example
3845amd /homes hesiod.homes -cache:=inc,sync
3846@end example
3847
3848@item fs
3849specifies the name of the mount map to use for the new mount point.
3850
3851Arguably this should have been specified with the @code{$@{rfs@}} option but
3852we are now stuck with it due to historical accident.
3853
3854@c %If the string @samp{.} is used then the same map is used;
3855@c %in addition the lookup prefix is set to the name of the mount point followed
3856@c %by a slash @samp{/}.
3857@c %This is the same as specifying @samp{fs:=\$@{map@};pref:=\$@{key@}/}.
3858@c
3859
3860@item pref
3861alters the name that is looked up in the mount map.  If
3862@code{$@{pref@}}, the @dfn{prefix}, is non-null then it is prepended to
3863the name requested by the kernel @dfn{before} the map is searched.
3864@end table
3865
3866The server @samp{dylan.doc.ic.ac.uk} has two user disks:
3867@samp{/dev/dsk/2s0} and @samp{/dev/dsk/5s0}.  These are accessed as
3868@samp{/home/dylan/dk2} and @samp{/home/dylan/dk5} respectively.  Since
3869@samp{/home} is already an automount point, this naming is achieved with
3870the following map entries:@refill
3871
3872@example
3873dylan        type:=auto;fs:=$@{map@};pref:=$@{key@}/
3874dylan/dk2    type:=ufs;dev:=/dev/dsk/2s0
3875dylan/dk5    type:=ufs;dev:=/dev/dsk/5s0
3876@end example
3877
3878@c ----------------------------------------------------------------
3879@node Direct Automount Filesystem, Union Filesystem, Automount Filesystem, Filesystem Types
3880@comment  node-name,  next,  previous,  up
3881@section Direct Automount Filesystem (@samp{direct})
3882@cindex Direct automount filesystem
3883@cindex How to start a direct automount point
3884@cindex direct, filesystem type
3885@cindex Filesystem type; direct
3886
3887The @dfn{direct} (@samp{type:=direct}) filesystem is almost identical to
3888the automount filesystem.  Instead of appearing to be a directory of
3889mount points, it appears as a symbolic link to a mounted filesystem.
3890The mount is done at the time the link is accessed.  @xref{Automount
3891Filesystem}, for a list of required options.
3892
3893Direct automount points are created by specifying the @samp{direct}
3894filesystem type on the command line:
3895
3896@example
3897amd ... /usr/man auto.direct -type:=direct
3898@end example
3899
3900where @samp{auto.direct} would contain an entry such as:
3901
3902@example
3903usr/man    -type:=nfs;rfs:=/usr/man \
3904           rhost:=man-server1  rhost:=man-server2
3905@end example
3906
3907In this example, @samp{man-server1} and @samp{man-server2} are file
3908servers which export copies of the manual pages.  Note that the key
3909which is looked up is the name of the automount point without the
3910leading @samp{/}.
3911
3912@c ----------------------------------------------------------------
3913@node Union Filesystem, Error Filesystem, Direct Automount Filesystem, Filesystem Types
3914@comment  node-name,  next,  previous,  up
3915@section Union Filesystem (@samp{union})
3916@cindex Union filesystem
3917@cindex union, filesystem type
3918@cindex Filesystem type; union
3919
3920The @dfn{union} (@samp{type:=union}) filesystem type allows the contents of several
3921directories to be merged and made visible in a single directory.  This
3922can be used to overcome one of the major limitations of the Unix mount
3923mechanism which only allows complete directories to be mounted.
3924
3925For example, supposing @file{/tmp} and @file{/var/tmp} were to be merged
3926into a new directory called @file{/mtmp}, with files in @file{/var/tmp}
3927taking precedence.  The following command could be used to achieve this
3928effect:
3929
3930@example
3931amd ... /mtmp union:/tmp:/var/tmp -type:=union
3932@end example
3933
3934Currently, the unioned directories must @emph{not} be automounted.  That
3935would cause a deadlock.  This seriously limits the current usefulness of
3936this filesystem type and the problem will be addressed in a future
3937release of @i{Amd}.
3938
3939Files created in the union directory are actually created in the last
3940named directory.  This is done by creating a wildcard entry which points
3941to the correct directory.  The wildcard entry is visible if the union
3942directory is listed, so allowing you to see which directory has
3943priority.
3944
3945The files visible in the union directory are computed at the time
3946@i{Amd} is started, and are not kept up-to-date with respect to the
3947underlying directories.  Similarly, if a link is removed, for example
3948with the @samp{rm} command, it will be lost forever.
3949
3950@c ----------------------------------------------------------------
3951@node Error Filesystem, Top-level Filesystem, Union Filesystem, Filesystem Types
3952@comment  node-name,  next,  previous,  up
3953@section Error Filesystem (@samp{error})
3954@cindex Error filesystem
3955@cindex error, filesystem type
3956@cindex Filesystem type; error
3957
3958The @dfn{error} (@samp{type:=error}) filesystem type is used internally as a catch-all in the
3959case where none of the other filesystems was selected, or some other
3960error occurred.  Lookups and mounts always fail with ``No such file or
3961directory''.  All other operations trivially succeed.
3962
3963The error filesystem is not directly accessible.
3964
3965@c ----------------------------------------------------------------
3966@node Top-level Filesystem, Autofs Filesystem, Error Filesystem, Filesystem Types
3967@comment  node-name,  next,  previous,  up
3968@section Top-level Filesystem (@samp{toplvl})
3969@cindex Top level filesystem
3970@cindex toplvl, filesystem type
3971@cindex Filesystem type; toplvl
3972
3973The @dfn{toplvl} (@samp{type:=toplvl}) filesystems is derived from the @samp{auto} filesystem
3974and is used to mount the top-level automount nodes.  Requests of this
3975type are automatically generated from the command line arguments and can
3976also be passed in by using the @code{-M} option of the @dfn{Amq} command.
3977That option is insecure, and is unavailable unless am-utils was
3978configured with @samp{--with-amq-mount}.
3979
3980@c ----------------------------------------------------------------
3981@node Root Filesystem, Inheritance Filesystem, Autofs Filesystem, Filesystem Types
3982@comment  node-name,  next,  previous,  up
3983@section Root Filesystem (@samp{root})
3984@cindex Root filesystem
3985@cindex root, filesystem type
3986@cindex Filesystem type; root
3987
3988The @dfn{root} (@samp{type:=root}) filesystem type acts as an internal
3989placeholder onto which @i{Amd} can pin @samp{toplvl} mounts.  Only one
3990node of this type need ever exist and one is created automatically
3991during startup.  The effect of having more than one root node is
3992undefined.
3993
3994The root filesystem is not directly accessible.
3995
3996@c ----------------------------------------------------------------
3997@node Autofs Filesystem, Root Filesystem, Top-level Filesystem, Filesystem Types
3998@comment  node-name,  next,  previous,  up
3999@section Autofs Filesystem (@samp{autofs})
4000@cindex Autofs filesystem
4001@cindex autofs, filesystem type
4002@cindex Filesystem type; autofs
4003
4004The @dfn{autofs} (@samp{type:=autofs}) filesystem uses Sun's kernel-based automounter
4005supporting filesystem for @i{Amd}'s mount points.  Hence it is another
4006type of top level filesystem.
4007
4008The autofs filesystem is not directly accessible from @i{Amd} maps, but
4009only from the @file{amd.conf} file (@pxref{mount_type Parameter}).
4010
4011Note that Autofs support is still very early.  See the distribution file
4012@file{README.autofs} for detail of what works and what does not.
4013
4014@c ----------------------------------------------------------------
4015@node Inheritance Filesystem, , Root Filesystem, Filesystem Types
4016@comment  node-name,  next,  previous,  up
4017@section Inheritance Filesystem (@samp{inherit})
4018@cindex Inheritance filesystem
4019@cindex Nodes generated on a restart
4020@cindex inherit, filesystem type
4021@cindex Filesystem type; inherit
4022
4023The @dfn{inheritance} (@samp{type:=inherit}) filesystem is not directly
4024accessible.  Instead, internal mount nodes of this type are
4025automatically generated when @i{Amd} is started with the @code{-r} option.
4026At this time the system mount table is scanned to locate any filesystems
4027which are already mounted.  If any reference to these filesystems is
4028made through @i{Amd} then instead of attempting to mount it, @i{Amd}
4029simulates the mount and @dfn{inherits} the filesystem.  This allows a
4030new version of @i{Amd} to be installed on a live system simply by
4031killing the old daemon with @samp{SIGTERM} and starting the new one.@refill
4032
4033This filesystem type is not generally visible externally, but it is
4034possible that the output from @samp{amq -m} may list @samp{inherit} as
4035the filesystem type.  This happens when an inherit operation cannot
4036be completed for some reason, usually because a fileserver is down.
4037
4038@c ################################################################
4039@node Amd Configuration File, Run-time Administration, Filesystem Types, Top
4040@comment  node-name,  next,  previous,  up
4041@chapter Amd Configuration File
4042@cindex  Amd Configuration File
4043@cindex amd.conf
4044
4045The @samp{amd.conf} file is the configuration file for @i{Amd}, as part
4046of the am-utils suite.  This file contains runtime configuration
4047information for the @i{Amd} automounter program.
4048
4049@menu
4050* File Format::
4051* The Global Section::
4052* Regular Map Sections::
4053* Common Parameters::
4054* Global Parameters::
4055* Regular Map Parameters::
4056* amd.conf Examples::
4057@end menu
4058
4059@c ================================================================
4060@node File Format, The Global Section, Amd Configuration File, Amd Configuration File
4061@comment  node-name,  next,  previous,  up
4062@section File Format
4063@cindex amd.conf file format
4064
4065The @samp{amd.conf} file consists of sections and parameters.  A section
4066begins with the name of the section in square brackets @samp{[]} and
4067continues until the next section begins or the end of the file is reached.
4068Sections contain parameters of the form @samp{name = value}.
4069
4070The file is line-based --- that is, each newline-terminated line
4071represents either a comment, a section name or a parameter.  No
4072line-continuation syntax is available.
4073
4074Section names, parameter names and their values are case sensitive.
4075
4076Only the first equals sign in a parameter is significant.  Whitespace
4077before or after the first equals sign is discarded.  Leading, trailing
4078and internal whitespace in section and parameter names is irrelevant.
4079Leading and trailing whitespace in a parameter value is discarded.
4080Internal whitespace within a parameter value is not allowed, unless the
4081whole parameter value is quoted with double quotes as in @samp{name =
4082"some value"}.
4083
4084Any line beginning with a pound sign @samp{#} is ignored, as are lines
4085containing only whitespace.
4086
4087The values following the equals sign in parameters are all either a
4088string (no quotes needed if string does not include spaces) or a
4089boolean, which may be given as @samp{yes}/@samp{no}.  Case is significant in all
4090values.  Some items such as cache timeouts are numeric.
4091
4092@c ================================================================
4093@node The Global Section, Regular Map Sections, File Format, Amd Configuration File
4094@comment  node-name,  next,  previous,  up
4095@section The Global Section
4096@cindex amd.conf global section
4097
4098The global section must be specified as @samp{[global]}.  Parameters in
4099this section either apply to @i{Amd} as a whole, or to all other regular map
4100sections which follow.  There should be only one global section defined
4101in one configuration file.
4102
4103It is highly recommended that this section be specified first in the
4104configuration file.  If it is not, then regular map sections which
4105precede it will not use global values defined later.
4106
4107@c ================================================================
4108@node Regular Map Sections, Common Parameters, The Global Section, Amd Configuration File
4109@comment  node-name,  next,  previous,  up
4110@section Regular Map Sections
4111@cindex amd.conf regular map sections
4112
4113Parameters in regular (non-global) sections apply to a single map entry.
4114For example, if the map section @samp{[/homes]} is defined, then all
4115parameters following it will be applied to the @file{/homes}
4116@i{Amd}-managed mount point.
4117
4118@c ================================================================
4119@node Common Parameters, Global Parameters, Regular Map Sections, Amd Configuration File
4120@comment  node-name,  next,  previous,  up
4121@section Common Parameters
4122@cindex amd.conf common parameters
4123
4124These parameters can be specified either in the global or a map-specific
4125section.  Entries specified in a map-specific section override the default
4126value or one defined in the global section.   If such a common parameter is
4127specified only in the global section, it is applicable to all regular map
4128sections that follow.
4129
4130@menu
4131* browsable_dirs Parameter::
4132* map_options Parameter::
4133* map_type Parameter::
4134* mount_type Parameter::
4135* search_path Parameter::
4136@end menu
4137
4138@c ----------------------------------------------------------------
4139@node browsable_dirs Parameter, map_options Parameter, Common Parameters, Common Parameters
4140@comment  node-name,  next,  previous,  up
4141@subsection @t{browsable_dirs} Parameter
4142@cindex browsable_dirs Parameter
4143
4144(type=string, default=@samp{no}).  If @samp{yes}, then @i{Amd}'s top-level
4145mount points will be browsable to @b{readdir}(3) calls.  This means you
4146could run for example @b{ls}(1) and see what keys are available to mount
4147in that directory.  Not all entries are made visible to @b{readdir}(3):
4148the @samp{/defaults} entry, wildcard entries, and those with a @file{/}
4149in them are not included.  If you specify @samp{full} to this option,
4150all but the @samp{/defaults} entry will be visible.  Note that if you run
4151a command which will attempt to @b{stat}(2) the entries, such as often
4152done by @samp{ls -l} or @samp{ls -F}, @i{Amd} will attempt to mount
4153@i{every} entry in that map.  This is often called a ``mount storm''.
4154
4155@c ----------------------------------------------------------------
4156@node map_options Parameter, map_type Parameter, browsable_dirs Parameter, Common Parameters
4157@comment  node-name,  next,  previous,  up
4158@subsection @t{map_options} Parameter
4159@cindex map_options Parameter
4160
4161(type=string, default no options).  This option is the same as
4162specifying map options on the command line to @i{Amd}, such as
4163@samp{cache:=all}.
4164
4165@c ----------------------------------------------------------------
4166@node map_type Parameter, mount_type Parameter, map_options Parameter, Common Parameters
4167@comment  node-name,  next,  previous,  up
4168@subsection @t{map_type} Parameter
4169@cindex map_type Parameter
4170
4171(type=string, default search all map types).  If specified, @i{Amd} will
4172initialize the map only for the type given.  This is useful to avoid the
4173default map search type used by @i{Amd} which takes longer and can have
4174undesired side-effects such as initializing NIS even if not used.
4175Possible values are
4176
4177@table @samp
4178@item file
4179plain files
4180@item hesiod
4181Hesiod name service from MIT
4182@item ldap
4183Lightweight Directory Access Protocol
4184@item ndbm
4185(New) dbm style hash files
4186@item nis
4187Network Information Services (version 2)
4188@item nisplus
4189Network Information Services Plus (version 3)
4190@item passwd
4191local password files
4192@item union
4193union maps
4194@end table
4195
4196@c ----------------------------------------------------------------
4197@node mount_type Parameter, search_path Parameter, map_type Parameter, Common Parameters
4198@comment  node-name,  next,  previous,  up
4199@subsection @t{mount_type} Parameter
4200@cindex mount_type Parameter
4201
4202(type=string, default=@samp{nfs}).  All @i{Amd} mount types default to NFS.
4203That is, @i{Amd} is an NFS server on the map mount points, for the local
4204host it is running on.  If @samp{autofs} is specified, @i{Amd} will be
4205an autofs server for those mount points.
4206
4207@c ----------------------------------------------------------------
4208@node search_path Parameter, , mount_type Parameter, Common Parameters
4209@comment  node-name,  next,  previous,  up
4210@subsection @t{search_path} Parameter
4211@cindex search_path Parameter
4212
4213(type=string, default no search path).  This provides a
4214(colon-delimited) search path for file maps.  Using a search path,
4215sites can allow for local map customizations and overrides, and can
4216distributed maps in several locations as needed.
4217
4218@c ================================================================
4219@node Global Parameters, Regular Map Parameters, Common Parameters, Amd Configuration File
4220@comment  node-name,  next,  previous,  up
4221@section Global Parameters
4222@cindex amd.conf global parameters
4223
4224The following parameters are applicable to the @samp{[global]} section only.
4225
4226@menu
4227* arch Parameter::    
4228* auto_dir Parameter::
4229* cache_duration Parameter::
4230* cluster Parameter:: 
4231* debug_options Parameter::
4232* dismount_interval Parameter::
4233* full_os Parameter::
4234* fully_qualified_hosts Parameter::
4235* hesiod_base Parameter::   
4236* karch Parameter::   
4237* ldap_base Parameter::
4238* ldap_cache_maxmem Parameter::
4239* ldap_cache_seconds Parameter::
4240* ldap_hostports Parameter::
4241* local_domain Parameter::
4242* log_file Parameter::
4243* log_options Parameter::
4244* nfs_retransmit_counter Parameter::
4245* nfs_retry_interval Parameter::
4246* nis_domain Parameter::
4247* normalize_hostnames Parameter::
4248* os Parameter::      
4249* osver Parameter::   
4250* pid_file Parameter::
4251* plock Parameter::   
4252* portmap_program Parameter::
4253* print_pid Parameter::
4254* print_version Parameter::
4255* restart_mounts Parameter::
4256* selectors_on_default Parameter::
4257* show_statfs_entries Parameter::
4258* unmount_on_exit Parameter::
4259* vendor Parameter::
4260@end menu
4261
4262@c ----------------------------------------------------------------
4263@node arch Parameter, auto_dir Parameter, Global Parameters, Global Parameters
4264@comment  node-name,  next,  previous,  up
4265@subsection @t{arch} Parameter
4266@cindex arch Parameter
4267
4268(type=string, default to compiled in value).  Allows you to override the
4269value of the @i{arch} @i{Amd} variable.
4270
4271@c ----------------------------------------------------------------
4272@node auto_dir Parameter, cache_duration Parameter, arch Parameter, Global Parameters
4273@comment  node-name,  next,  previous,  up
4274@subsection @t{auto_dir} Parameter
4275@cindex auto_dir Parameter
4276
4277(type=string, default=@samp{/a}).  Same as the @code{-a} option to @i{Amd}.
4278This sets the private directory where @i{Amd} will create
4279sub-directories for its real mount points.
4280
4281@c ----------------------------------------------------------------
4282@node cache_duration Parameter, cluster Parameter, auto_dir Parameter, Global Parameters
4283@comment  node-name,  next,  previous,  up
4284@subsection @t{cache_duration} Parameter
4285@cindex cache_duration Parameter
4286
4287(type=numeric, default=300).  Same as the @code{-c} option to
4288@i{Amd}.  Sets the duration in seconds that looked up map entries remain
4289in the cache.
4290
4291@c ----------------------------------------------------------------
4292@node cluster Parameter, debug_options Parameter, cache_duration Parameter, Global Parameters
4293@comment  node-name,  next,  previous,  up
4294@subsection @t{cluster} Parameter
4295@cindex cluster Parameter
4296
4297(type=string, default no cluster).  Same as the @code{-C} option to
4298@i{Amd}.  Specifies the alternate HP-UX cluster to use.
4299
4300@c ----------------------------------------------------------------
4301@node debug_options Parameter, dismount_interval Parameter, cluster Parameter, Global Parameters
4302@comment  node-name,  next,  previous,  up
4303@subsection @t{debug_options} Parameter
4304@cindex debug_options Parameter
4305
4306(type=string, default no debug options).  Same as the @code{-D} option
4307to @i{Amd}.  Specify any debugging options for @i{Amd}.  Works only if
4308am-utils was configured for debugging using the @code{--enable-debug}
4309option.  The @samp{mem} option, as well as all other options, can be
4310turned on via @code{--enable-debug=mem}.  Otherwise debugging options
4311are ignored.  Options are comma delimited, and can be preceded by the
4312string @samp{no} to negate their meaning.  You can get the list of
4313supported debugging and logging options by running @code{amd -H}.
4314Possible values are:
4315
4316@table @samp
4317@item all
4318all options
4319@item amq
4320register for amq
4321@item daemon
4322enter daemon mode
4323@item fork
4324fork server
4325@item full
4326program trace
4327@item mem
4328trace memory allocations
4329@item mtab
4330use local @file{./mtab} file
4331@item str
4332debug string munging
4333@item test
4334full debug but no daemon
4335@item trace
4336trace RPC protocol and NFS mount arguments
4337@end table
4338
4339@c ----------------------------------------------------------------
4340@node dismount_interval Parameter, full_os Parameter, debug_options Parameter, Global Parameters
4341@comment  node-name,  next,  previous,  up
4342@subsection @t{dismount_interval} Parameter
4343@cindex dismount_interval Parameter
4344
4345(type=numeric, default=120).  Same as the @code{-w} option to
4346@i{Amd}.  Specify in seconds, the time between attempts to dismount file
4347systems that have exceeded their cached times.
4348
4349@c ----------------------------------------------------------------
4350@node full_os Parameter, fully_qualified_hosts Parameter, dismount_interval Parameter, Global Parameters
4351@comment  node-name,  next,  previous,  up
4352@subsection @t{full_os} Parameter
4353@cindex full_os Parameter
4354
4355(type=string, default to compiled in value).  The full name of the
4356operating system, along with its version.  Allows you to override the
4357compiled-in full name and version of the operating system.  Useful when
4358the compiled-in name is not desired.  For example, the full operating
4359system name on linux comes up as @samp{linux}, but you can override it
4360to @samp{linux-2.2.5}.
4361
4362@c ----------------------------------------------------------------
4363@node fully_qualified_hosts Parameter, hesiod_base Parameter, full_os Parameter, Global Parameters
4364@comment  node-name,  next,  previous,  up
4365@subsection @t{fully_qualified_hosts} Parameter
4366@cindex fully_qualified_hosts Parameter
4367
4368(type=string, default=@samp{no}).  If @samp{yes}, @i{Amd} will perform RPC
4369authentication using fully-qualified host names.  This is necessary for
4370some systems, and especially when performing cross-domain mounting.  For
4371this function to work, the @i{Amd} variable @samp{$@{hostd@}} is used,
4372requiring that @samp{$@{domain@}} not be null.
4373
4374@c ----------------------------------------------------------------
4375@node hesiod_base Parameter, karch Parameter, fully_qualified_hosts Parameter, Global Parameters
4376@comment  node-name,  next,  previous,  up
4377@subsection @t{hesiod_base} Parameter
4378@cindex hesiod_base Parameter
4379
4380(type=string, default=@samp{automount}).  Specify the base name for
4381hesiod maps.
4382
4383@c ----------------------------------------------------------------
4384@node karch Parameter, ldap_base Parameter, hesiod_base Parameter, Global Parameters
4385@comment  node-name,  next,  previous,  up
4386@subsection @t{karch} Parameter
4387@cindex karch Parameter
4388
4389(type=string, default to karch of the system).  Same as the @code{-k}
4390option to @i{Amd}.  Allows you to override the kernel-architecture of
4391your system.  Useful for example on Sun (Sparc) machines, where you can
4392build one @i{Amd} binary, and run it on multiple machines, yet you want
4393each one to get the correct @i{karch} variable set (for example, sun4c,
4394sun4m, sun4u, etc.)  Note that if not specified, @i{Amd} will use
4395@b{uname}(2) to figure out the kernel architecture of the machine.
4396
4397@c ----------------------------------------------------------------
4398@node ldap_base Parameter, ldap_cache_maxmem Parameter, karch Parameter, Global Parameters
4399@comment  node-name,  next,  previous,  up
4400@subsection @t{ldap_base} Parameter
4401@cindex ldap_base Parameter
4402
4403(type=string, default not set).  Specify the base name for
4404LDAP.
4405
4406@c ----------------------------------------------------------------
4407@node ldap_cache_maxmem Parameter, ldap_cache_seconds Parameter, ldap_base Parameter, Global Parameters
4408@comment  node-name,  next,  previous,  up
4409@subsection @t{ldap_cache_maxmem} Parameter
4410@cindex ldap_cache_maxmem Parameter
4411
4412(type=numeric, default=131072).  Specify the maximum memory @i{Amd}
4413should use to cache LDAP entries.
4414
4415@c ----------------------------------------------------------------
4416@node ldap_cache_seconds Parameter, ldap_hostports Parameter, ldap_cache_maxmem Parameter, Global Parameters
4417@comment  node-name,  next,  previous,  up
4418@subsection @t{ldap_cache_seconds} Parameter
4419@cindex ldap_cache_seconds Parameter
4420
4421(type=numeric, default=0).  Specify the number of seconds to keep
4422entries in the cache.
4423
4424@c ----------------------------------------------------------------
4425@node ldap_hostports Parameter, local_domain Parameter, ldap_cache_seconds Parameter, Global Parameters
4426@comment  node-name,  next,  previous,  up
4427@subsection @t{ldap_hostports} Parameter
4428@cindex ldap_hostports Parameter
4429
4430(type=string, default not set).  Specify
4431LDAP-specific values such as country and organization.
4432
4433@c ----------------------------------------------------------------
4434@node local_domain Parameter, log_file Parameter, ldap_hostports Parameter, Global Parameters
4435@comment  node-name,  next,  previous,  up
4436@subsection @t{local_domain} Parameter
4437@cindex local_domain Parameter
4438
4439(type=string, default no sub-domain).  Same as the @code{-d} option
4440to @i{Amd}.  Specify the local domain name.  If this option is not given
4441the domain name is determined from the hostname, by removing the first
4442component of the fully-qualified host name.
4443
4444@c ----------------------------------------------------------------
4445@node log_file Parameter, log_options Parameter, local_domain Parameter, Global Parameters
4446@comment  node-name,  next,  previous,  up
4447@subsection @t{log_file} Parameter
4448@cindex log_file Parameter
4449
4450(type=string, default=@samp{stderr}).  Same as the @code{-l} option to
4451@i{Amd}.  Specify a file name to log @i{Amd} events to.
4452If the string @samp{/dev/stderr} is specified,
4453@i{Amd} will send its events to the standard error file descriptor.
4454
4455If the string @samp{syslog} is given, @i{Amd} will record its events
4456with the system logger @b{syslogd}(8).  If your system supports syslog
4457facilities, then the default facility used is @samp{LOG_DAEMON}.
4458
4459When using syslog, if you wish to change the facility, append its name
4460to the option name, delimited by a single colon.  For example, if it is
4461the string @samp{syslog:local7} then @i{Amd} will log messages via
4462@b{syslog}(3) using the @samp{LOG_LOCAL7} facility.  If the facility
4463name specified is not recognized, @i{Amd} will default to @samp{LOG_DAEMON}.
4464Note: while you can use any syslog facility available on your system, it
4465is generally a bad idea to use those reserved for other services such as
4466@samp{kern}, @samp{lpr}, @samp{cron}, etc.
4467
4468@c ----------------------------------------------------------------
4469@node log_options Parameter, nfs_retransmit_counter Parameter, log_file Parameter, Global Parameters
4470@comment  node-name,  next,  previous,  up
4471@subsection @t{log_options} Parameter
4472@cindex log_options Parameter
4473
4474(type=string, default no logging options).  Same as the @code{-x}
4475option to @i{Amd}.  Specify any logging options for @i{Amd}.  Options
4476are comma delimited, and can be preceded by the string @samp{no} to
4477negate their meaning.  The @samp{debug} logging option is only available
4478if am-utils was configured with @code{--enable-debug}.  You can get the
4479list of supported debugging options by running @code{amd -H}.  Possible
4480values are:
4481
4482@table @samp
4483@item all
4484all messages
4485@item debug
4486debug messages
4487@item error
4488non-fatal system errors
4489@item fatal
4490fatal errors
4491@item info
4492information
4493@item map
4494map errors
4495@item stats
4496additional statistical information
4497@item user
4498non-fatal user errors
4499@item warn
4500warnings
4501@item warning
4502warnings
4503@end table
4504
4505@c ----------------------------------------------------------------
4506@node nfs_retransmit_counter Parameter, nfs_retry_interval Parameter, log_options Parameter, Global Parameters
4507@comment  node-name,  next,  previous,  up
4508@subsection @t{nfs_retransmit_counter} Parameter
4509@cindex nfs_retransmit_counter Parameter
4510
4511(type=numeric, default=11).  Same as the @i{retransmit} part of the
4512@code{-t} @i{timeout.retransmit} option to @i{Amd}.  Specifies the
4513number of NFS retransmissions that the kernel will use to communicate
4514with @i{Amd}.  @xref{-t Option}.
4515
4516@c ----------------------------------------------------------------
4517@node nfs_retry_interval Parameter, nis_domain Parameter, nfs_retransmit_counter Parameter, Global Parameters
4518@comment  node-name,  next,  previous,  up
4519@subsection @t{nfs_retry_interval} Parameter
4520@cindex nfs_retry_interval Parameter
4521
4522(type=numeric, default=8).  Same as the @i{timeout} part of the
4523@code{-t} @i{timeout.retransmit} option to @i{Amd}.  Specifies the NFS
4524timeout interval, in @emph{tenths} of seconds, between NFS/RPC retries
4525(for UDP only).  This is the value that the kernel will use to
4526communicate with @i{Amd}.  @xref{-t Option}.
4527
4528Amd relies on the kernel RPC retransmit mechanism to trigger mount
4529retries.  The values of the @i{nfs_retransmit_counter} and the
4530@i{nfs_retry_interval} parameters change the overall retry interval.
4531Too long an interval gives poor interactive response; too short an
4532interval causes excessive retries.
4533
4534@c ----------------------------------------------------------------
4535@node nis_domain Parameter, normalize_hostnames Parameter, nfs_retry_interval Parameter, Global Parameters
4536@comment  node-name,  next,  previous,  up
4537@subsection @t{nis_domain} Parameter
4538@cindex nis_domain Parameter
4539
4540(type=string, default to local NIS domain name).  Same as the
4541@code{-y} option to @i{Amd}.  Specify an alternative NIS domain from
4542which to fetch the NIS maps.  The default is the system domain name.
4543This option is ignored if NIS support is not available.
4544
4545@c ----------------------------------------------------------------
4546@node normalize_hostnames Parameter, os Parameter, nis_domain Parameter, Global Parameters
4547@comment  node-name,  next,  previous,  up
4548@subsection @t{normalize_hostnames} Parameter
4549@cindex normalize_hostnames Parameter
4550
4551(type=boolean, default=@samp{no}).  Same as the @code{-n} option to @i{Amd}.
4552If @samp{yes}, then the name referred to by @code{$@{rhost@}} is normalized
4553relative to the host database before being used.  The effect is to
4554translate aliases into ``official'' names.
4555
4556@c ----------------------------------------------------------------
4557@node os Parameter, osver Parameter, normalize_hostnames Parameter, Global Parameters
4558@comment  node-name,  next,  previous,  up
4559@subsection @t{os} Parameter
4560@cindex os Parameter
4561
4562(type=string, default to compiled in value).  Same as the @code{-O}
4563option to @i{Amd}.  Allows you to override the compiled-in name of the
4564operating system.  Useful when the built-in name is not desired for
4565backward compatibility reasons.  For example, if the built-in name is
4566@samp{sunos5}, you can override it to @samp{sos5}, and use older maps
4567which were written with the latter in mind.
4568
4569
4570@c ----------------------------------------------------------------
4571@node osver Parameter, pid_file Parameter, os Parameter, Global Parameters
4572@comment  node-name,  next,  previous,  up
4573@subsection @t{osver} Parameter
4574@cindex osver Parameter
4575
4576(type=string, default to compiled in value).  Same as the @code{-o}
4577option to @i{Amd}.  Allows you to override the compiled-in version
4578number of the operating system.  Useful when the built-in version is not
4579desired for backward compatibility reasons.  For example, if the build
4580in version is @samp{2.5.1}, you can override it to @samp{5.5.1}, and use
4581older maps that were written with the latter in mind.
4582
4583@c ----------------------------------------------------------------
4584@node pid_file Parameter, plock Parameter, osver Parameter, Global Parameters
4585@comment  node-name,  next,  previous,  up
4586@subsection @t{pid_file} Parameter
4587@cindex pid_file Parameter
4588
4589(type=string, default=@samp{/dev/stdout}).  Specify a file to store the process
4590ID of the running daemon into.  If not specified, @i{Amd} will print its
4591process id onto the standard output.  Useful for killing @i{Amd} after
4592it had run.  Note that the PID of a running @i{Amd} can also be
4593retrieved via @i{Amq} (@pxref{Amq -p option}).
4594
4595This file is used only if the @samp{print_pid} option is on
4596(@pxref{print_pid Parameter}).
4597
4598@c ----------------------------------------------------------------
4599@node plock Parameter, portmap_program Parameter, pid_file Parameter, Global Parameters
4600@comment  node-name,  next,  previous,  up
4601@subsection @t{plock} Parameter
4602@cindex plock Parameter
4603
4604(type=boolean, default=@samp{yes}).  Same as the @code{-S} option to @i{Amd}.
4605If @samp{yes}, lock the running executable pages of @i{Amd} into memory.
4606To improve @i{Amd}'s performance, systems that support the @b{plock}(3)
4607call can lock the @i{Amd} process into memory.  This way there is less
4608chance the operating system will schedule, page out, and swap the
4609@i{Amd} process as needed.  This improves @i{Amd}'s performance, at the
4610cost of reserving the memory used by the @i{Amd} process (making it
4611unavailable for other processes).
4612
4613@c ----------------------------------------------------------------
4614@node portmap_program Parameter, print_pid Parameter, plock Parameter, Global Parameters
4615@comment  node-name,  next,  previous,  up
4616@subsection @t{portmap_program} Parameter
4617@cindex portmap_program Parameter
4618
4619(type=numeric, default=300019).  Specify an alternate Port-mapper RPC
4620program number, other than the official number.  This is useful when
4621running multiple @i{Amd} processes.  For example, you can run another
4622@i{Amd} in ``test'' mode, without affecting the primary @i{Amd} process
4623in any way.  For safety reasons, the alternate program numbers that can
4624be specified must be in the range 300019-300029, inclusive.  @i{Amq} has
4625an option @code{-P} which can be used to specify an alternate program
4626number of an @i{Amd} to contact.  In this way, amq can fully control any
4627number of @i{Amd} processes running on the same host.
4628
4629@c ----------------------------------------------------------------
4630@node print_pid Parameter, print_version Parameter, portmap_program Parameter, Global Parameters
4631@comment  node-name,  next,  previous,  up
4632@subsection @t{print_pid} Parameter
4633@cindex print_pid Parameter
4634
4635(type=boolean, default=@samp{no}).  Same as the @code{-p} option to @i{Amd}.
4636If @samp{yes}, @i{Amd} will print its process ID upon starting.
4637
4638@c ----------------------------------------------------------------
4639@node print_version Parameter, restart_mounts Parameter, print_pid Parameter, Global Parameters
4640@comment  node-name,  next,  previous,  up
4641@subsection @t{print_version} Parameter
4642@cindex print_version Parameter
4643
4644(type=boolean, default=@samp{no}).  Same as the @code{-v} option to @i{Amd},
4645but the version prints and @i{Amd} continues to run.  If @samp{yes}, @i{Amd}
4646will print its version information string, which includes some
4647configuration and compilation values.
4648
4649@c ----------------------------------------------------------------
4650@node restart_mounts Parameter, selectors_on_default Parameter, print_version Parameter, Global Parameters
4651@comment  node-name,  next,  previous,  up
4652@subsection @t{restart_mounts} Parameter
4653@cindex restart_mounts Parameter
4654
4655(type=boolean, default=@samp{no}).  Same as the @code{-r} option to @i{Amd}.
4656If @samp{yes} @i{Amd} will scan the mount table to determine which file
4657systems are currently mounted.  Whenever one of these would have been
4658auto-mounted, @i{Amd} inherits it.
4659
4660@c ----------------------------------------------------------------
4661@node selectors_on_default Parameter, show_statfs_entries Parameter, restart_mounts Parameter, Global Parameters
4662@comment  node-name,  next,  previous,  up
4663@subsection @t{selectors_on_default} Parameter
4664@cindex selectors_on_default Parameter
4665
4666(type=boolean, default=@samp{no}).  If @samp{yes}, then the @samp{/defaults} entry of
4667maps will be looked for and any selectors processed before setting defaults
4668for all other keys in that map.  Useful when you want to set different
4669options for a complete map based on some parameters.  For example, you
4670may want to better the NFS performance over slow slip-based networks as
4671follows:
4672
4673@example
4674/defaults \
4675    wire==slip-net;opts:=intr,rsize=1024,wsize=1024 \
4676    wire!=slip-net;opts:=intr,rsize=8192,wsize=8192
4677@end example
4678
4679@c ----------------------------------------------------------------
4680@node show_statfs_entries Parameter, unmount_on_exit Parameter, selectors_on_default Parameter, Global Parameters
4681@comment  node-name,  next,  previous,  up
4682@subsection @t{show_statfs_entries} Parameter
4683@cindex show_statfs_entries Parameter
4684
4685(type=boolean), default=@samp{no}).  If @samp{yes}, then all maps which are
4686browsable will also show the number of entries (keys) they have when
4687@b{df}(1) runs. (This is accomplished by returning non-zero values to
4688the @b{statfs}(2) system call).
4689
4690@c ----------------------------------------------------------------
4691@node unmount_on_exit Parameter, vendor Parameter, show_statfs_entries Parameter, Global Parameters
4692@comment  node-name,  next,  previous,  up
4693@subsection @t{unmount_on_exit} Parameter
4694@cindex unmount_on_exit Parameter
4695
4696(type=boolean), default=@samp{no}).  If @samp{yes}, then @i{Amd} will attempt
4697to unmount all file systems which it knows about.  Normally it leaves
4698all (esp. NFS) mounted file systems intact.  Note that @i{Amd} does not
4699know about file systems mounted before it starts up, unless the
4700@samp{restart_mounts} option is used (@pxref{restart_mounts Parameter}).
4701
4702@c ----------------------------------------------------------------
4703@node vendor Parameter, , unmount_on_exit Parameter, Global Parameters
4704@comment  node-name,  next,  previous,  up
4705@subsection @t{vendor} Parameter
4706@cindex vendor Parameter
4707
4708(type=string, default to compiled in value).  The name of the vendor of
4709the operating system.  Overrides the compiled-in vendor name.  Useful
4710when the compiled-in name is not desired.  For example, most Intel based
4711systems set the vendor name to @samp{unknown}, but you can set it to
4712@samp{redhat}.
4713
4714@c ================================================================
4715@node Regular Map Parameters, amd.conf Examples, Global Parameters, Amd Configuration File
4716@comment  node-name,  next,  previous,  up
4717@section Regular Map Parameters
4718@cindex amd.conf regular map parameters
4719
4720The following parameters are applicable only to regular map sections.
4721
4722@menu
4723* map_name Parameter::
4724* tag Parameter::     
4725@end menu
4726
4727@c ----------------------------------------------------------------
4728@node map_name Parameter, tag Parameter, Regular Map Parameters, Regular Map Parameters
4729@comment  node-name,  next,  previous,  up
4730@subsection map_name Parameter
4731@cindex map_name Parameter
4732
4733(type=string, must be specified).  Name of the map where the keys are
4734located.
4735
4736@c ----------------------------------------------------------------
4737@node tag Parameter, , map_name Parameter, Regular Map Parameters
4738@comment  node-name,  next,  previous,  up
4739@subsection tag Parameter
4740@cindex tag Parameter
4741
4742(type=string, default no tag).  Each map entry in the configuration file
4743can be tagged.  If no tag is specified, that map section will always be
4744processed by @i{Amd}.  If it is specified, then @i{Amd} will process the map
4745if the @code{-T} option was given to @i{Amd}, and the value given to that
4746command-line option matches that in the map section.
4747
4748@c ================================================================
4749@node amd.conf Examples, , Regular Map Parameters, Amd Configuration File
4750@comment  node-name,  next,  previous,  up
4751@section amd.conf Examples
4752@cindex amd.conf examples
4753
4754The following is the actual @code{amd.conf} file I use at the
4755Computer Science Department of Columbia University.
4756
4757@example
4758# GLOBAL OPTIONS SECTION
4759[ global ]
4760normalize_hostnames =    no
4761print_pid =              no
4762#pid_file =              /var/run/amd.pid
4763restart_mounts =         yes
4764#unmount_on_exit =       yes
4765auto_dir =               /n
4766log_file =               /var/log/amd
4767log_options =            all
4768#debug_options =         all
4769plock =                  no
4770selectors_on_default =   yes
4771# config.guess picks up "sunos5" and I don't want to edit my maps yet
4772os =                     sos5
4773# if you print_version after setting up "os", it will show it.
4774print_version =          no
4775map_type =               file
4776search_path =            /etc/amdmaps:/usr/lib/amd:/usr/local/AMD/lib
4777browsable_dirs =         yes
4778fully_qualified_hosts =  no
4779
4780# DEFINE AN AMD MOUNT POINT
4781[ /u ]
4782map_name =               amd.u
4783                         
4784[ /proj ]                
4785map_name =               amd.proj
4786                         
4787[ /src ]                 
4788map_name =               amd.src
4789                         
4790[ /misc ]                
4791map_name =               amd.misc
4792                         
4793[ /import ]              
4794map_name =               amd.import
4795                         
4796[ /tftpboot/.amd ]       
4797tag =                    tftpboot
4798map_name =               amd.tftpboot
4799@end example
4800
4801@c ################################################################
4802@node Run-time Administration, FSinfo, Amd Configuration File, Top
4803@comment  node-name,  next,  previous,  up
4804@chapter Run-time Administration
4805@cindex Run-time administration
4806@cindex Amq command
4807
4808@menu
4809* Starting Amd::
4810* Stopping Amd::
4811* Restarting Amd::
4812* Controlling Amd::
4813@end menu
4814
4815@node Starting Amd, Stopping Amd, Run-time Administration, Run-time Administration
4816@comment  node-name,  next,  previous,  up
4817@section Starting @i{Amd}
4818@cindex Starting Amd
4819@cindex Additions to /etc/rc.local
4820@cindex /etc/rc.local additions
4821@cindex ctl-amd
4822
4823@i{Amd} is best started from @samp{/etc/rc.local} on BSD systems, or
4824from the appropriate start-level script in @samp{/etc/init.d} on System V
4825systems.
4826
4827@example
4828if [ -f /usr/local/sbin/ctl-amd ]; then
4829    /usr/local/sbin/ctl-amd start; (echo -n ' amd') > /dev/console
4830fi
4831@end example
4832
4833@noindent
4834The shell script, @samp{ctl-amd} is used to start, stop, or restart
4835@i{Amd}.  It is a relatively generic script.  All options you want to
4836set should not be made in this script, but rather updated in the
4837@file{amd.conf} file. @xref{Amd Configuration File}.
4838
4839If you do not wish to use an @i{Amd} configuration file, you may start
4840@i{Amd} manually.  For example, getting the map entries via NIS:
4841
4842@example
4843amd -r -l /var/log/amd `ypcat -k auto.master`
4844@end example
4845
4846@node Stopping Amd, Restarting Amd, Starting Amd, Run-time Administration
4847@comment  node-name,  next,  previous,  up
4848@section Stopping @i{Amd}
4849@cindex Stopping Amd
4850@cindex SIGTERM signal
4851@cindex SIGINT signal
4852
4853@i{Amd} stops in response to two signals.
4854
4855@table @samp
4856@item SIGTERM
4857causes the top-level automount points to be unmounted and then @i{Amd}
4858to exit.  Any automounted filesystems are left mounted.  They can be
4859recovered by restarting @i{Amd} with the @code{-r} command line option.@refill
4860
4861@item SIGINT
4862causes @i{Amd} to attempt to unmount any filesystems which it has
4863automounted, in addition to the actions of @samp{SIGTERM}.  This signal
4864is primarily used for debugging.@refill
4865@end table
4866
4867Actions taken for other signals are undefined.
4868
4869The easiest and safest way to stop @i{Amd}, without having to find its
4870process ID by hand, is to use the @file{ctl-amd} script, as with:
4871
4872@example
4873ctl-amd stop
4874@end example
4875
4876@node Restarting Amd, Controlling Amd, Stopping Amd, Run-time Administration
4877@comment  node-name,  next,  previous,  up
4878@section Restarting @i{Amd}
4879@cindex Restarting Amd
4880@cindex Killing and starting Amd
4881
4882Before @i{Amd} can be started, it is vital to ensure that no other
4883@i{Amd} processes are managing any of the mount points, and that the
4884previous process(es) have terminated cleanly.  When a terminating signal
4885is set to @i{Amd}, the automounter does @emph{not} terminate right then.
4886Rather, it starts by unmounting all of its managed mount mounts in the
4887background, and then terminates.  It usually takes a few seconds for
4888this process to happen, but it can take an arbitrarily longer time.  If
4889two or more @i{Amd} processes attempt to manage the same mount point, it
4890usually will result in a system lockup.
4891
4892The easiest and safest way to restart @i{Amd}, without having to find
4893its process ID by hand, sending it the @samp{SIGTERM} signal, waiting for @i{Amd}
4894to die cleanly, and verifying so, is to use the @file{ctl-amd} script,
4895as with:
4896
4897@example
4898ctl-amd restart
4899@end example
4900
4901The script will locate the process ID of @i{Amd}, kill it, and wait for
4902it to die cleanly before starting a new instance of the automounter.
4903@file{ctl-amd} will wait for a total of 30 seconds for @i{Amd} to die,
4904and will check once every 5 seconds if it had.
4905
4906@node Controlling Amd, , Restarting Amd, Run-time Administration
4907@comment  node-name,  next,  previous,  up
4908@section Controlling @i{Amd}
4909@cindex Controlling Amd
4910@cindex Discovering what is going on at run-time
4911@cindex Listing currently mounted filesystems
4912
4913It is sometimes desirable or necessary to exercise external control
4914over some of @i{Amd}'s internal state.  To support this requirement,
4915@i{Amd} implements an RPC interface which is used by the @dfn{Amq} program.
4916A variety of information is available.
4917
4918@i{Amq} generally applies an operation, specified by a single letter option,
4919to a list of mount points.  The default operation is to obtain statistics
4920about each mount point.  This is similar to the output shown above
4921but includes information about the number and type of accesses to each
4922mount point.
4923
4924@menu
4925* Amq default::       Default command behavior.
4926* Amq -f option::     Flushing the map cache.
4927* Amq -h option::     Controlling a non-local host.
4928* Amq -l option::     Controlling the log file.
4929* Amq -m option::     Obtaining mount statistics.
4930* Amq -M-option::     Mounting a volume.
4931* Amq -p option::     Getting Amd's process ID.
4932* Amq -P-option::     Contacting alternate Amd processes.
4933* Amq -s option::     Obtaining global statistics.
4934* Amq -T option::     Use TCP transport.
4935* Amq -U-option::     Use UDP transport.
4936* Amq -u option::     Forcing volumes to time out.
4937* Amq -v option::     Version information.
4938* Other Amq options:: Three other special options.
4939@end menu
4940
4941@c ----------------------------------------------------------------
4942@node Amq default, Amq -f option, Controlling Amd, Controlling Amd
4943@comment  node-name,  next,  previous,  up
4944@subsection @i{Amq} default information
4945
4946With no arguments, @dfn{Amq} obtains a brief list of all existing
4947mounts created by @i{Amd}.  This is different from the list displayed by
4948@b{df}(1) since the latter only includes system mount points.
4949
4950@noindent
4951The output from this option includes the following information:
4952
4953@itemize @bullet
4954@item
4955the automount point,
4956@item
4957the filesystem type,
4958@item
4959the mount map or mount information,
4960@item
4961the internal, or system mount point.
4962@end itemize
4963
4964@noindent
4965For example:
4966
4967@example
4968/            root   "root"                    sky:(pid75)
4969/homes       toplvl /usr/local/etc/amd.homes  /homes
4970/home        toplvl /usr/local/etc/amd.home   /home
4971/homes/jsp   nfs    charm:/home/charm         /a/charm/home/charm/jsp
4972/homes/phjk  nfs    toytown:/home/toytown     /a/toytown/home/toytown/ai/phjk
4973@end example
4974
4975@noindent
4976If an argument is given then statistics for that volume name will
4977be output.  For example:
4978
4979@example
4980What         Uid   Getattr Lookup RdDir   RdLnk   Statfs Mounted@@
4981/homes       0     1196    512    22      0       30     90/09/14 12:32:55
4982/homes/jsp   0     0       0      0       1180    0      90/10/13 12:56:58
4983@end example
4984
4985@table @code
4986@item What
4987the volume name.
4988
4989@item Uid
4990ignored.
4991
4992@item Getattr
4993the count of NFS @dfn{getattr} requests on this node.  This should only be
4994non-zero for directory nodes.
4995
4996@item Lookup
4997the count of NFS @dfn{lookup} requests on this node.  This should only be
4998non-zero for directory nodes.
4999
5000@item RdDir
5001the count of NFS @dfn{readdir} requests on this node.  This should only
5002be non-zero for directory nodes.
5003
5004@item RdLnk
5005the count of NFS @dfn{readlink} requests on this node.  This should be
5006zero for directory nodes.
5007
5008@item Statfs
5009the count of NFS @dfn{statfs} requests on this node.  This should only
5010be non-zero for top-level automount points.
5011
5012@item Mounted@@
5013the date and time the volume name was first referenced.
5014@end table
5015
5016@c ----------------------------------------------------------------
5017@node Amq -f option, Amq -h option, Amq default, Controlling Amd
5018@comment  node-name,  next,  previous,  up
5019@subsection @i{Amq} @code{-f} option
5020@cindex Flushing the map cache
5021@cindex Map cache, flushing
5022
5023The @code{-f} option causes @i{Amd} to flush the internal mount map cache.
5024This is useful for example in Hesiod maps since @i{Amd} will not
5025automatically notice when they have been updated.  The map cache can
5026also be synchronized with the map source by using the @samp{sync} option
5027(@pxref{Automount Filesystem}).@refill
5028
5029@c ----------------------------------------------------------------
5030@node Amq -l option, Amq -m option, Amq -h option, Controlling Amd
5031@comment  node-name,  next,  previous,  up
5032@subsection @i{Amq} @code{-l} option
5033@cindex Resetting the Amd log file
5034@cindex Setting the Amd log file via Amq
5035@cindex Log file, resetting
5036
5037Tell @i{Amd} to use @i{log_file} as the log file name.  For security
5038reasons, this @emph{must} be the same log file which @i{Amd} used when
5039started.  This option is therefore only useful to refresh @i{Amd}'s open
5040file handle on the log file, so that it can be rotated and compressed
5041via daily cron jobs.
5042
5043@c ----------------------------------------------------------------
5044@node Amq -h option, Amq -l option, Amq -f option, Controlling Amd
5045@comment  node-name,  next,  previous,  up
5046@subsection @i{Amq} @code{-h} option
5047@cindex Querying an alternate host
5048
5049By default the local host is used.  In an HP-UX cluster the root server
5050is used since that is the only place in the cluster where @i{Amd} will
5051be running.  To query @i{Amd} on another host the @code{-h} option should
5052be used.
5053
5054@c ----------------------------------------------------------------
5055@node Amq -m option, Amq -M-option, Amq -l option, Controlling Amd
5056@comment  node-name,  next,  previous,  up
5057@subsection @i{Amq} @code{-m} option
5058
5059The @code{-m} option displays similar information about mounted
5060filesystems, rather than automount points.  The output includes the
5061following information:
5062
5063@itemize @bullet
5064@item
5065the mount information,
5066@item
5067the mount point,
5068@item
5069the filesystem type,
5070@item
5071the number of references to this filesystem,
5072@item
5073the server hostname,
5074@item
5075the state of the file server,
5076@item
5077any error which has occurred.
5078@end itemize
5079
5080For example:
5081
5082@example
5083"root"           truth:(pid602)     root   1 localhost is up
5084hesiod.home      /home              toplvl 1 localhost is up
5085hesiod.vol       /vol               toplvl 1 localhost is up
5086hesiod.homes     /homes             toplvl 1 localhost is up
5087amy:/home/amy    /a/amy/home/amy    nfs    5 amy is up
5088swan:/home/swan  /a/swan/home/swan  nfs    0 swan is up (Permission denied)
5089ex:/home/ex      /a/ex/home/ex      nfs    0 ex is down
5090@end example
5091
5092When the reference count is zero the filesystem is not mounted but
5093the mount point and server information is still being maintained
5094by @i{Amd}.
5095
5096@c ----------------------------------------------------------------
5097@node Amq -M-option, Amq -p option, Amq -m option, Controlling Amd
5098@comment  node-name,  next,  previous,  up
5099@subsection @i{Amq} @code{-M} option
5100
5101The @code{-M} option passes a new map entry to @i{Amd} and waits for it to
5102be evaluated, possibly causing a mount.  For example, the following
5103command would cause @samp{/home/toytown} on host @samp{toytown} to be
5104mounted locally on @samp{/mnt/toytown}.
5105
5106@example
5107amq -M '/mnt/toytown type:=nfs;rfs:=/home/toytown;rhost:=toytown;fs:=$@{key@}'
5108@end example
5109
5110@i{Amd} applies some simple security checks before allowing this
5111operation.  The check tests whether the incoming request is from a
5112privileged UDP port on the local machine.  ``Permission denied'' is
5113returned if the check fails.
5114
5115This option is very insecure as it is vulnerable to attacks such as IP
5116Spoofing.  In other words, it is relatively easy for an attacker who
5117really wants to, to make your @i{Amd} process mount any filesystem from
5118the Internet!  Therefore, the @emph{complete} code which supports the
5119@code{-M} option in @i{Amd} and @i{Amq} is turned off by default.  To turn
5120it on, you have to reconfigure am-utils with @code{configure
5121--enable-amq-mount}.  Think twice before doing so, and use this option
5122only if you absolutely need to.
5123
5124A future release of @i{Amd} will include code to allow the @b{mount}(8)
5125command to mount automount points:
5126
5127@example
5128mount -t amd /vol hesiod.vol
5129@end example
5130
5131This will then allow @i{Amd} to be controlled from the standard system
5132filesystem mount list.
5133
5134@c ----------------------------------------------------------------
5135@node Amq -p option, Amq -P-option, Amq -M-option, Controlling Amd
5136@comment  node-name,  next,  previous,  up
5137@subsection @i{Amq} @code{-p} option
5138@cindex Process ID; Amd
5139@cindex Amd's process ID
5140@cindex Amd's PID
5141@cindex PID; Amd
5142
5143Return the process ID of the remote or locally running @i{Amd}.  Useful
5144when you need to send a signal to the local @i{Amd} process, and would
5145rather not have to search through the process table.  This option is
5146used in the @file{ctl-amd} script.
5147
5148@c ----------------------------------------------------------------
5149@node Amq -P-option, Amq -s option, Amq -p option, Controlling Amd
5150@comment  node-name,  next,  previous,  up
5151@subsection @i{Amq} @code{-P} option
5152@cindex Multiple Amd processes
5153@cindex Running multiple Amd
5154@cindex Debugging a new Amd configuration
5155@cindex RPC Program numbers; Amd
5156
5157Contact an alternate running @i{Amd} that had registered itself on a
5158different RPC @var{program_number} and apply all other operations to
5159that instance of the automounter.  This is useful when you run multiple
5160copies of @i{Amd}, and need to manage each one separately.  If not
5161specified, @i{Amq} will use the default program number for @i{Amd}, 300019.
5162For security reasons, the only alternate program numbers @i{Amd} can use
5163range from 300019 to 300029, inclusive.
5164
5165For example, to kill an alternate running @i{Amd}:
5166
5167@example
5168kill `amq -p -P 300020`
5169@end example
5170
5171@c ----------------------------------------------------------------
5172@node Amq -s option, Amq -T option, Amq -P-option, Controlling Amd
5173@comment  node-name,  next,  previous,  up
5174@subsection @i{Amq} @code{-s} option
5175@cindex Global statistics
5176@cindex Statistics
5177
5178The @code{-s} option displays global statistics.  If any other options are specified
5179or any filesystems named then this option is ignored.  For example:
5180
5181@example
5182requests  stale     mount     mount     unmount
5183deferred  fhandles  ok        failed    failed
51841054      1         487       290       7017
5185@end example
5186
5187@table @samp
5188@item Deferred requests
5189are those for which an immediate reply could not be constructed.  For
5190example, this would happen if a background mount was required.
5191
5192@item Stale filehandles
5193counts the number of times the kernel passes a stale filehandle to @i{Amd}.
5194Large numbers indicate problems.
5195
5196@item Mount ok
5197counts the number of automounts which were successful.
5198
5199@item Mount failed
5200counts the number of automounts which failed.
5201
5202@item Unmount failed
5203counts the number of times a filesystem could not be unmounted.  Very
5204large numbers here indicate that the time between unmount attempts
5205should be increased.
5206@end table
5207
5208@c ----------------------------------------------------------------
5209@node Amq -T option, Amq -U-option, Amq -s option, Controlling Amd
5210@comment  node-name,  next,  previous,  up
5211@subsection @i{Amq} @code{-T} option
5212@cindex Forcing Amq to use a TCP transport
5213@cindex TCP; using with Amq
5214
5215The @code{-T} option causes the @i{Amq} to contact @i{Amd} using the TCP
5216transport only (connection oriented).  Normally, @i{Amq} will use TCP
5217first, and if that failed, will try UDP.
5218
5219@c ----------------------------------------------------------------
5220@node Amq -U-option, Amq -u option, Amq -T option, Controlling Amd
5221@comment  node-name,  next,  previous,  up
5222@subsection @i{Amq} @code{-U} option
5223@cindex Forcing Amq to use a UDP transport
5224@cindex UDP; using with Amq
5225
5226The @code{-U} option causes the @i{Amq} to contact @i{Amd} using the UDP
5227transport only (connectionless).  Normally, @i{Amq} will use TCP first,
5228and if that failed, will try UDP.
5229
5230@c ----------------------------------------------------------------
5231@node Amq -u option, Amq -v option, Amq -U-option, Controlling Amd
5232@comment  node-name,  next,  previous,  up
5233@subsection @i{Amq} @code{-u} option
5234@cindex Forcing filesystem to time out
5235@cindex Unmounting a filesystem
5236
5237The @code{-u} option causes the time-to-live interval of the named mount
5238points to be expired, thus causing an unmount attempt.  This is the only
5239safe way to unmount an automounted filesystem.  It is not possible to
5240unmount a filesystem which has been mounted with the @samp{nounmount}
5241flag.
5242
5243@c The @code{-H} option informs @i{Amd} that the specified mount point has hung -
5244@c as if its keepalive timer had expired.
5245
5246@c ----------------------------------------------------------------
5247@node Amq -v option, Other Amq options, Amq -u option, Controlling Amd
5248@comment  node-name,  next,  previous,  up
5249@subsection @i{Amq} @code{-v} option
5250@cindex Version information at run-time
5251
5252The @code{-v} option displays the version of @i{Amd} in a similar way to
5253@i{Amd}'s @code{-v} option.
5254
5255@c ----------------------------------------------------------------
5256@node Other Amq options, , Amq -v option, Controlling Amd
5257@comment  node-name,  next,  previous,  up
5258@subsection Other @i{Amq} options
5259@cindex Logging options via Amq
5260@cindex Debugging options via Amq
5261
5262Two other operations are implemented.  These modify the state of @i{Amd}
5263as a whole, rather than any particular filesystem.  The @code{-x} and
5264@code{-D} options have exactly the same effect as @i{Amd}'s corresponding
5265command line options.
5266
5267When @i{Amd} receives a @code{-x} flag it limits the log options being
5268modified to those which were not enabled at startup.  This prevents a
5269user turning @emph{off} any logging option which was specified at
5270startup, though any which have been turned on since then can still be
5271turned off.  The @code{-D} option has a similar behavior.
5272
5273@c ################################################################
5274@node FSinfo, Hlfsd, Run-time Administration, Top
5275@comment  node-name,  next,  previous,  up
5276@chapter FSinfo
5277@cindex FSinfo
5278@cindex Filesystem info package
5279
5280XXX: this chapter should be reviewed by someone knowledgeable with
5281fsinfo.
5282
5283@menu
5284* FSinfo Overview::                 Introduction to FSinfo.
5285* Using FSinfo::                    Basic concepts.
5286* FSinfo Grammar::                  Language syntax, semantics and examples.
5287* FSinfo host definitions::         Defining a new host.
5288* FSinfo host attributes::          Definable host attributes. 
5289* FSinfo filesystems::              Defining locally attached filesystems.
5290* FSinfo static mounts::            Defining additional static mounts.
5291* FSinfo automount definitions::
5292* FSinfo Command Line Options::
5293* FSinfo errors::
5294@end menu
5295
5296@node FSinfo Overview, Using FSinfo, FSinfo, FSinfo
5297@comment  node-name,  next,  previous,  up
5298@section @i{FSinfo} overview
5299@cindex FSinfo overview
5300
5301@i{FSinfo} is a filesystem management tool.  It has been designed to
5302work with @i{Amd} to help system administrators keep track of the ever
5303increasing filesystem namespace under their control.
5304
5305The purpose of @i{FSinfo} is to generate all the important standard
5306filesystem data files from a single set of input data.  Starting with a
5307single data source guarantees that all the generated files are
5308self-consistent.  One of the possible output data formats is a set of
5309@i{Amd} maps which can be used amongst the set of hosts described in the
5310input data.
5311
5312@i{FSinfo} implements a declarative language.  This language is
5313specifically designed for describing filesystem namespace and physical
5314layouts.  The basic declaration defines a mounted filesystem including
5315its device name, mount point, and all the volumes and access
5316permissions.  @i{FSinfo} reads this information and builds an internal
5317map of the entire network of hosts.  Using this map, many different data
5318formats can be produced including @file{/etc/fstab},
5319@file{/etc/exports}, @i{Amd} mount maps and
5320@file{/etc/bootparams}.@refill
5321
5322@node Using FSinfo, FSinfo Grammar, FSinfo Overview, FSinfo
5323@comment  node-name,  next,  previous,  up
5324@section Using @i{FSinfo}
5325@cindex Using FSinfo
5326
5327The basic strategy when using @i{FSinfo} is to gather all the
5328information about all disks on all machines into one set of
5329declarations.  For each machine being managed, the following data is
5330required:
5331
5332@itemize @bullet
5333@item
5334Hostname
5335@item
5336List of all filesystems and, optionally, their mount points.
5337@item
5338Names of volumes stored on each filesystem.
5339@item
5340NFS export information for each volume.
5341@item
5342The list of static filesystem mounts.
5343@end itemize
5344
5345The following information can also be entered into the same
5346configuration files so that all data can be kept in one place.
5347
5348@itemize @bullet
5349@item
5350List of network interfaces
5351@item
5352IP address of each interface
5353@item
5354Hardware address of each interface
5355@item
5356Dumpset to which each filesystem belongs
5357@item
5358and more @dots{}
5359@end itemize
5360
5361To generate @i{Amd} mount maps, the automount tree must also be defined
5362(@pxref{FSinfo automount definitions}).  This will have been designed at
5363the time the volume names were allocated.  Some volume names will not be
5364automounted, so @i{FSinfo} needs an explicit list of which volumes
5365should be automounted.@refill
5366
5367Hostnames are required at several places in the @i{FSinfo} language.  It
5368is important to stick to either fully qualified names or unqualified
5369names.  Using a mixture of the two will inevitably result in confusion.
5370
5371Sometimes volumes need to be referenced which are not defined in the set
5372of hosts being managed with @i{FSinfo}.  The required action is to add a
5373dummy set of definitions for the host and volume names required.  Since
5374the files generated for those particular hosts will not be used on them,
5375the exact values used is not critical.
5376
5377@node FSinfo Grammar, FSinfo host definitions, Using FSinfo, FSinfo
5378@comment  node-name,  next,  previous,  up
5379@section @i{FSinfo} grammar
5380@cindex FSinfo grammar
5381@cindex Grammar, FSinfo
5382
5383@i{FSinfo} has a relatively simple grammar.  Distinct syntactic
5384constructs exist for each of the different types of data, though they
5385share a common flavor.  Several conventions are used in the grammar
5386fragments below.
5387
5388The notation, @i{list(}@t{xxx}@i{)}, indicates a list of zero or more
5389@t{xxx}'s.  The notation, @i{opt(}@t{xxx}@i{)}, indicates zero or one
5390@t{xxx}.  Items in double quotes, @i{eg} @t{"host"}, represent input
5391tokens.  Items in angle brackets, @i{eg} @var{<hostname>}, represent
5392strings in the input.  Strings need not be in double quotes, except to
5393differentiate them from reserved words.  Quoted strings may include the
5394usual set of C ``@t{\}'' escape sequences with one exception: a
5395backslash-newline-whitespace sequence is squashed into a single space
5396character.  To defeat this feature, put a further backslash at the start
5397of the second line.
5398
5399At the outermost level of the grammar, the input consists of a
5400sequence of host and automount declarations.  These declarations are
5401all parsed before they are analyzed.  This means they can appear in
5402any order and cyclic host references are possible.
5403
5404@example
5405fsinfo      : @i{list(}fsinfo_attr@i{)} ;
5406
5407fsinfo_attr : host | automount ;
5408@end example
5409
5410@menu
5411* FSinfo host definitions::
5412* FSinfo automount definitions::
5413@end menu
5414
5415@node FSinfo host definitions, FSinfo host attributes, FSinfo Grammar, FSinfo
5416@comment  node-name,  next,  previous,  up
5417@section @i{FSinfo} host definitions
5418@cindex FSinfo host definitions
5419@cindex Defining a host, FSinfo
5420
5421A host declaration consists of three parts: a set of machine attribute
5422data, a list of filesystems physically attached to the machine, and a
5423list of additional statically mounted filesystems.
5424
5425@example
5426host        : "host" host_data @i{list(}filesystem@i{@i{)}} @i{list(}mount@i{@i{)}} ;
5427@end example
5428
5429Each host must be declared in this way exactly once.  Such things as the
5430hardware address, the architecture and operating system types and the
5431cluster name are all specified within the @dfn{host data}.
5432
5433All the disks the machine has should then be described in the @dfn{list
5434of filesystems}.  When describing disks, you can specify what
5435@dfn{volname} the disk/partition should have and all such entries are
5436built up into a dictionary which can then be used for building the
5437automounter maps.
5438
5439The @dfn{list of mounts} specifies all the filesystems that should be
5440statically mounted on the machine.
5441
5442@menu
5443* FSinfo host attributes::
5444* FSinfo filesystems::
5445* FSinfo static mounts::
5446@end menu
5447
5448@node FSinfo host attributes, FSinfo filesystems, FSinfo host definitions , FSinfo host definitions
5449@comment  node-name,  next,  previous,  up
5450@section @i{FSinfo} host attributes
5451@cindex FSinfo host attributes
5452@cindex Defining host attributes, FSinfo
5453
5454The host data, @dfn{host_data}, always includes the @dfn{hostname}.  In
5455addition, several other host attributes can be given.
5456
5457@example
5458host_data   : @var{<hostname>}
5459            | "@{" @i{list(}host_attrs@i{)} "@}" @var{<hostname>}
5460            ;
5461
5462host_attrs  : host_attr "=" @var{<string>}
5463            | netif
5464            ;
5465
5466host_attr   : "config"
5467            | "arch"
5468            | "os"
5469            | "cluster"
5470            ;
5471@end example
5472
5473The @dfn{hostname} is, typically, the fully qualified hostname of the
5474machine.
5475
5476Examples:
5477
5478@example
5479host dylan.doc.ic.ac.uk
5480
5481host @{
5482    os = hpux
5483    arch = hp300
5484@} dougal.doc.ic.ac.uk
5485@end example
5486
5487The options that can be given as host attributes are shown below.
5488
5489@menu
5490* netif Option:         FSinfo host netif:
5491* config Option:        FSinfo host config:
5492* arch Option:          FSinfo host arch:
5493* os Option:            FSinfo host os:
5494* cluster Option:       FSinfo host cluster:
5495@end menu
5496
5497@node FSinfo host netif, FSinfo host config, , FSinfo host attributes
5498@comment  node-name,  next,  previous,  up
5499@subsection netif Option
5500
5501This defines the set of network interfaces configured on the machine.
5502The interface attributes collected by @i{FSinfo} are the IP address,
5503subnet mask and hardware address.  Multiple interfaces may be defined
5504for hosts with several interfaces by an entry for each interface.  The
5505values given are sanity checked, but are currently unused for anything
5506else.
5507
5508@example
5509netif       : "netif" @var{<string>} "@{" @i{list(}netif_attrs@i{)} "@}" ;
5510
5511netif_attrs : netif_attr "=" @var{<string>} ;
5512
5513netif_attr  : "inaddr" | "netmask" | "hwaddr" ;
5514@end example
5515
5516Examples:
5517
5518@example
5519netif ie0 @{
5520    inaddr  = 129.31.81.37
5521    netmask = 0xfffffe00
5522    hwaddr  = "08:00:20:01:a6:a5"
5523@}
5524
5525netif ec0 @{ @}
5526@end example
5527
5528@node FSinfo host config, FSinfo host arch, FSinfo host netif, FSinfo host attributes
5529@comment  node-name,  next,  previous,  up
5530@subsection config Option
5531@cindex FSinfo config host attribute
5532@cindex config, FSinfo host attribute
5533
5534This option allows you to specify configuration variables for the
5535startup scripts (@file{rc} scripts).  A simple string should immediately
5536follow the keyword.
5537
5538Example:
5539
5540@example
5541config "NFS_SERVER=true"
5542config "ZEPHYR=true"
5543@end example
5544
5545This option is currently unsupported.
5546
5547@node FSinfo host arch, FSinfo host os, FSinfo host config, FSinfo host attributes
5548@comment  node-name,  next,  previous,  up
5549@subsection arch Option
5550@cindex FSinfo arch host attribute
5551@cindex arch, FSinfo host attribute
5552
5553This defines the architecture of the machine.  For example:
5554
5555@example
5556arch = hp300
5557@end example
5558
5559This is intended to be of use when building architecture specific
5560mountmaps, however, the option is currently unsupported.
5561
5562@node FSinfo host os, FSinfo host cluster, FSinfo host arch, FSinfo host attributes
5563@comment  node-name,  next,  previous,  up
5564@subsection os Option
5565@cindex FSinfo os host attribute
5566@cindex os, FSinfo host attribute
5567
5568This defines the operating system type of the host.  For example:
5569
5570@example
5571os = hpux
5572@end example
5573
5574This information is used when creating the @file{fstab} files, for
5575example in choosing which format to use for the @file{fstab} entries
5576within the file.
5577
5578@node FSinfo host cluster, , FSinfo host os, FSinfo host attributes
5579@comment  node-name,  next,  previous,  up
5580@subsection cluster Option
5581@cindex FSinfo cluster host attribute
5582@cindex cluster, FSinfo host attribute
5583
5584This is used for specifying in which cluster the machine belongs.  For
5585example:
5586
5587@example
5588cluster = "theory"
5589@end example
5590
5591The cluster is intended to be used when generating the automount maps,
5592although it is currently unsupported.
5593
5594@node FSinfo filesystems, FSinfo static mounts, FSinfo host attributes, FSinfo host definitions
5595@comment  node-name,  next,  previous,  up
5596@section @i{FSinfo} filesystems
5597@cindex FSinfo filesystems
5598
5599The list of physically attached filesystems follows the machine
5600attributes.  These should define all the filesystems available from this
5601machine, whether exported or not.  In addition to the device name,
5602filesystems have several attributes, such as filesystem type, mount
5603options, and @samp{fsck} pass number which are needed to generate
5604@file{fstab} entries.
5605
5606@example
5607filesystem  : "fs" @var{<device>} "@{" @i{list(}fs_data@i{)} "@}" ;
5608
5609fs_data     : fs_data_attr "=" @var{<string>}
5610            | mount
5611            ;
5612
5613fs_data_attr
5614            : "fstype" | "opts" | "passno"
5615            | "freq" | "dumpset" | "log"
5616            ;
5617@end example
5618
5619Here, @var{<device>} is the device name of the disk (for example,
5620@file{/dev/dsk/2s0}).  The device name is used for building the mount
5621maps and for the @file{fstab} file.  The attributes that can be
5622specified are shown in the following section.
5623
5624The @i{FSinfo} configuration file for @code{dylan.doc.ic.ac.uk} is listed below.
5625
5626@example
5627host dylan.doc.ic.ac.uk
5628
5629fs /dev/dsk/0s0 @{
5630        fstype = swap
5631@}
5632
5633fs /dev/dsk/0s0 @{
5634        fstype = hfs
5635        opts = rw,noquota,grpid
5636        passno = 0;
5637        freq = 1;
5638        mount / @{ @}
5639@}
5640
5641fs /dev/dsk/1s0 @{
5642        fstype = hfs
5643        opts = defaults
5644        passno = 1;
5645        freq = 1;
5646        mount /usr @{
5647                local @{
5648                        exportfs "dougal eden dylan zebedee brian"
5649                        volname /nfs/hp300/local
5650                @}
5651        @}
5652@}
5653
5654fs /dev/dsk/2s0 @{
5655        fstype = hfs
5656        opts = defaults
5657        passno = 1;
5658        freq = 1;
5659        mount default @{
5660                exportfs "toytown_clients hangers_on"
5661                volname /home/dylan/dk2
5662        @}
5663@}
5664
5665fs /dev/dsk/3s0 @{
5666        fstype = hfs
5667        opts = defaults
5668        passno = 1;
5669        freq = 1;
5670        mount default @{
5671                exportfs "toytown_clients hangers_on"
5672                volname /home/dylan/dk3
5673        @}
5674@}
5675
5676fs /dev/dsk/5s0 @{
5677        fstype = hfs
5678        opts = defaults
5679        passno = 1;
5680        freq = 1;
5681        mount default @{
5682                exportfs "toytown_clients hangers_on"
5683                volname /home/dylan/dk5
5684        @}
5685@}
5686@end example
5687
5688@menu
5689* fstype Option:        FSinfo filesystems fstype:
5690* opts Option:          FSinfo filesystems opts:
5691* passno Option:        FSinfo filesystems passno:
5692* freq Option:          FSinfo filesystems freq:
5693* mount Option:         FSinfo filesystems mount:
5694* dumpset Option:       FSinfo filesystems dumpset:
5695* log Option:           FSinfo filesystems log:
5696@end menu
5697
5698@node FSinfo filesystems fstype, FSinfo filesystems opts, , FSinfo filesystems
5699@comment  node-name,  next,  previous,  up
5700@subsection fstype Option
5701@cindex FSinfo fstype filesystems option
5702@cindex fstype, FSinfo filesystems option
5703@cindex export, FSinfo special fstype
5704
5705This specifies the type of filesystem being declared and will be placed
5706into the @file{fstab} file as is.  The value of this option will be
5707handed to @code{mount} as the filesystem type---it should have such
5708values as @code{4.2}, @code{nfs} or @code{swap}.  The value is not
5709examined for correctness.
5710
5711There is one special case.  If the filesystem type is specified as
5712@samp{export} then the filesystem information will not be added to the
5713host's @file{fstab} information, but it will still be visible on the
5714network.  This is useful for defining hosts which contain referenced
5715volumes but which are not under full control of @i{FSinfo}.
5716
5717Example:
5718
5719@example
5720fstype = swap
5721@end example
5722
5723@node FSinfo filesystems opts, FSinfo filesystems passno, FSinfo filesystems fstype, FSinfo filesystems
5724@comment  node-name,  next,  previous,  up
5725@subsection opts Option
5726@cindex FSinfo opts filesystems option
5727@cindex opts, FSinfo filesystems option
5728
5729This defines any options that should be given to @b{mount}(8) in the
5730@file{fstab} file.  For example:
5731
5732@example
5733opts = rw,nosuid,grpid
5734@end example
5735
5736@node FSinfo filesystems passno, FSinfo filesystems freq, FSinfo filesystems opts, FSinfo filesystems
5737@comment  node-name,  next,  previous,  up
5738@subsection passno Option
5739@cindex FSinfo passno filesystems option
5740@cindex passno, FSinfo filesystems option
5741
5742This defines the @b{fsck}(8) pass number in which to check the
5743filesystem.  This value will be placed into the @file{fstab} file.
5744
5745Example:
5746
5747@example
5748passno = 1
5749@end example
5750
5751@node FSinfo filesystems freq, FSinfo filesystems mount, FSinfo filesystems passno, FSinfo filesystems
5752@comment  node-name,  next,  previous,  up
5753@subsection freq Option
5754@cindex FSinfo freq filesystems option
5755@cindex freq, FSinfo filesystems option
5756
5757This defines the interval (in days) between dumps.  The value is placed
5758as is into the @file{fstab} file.
5759
5760Example:
5761
5762@example
5763freq = 3
5764@end example
5765
5766@node FSinfo filesystems mount, FSinfo filesystems dumpset, FSinfo filesystems freq, FSinfo filesystems
5767@comment  node-name,  next,  previous,  up
5768@subsection mount Option
5769@cindex FSinfo mount filesystems option
5770@cindex mount, FSinfo filesystems option
5771@cindex exportfs, FSinfo mount option
5772@cindex volname, FSinfo mount option
5773@cindex sel, FSinfo mount option
5774
5775This defines the mountpoint at which to place the filesystem.  If the
5776mountpoint of the filesystem is specified as @code{default}, then the
5777filesystem will be mounted in the automounter's tree under its volume
5778name and the mount will automatically be inherited by the automounter.
5779
5780Following the mountpoint, namespace information for the filesystem may
5781be described.  The options that can be given here are @code{exportfs},
5782@code{volname} and @code{sel}.
5783
5784The format is:
5785
5786@example
5787mount       : "mount" vol_tree ;
5788
5789vol_tree    : @i{list(}vol_tree_attr@i{)} ;
5790
5791vol_tree_attr
5792            :  @var{<string>} "@{" @i{list(}vol_tree_info@i{)} vol_tree "@}" ;
5793
5794vol_tree_info
5795            : "exportfs" @var{<export-data>}
5796            | "volname" @var{<volname>}
5797            | "sel" @var{<selector-list>}
5798            ;
5799@end example
5800
5801Example:
5802
5803@example
5804mount default @{
5805    exportfs "dylan dougal florence zebedee"
5806    volname /vol/andrew
5807@}
5808@end example
5809
5810In the above example, the filesystem currently being declared will have
5811an entry placed into the @file{exports} file allowing the filesystem to
5812be exported to the machines @code{dylan}, @code{dougal}, @code{florence}
5813and @code{zebedee}.  The volume name by which the filesystem will be
5814referred to remotely, is @file{/vol/andrew}.  By declaring the
5815mountpoint to be @code{default}, the filesystem will be mounted on the
5816local machine in the automounter tree, where @i{Amd} will automatically
5817inherit the mount as @file{/vol/andrew}.@refill
5818
5819@table @samp
5820@item exportfs
5821a string defining which machines the filesystem may be exported to.
5822This is copied, as is, into the @file{exports} file---no sanity checking
5823is performed on this string.@refill
5824
5825@item volname
5826a string which declares the remote name by which to reference the
5827filesystem.  The string is entered into a dictionary and allows you to
5828refer to this filesystem in other places by this volume name.@refill
5829
5830@item sel
5831a string which is placed into the automounter maps as a selector for the
5832filesystem.@refill
5833
5834@end table
5835
5836@node FSinfo filesystems dumpset, FSinfo filesystems log, FSinfo filesystems mount, FSinfo filesystems
5837@comment  node-name,  next,  previous,  up
5838@subsection dumpset Option
5839@cindex FSinfo dumpset filesystems option
5840@cindex dumpset, FSinfo filesystems option
5841
5842This provides support for Imperial College's local file backup tools and
5843is not documented further here.
5844
5845@node FSinfo filesystems log, , FSinfo filesystems dumpset, FSinfo filesystems    
5846@comment  node-name,  next,  previous,  up
5847@subsection log Option
5848@cindex FSinfo log filesystems option
5849@cindex log, FSinfo filesystems option
5850
5851Specifies the log device for the current filesystem. This is ignored if
5852not required by the particular filesystem type.
5853
5854@node FSinfo static mounts, FSinfo automount definitions , FSinfo filesystems, FSinfo host definitions
5855@comment  node-name,  next,  previous,  up
5856@section @i{FSinfo} static mounts
5857@cindex FSinfo static mounts
5858@cindex Statically mounts filesystems, FSinfo
5859
5860Each host may also have a number of statically mounted filesystems.  For
5861example, the host may be a diskless workstation in which case it will
5862have no @code{fs} declarations.  In this case the @code{mount}
5863declaration is used to determine from where its filesystems will be
5864mounted.  In addition to being added to the @file{fstab} file, this
5865information can also be used to generate a suitable @file{bootparams}
5866file.@refill
5867
5868@example
5869mount       : "mount" @var{<volname>} @i{list(}localinfo@i{)} ;
5870
5871localinfo   : localinfo_attr @var{<string>} ;
5872
5873localinfo_attr
5874            : "as"
5875            | "from"
5876            | "fstype"
5877            | "opts"
5878            ;
5879@end example
5880
5881The filesystem specified to be mounted will be searched for in the
5882dictionary of volume names built when scanning the list of hosts'
5883definitions.
5884
5885The attributes have the following semantics:
5886@table @samp
5887@item from @var{machine}
5888mount the filesystem from the machine with the hostname of
5889@dfn{machine}.@refill
5890
5891@item as @var{mountpoint}
5892mount the filesystem locally as the name given, in case this is
5893different from the advertised volume name of the filesystem.
5894
5895@item opts @var{options}
5896native @b{mount}(8) options.
5897
5898@item fstype @var{type}
5899type of filesystem to be mounted.
5900@end table
5901
5902An example:
5903
5904@example
5905mount /export/exec/hp300/local as /usr/local
5906@end example
5907
5908If the mountpoint specified is either @file{/} or @file{swap}, the
5909machine will be considered to be booting off the net and this will be
5910noted for use in generating a @file{bootparams} file for the host which
5911owns the filesystems.
5912
5913@node FSinfo automount definitions, FSinfo Command Line Options, FSinfo static mounts, FSinfo
5914@comment  node-name,  next,  previous,  up
5915@section Defining an @i{Amd} Mount Map in @i{FSinfo}
5916@cindex FSinfo automount definitions
5917@cindex Defining an Amd mount map, FSinfo
5918
5919The maps used by @i{Amd} can be constructed from @i{FSinfo} by defining
5920all the automount trees.  @i{FSinfo} takes all the definitions found and
5921builds one map for each top level tree.
5922
5923The automount tree is usually defined last.  A single automount
5924configuration will usually apply to an entire management domain.  One
5925@code{automount} declaration is needed for each @i{Amd} automount point.
5926@i{FSinfo} determines whether the automount point is @dfn{direct}
5927(@pxref{Direct Automount Filesystem}) or @dfn{indirect}
5928(@pxref{Top-level Filesystem}).  Direct automount points are
5929distinguished by the fact that there is no underlying
5930@dfn{automount_tree}.@refill
5931
5932@example
5933automount   : "automount" @i{opt(}auto_opts@i{)} automount_tree ;
5934
5935auto_opts   : "opts" @var{<mount-options>} ;
5936
5937automount_tree
5938            : @i{list(}automount_attr@i{)}
5939            ;
5940
5941automount_attr
5942            : @var{<string>} "=" @var{<volname>}
5943            | @var{<string>} "->" @var{<symlink>}
5944            | @var{<string>} "@{" automount_tree "@}"
5945            ;
5946@end example
5947
5948If @var{<mount-options>} is given, then it is the string to be placed in
5949the maps for @i{Amd} for the @code{opts} option.
5950
5951A @dfn{map} is typically a tree of filesystems, for example @file{home}
5952normally contains a tree of filesystems representing other machines in
5953the network.
5954
5955A map can either be given as a name representing an already defined
5956volume name, or it can be a tree.  A tree is represented by placing
5957braces after the name.  For example, to define a tree @file{/vol}, the
5958following map would be defined:
5959
5960@example
5961automount /vol @{ @}
5962@end example
5963
5964Within a tree, the only items that can appear are more maps.
5965For example:
5966
5967@example
5968automount /vol @{
5969    andrew @{ @}
5970    X11 @{ @}
5971@}
5972@end example
5973
5974In this case, @i{FSinfo} will look for volumes named @file{/vol/andrew}
5975and @file{/vol/X11} and a map entry will be generated for each.  If the
5976volumes are defined more than once, then @i{FSinfo} will generate
5977a series of alternate entries for them in the maps.@refill
5978
5979Instead of a tree, either a link (@var{name} @code{->}
5980@var{destination}) or a reference can be specified (@var{name} @code{=}
5981@var{destination}).  A link creates a symbolic link to the string
5982specified, without further processing the entry.  A reference will
5983examine the destination filesystem and optimize the reference.  For
5984example, to create an entry for @code{njw} in the @file{/homes} map,
5985either of the two forms can be used:@refill
5986
5987@example
5988automount /homes @{
5989    njw -> /home/dylan/njw
5990@}
5991@end example
5992
5993or
5994
5995@example
5996automount /homes @{
5997    njw = /home/dylan/njw
5998@}
5999@end example
6000
6001In the first example, when @file{/homes/njw} is referenced from @i{Amd},
6002a link will be created leading to @file{/home/dylan/njw} and the
6003automounter will be referenced a second time to resolve this filename.
6004The map entry would be:
6005
6006@example
6007njw type:=link;fs:=/home/dylan/njw
6008@end example
6009
6010In the second example, the destination directory is analyzed and found
6011to be in the filesystem @file{/home/dylan} which has previously been
6012defined in the maps. Hence the map entry will look like:
6013
6014@example
6015njw rhost:=dylan;rfs:=/home/dylan;sublink:=njw
6016@end example
6017
6018Creating only one symbolic link, and one access to @i{Amd}.
6019
6020@node FSinfo Command Line Options, FSinfo errors, FSinfo automount definitions, FSinfo
6021@comment  node-name,  next,  previous,  up
6022@section @i{FSinfo} Command Line Options
6023@cindex FSinfo command line options
6024@cindex Command line options, FSinfo
6025
6026@i{FSinfo} is started from the command line by using the command:
6027
6028@example
6029fsinfo [@i{options}] @i{files} ...
6030@end example
6031
6032The input to @i{FSinfo} is a single set of definitions of machines and
6033automount maps.  If multiple files are given on the command-line, then
6034the files are concatenated together to form the input source.  The files
6035are passed individually through the C pre-processor before being parsed.
6036
6037Several options define a prefix for the name of an output file.  If the
6038prefix is not specified no output of that type is produced.  The suffix
6039used will correspond either to the hostname to which a file belongs, or
6040to the type of output if only one file is produced.  Dumpsets and the
6041@file{bootparams} file are in the latter class.  To put the output into
6042a subdirectory simply put a @file{/} at the end of the prefix, making
6043sure that the directory has already been made before running
6044@i{Fsinfo}.
6045
6046@menu
6047* -a FSinfo Option::    Amd automount directory:
6048* -b FSinfo Option::    Prefix for bootparams files.
6049* -d FSinfo Option::    Prefix for dumpset data files.
6050* -e FSinfo Option::    Prefix for exports files.
6051* -f FSinfo Option::    Prefix for fstab files.
6052* -h FSinfo Option::    Local hostname.
6053* -m FSinfo Option::    Prefix for automount maps.
6054* -q FSinfo Option::    Ultra quiet mode.
6055* -v FSinfo Option::    Verbose mode.
6056* -I FSinfo Option::    Define new #include directory.
6057* -D-FSinfo Option::    Define macro.
6058* -U FSinfo Option::    Undefine macro.
6059@end menu
6060
6061@node -a FSinfo Option, -b FSinfo Option, FSinfo Command Line Options, FSinfo Command Line Options
6062@comment  node-name,  next,  previous,  up
6063@subsection @code{-a} @var{autodir}
6064
6065Specifies the directory name in which to place the automounter's
6066mountpoints.  This defaults to @file{/a}.  Some sites have the autodir set
6067to be @file{/amd}, and this would be achieved by:
6068
6069@example
6070fsinfo -a /amd ...
6071@end example
6072
6073@node -b FSinfo Option, -d FSinfo Option, -a FSinfo Option, FSinfo Command Line Options
6074@comment  node-name,  next,  previous,  up
6075@subsection @code{-b} @var{bootparams}
6076@cindex bootparams, FSinfo prefix
6077
6078This specifies the prefix for the @file{bootparams} filename.  If it is
6079not given, then the file will not be generated.  The @file{bootparams}
6080file will be constructed for the destination machine and will be placed
6081into a file named @file{bootparams} and prefixed by this string.  The
6082file generated contains a list of entries describing each diskless
6083client that can boot from the destination machine.
6084
6085As an example, to create a @file{bootparams} file in the directory
6086@file{generic}, the following would be used:
6087
6088@example
6089fsinfo -b generic/ ...
6090@end example
6091
6092@node -d FSinfo Option, -e FSinfo Option, -b FSinfo Option, FSinfo Command Line Options
6093@comment  node-name,  next,  previous,  up
6094@subsection @code{-d} @var{dumpsets}
6095@cindex dumpset, FSinfo prefix
6096
6097This specifies the prefix for the @file{dumpsets} file.  If it is not
6098specified, then the file will not be generated.  The file will be for
6099the destination machine and will be placed into a filename
6100@file{dumpsets}, prefixed by this string.  The @file{dumpsets} file is
6101for use by Imperial College's local backup system.
6102
6103For example, to create a @file{dumpsets} file in the directory @file{generic},
6104then you would use the following:
6105
6106@example
6107fsinfo -d generic/ ...
6108@end example
6109
6110@node -e FSinfo Option, -f FSinfo Option, -d FSinfo Option, FSinfo Command Line Options
6111@comment  node-name,  next,  previous,  up
6112@subsection @code{-e} @var{exportfs}
6113@cindex exports, FSinfo prefix
6114
6115Defines the prefix for the @file{exports} files.  If it is not given,
6116then the file will not be generated.  For each machine defined in the
6117configuration files as having disks, an @file{exports} file is
6118constructed and given a filename determined by the name of the machine,
6119prefixed with this string.  If a machine is defined as diskless, then no
6120@file{exports} file will be created for it.  The files contain entries
6121for directories on the machine that may be exported to clients.
6122
6123Example: To create the @file{exports} files for each diskfull machine
6124and place them into the directory @file{exports}:
6125
6126@example
6127fsinfo -e exports/ ...
6128@end example
6129
6130@node -f FSinfo Option, -h FSinfo Option, -e FSinfo Option, FSinfo Command Line Options
6131@comment  node-name,  next,  previous,  up
6132@subsection @code{-f} @var{fstab}
6133@cindex fstab, FSinfo prefix
6134
6135This defines the prefix for the @file{fstab} files.  The files will only
6136be created if this prefix is defined.  For each machine defined in the
6137configuration files, a @file{fstab} file is created with the filename
6138determined by prefixing this string with the name of the machine.  These
6139files contain entries for filesystems and partitions to mount at boot
6140time.
6141
6142Example, to create the files in the directory @file{fstabs}:
6143
6144@example
6145fsinfo -f fstabs/ ...
6146@end example
6147
6148@node -h FSinfo Option, -m FSinfo Option, -f FSinfo Option, FSinfo Command Line Options
6149@comment  node-name,  next,  previous,  up
6150@subsection @code{-h} @var{hostname}
6151@cindex hostname, FSinfo command line option
6152
6153Defines the hostname of the destination machine to process for.  If this
6154is not specified, it defaults to the local machine name, as returned by
6155@b{gethostname}(2).
6156
6157Example:
6158
6159@example
6160fsinfo -h dylan.doc.ic.ac.uk ...
6161@end example
6162
6163@node -m FSinfo Option, -q FSinfo Option, -h FSinfo Option, FSinfo Command Line Options
6164@comment  node-name,  next,  previous,  up
6165@subsection @code{-m} @var{mount-maps}
6166@cindex maps, FSinfo command line option
6167
6168Defines the prefix for the automounter files.  The maps will only be
6169produced if this prefix is defined.  The mount maps suitable for the
6170network defined by the configuration files will be placed into files
6171with names calculated by prefixing this string to the name of each map.
6172
6173For example, to create the automounter maps and place them in the
6174directory @file{automaps}:
6175
6176@example
6177fsinfo -m automaps/ ...
6178@end example
6179
6180@node -q FSinfo Option, -v FSinfo Option, -m FSinfo Option, FSinfo Command Line Options
6181@comment  node-name,  next,  previous,  up
6182@subsection @code{-q}
6183@cindex quiet, FSinfo command line option
6184
6185Selects quiet mode.  @i{FSinfo} suppress the ``running commentary'' and
6186only outputs any error messages which are generated.
6187
6188@node -v FSinfo Option, -D-FSinfo Option, -q FSinfo Option, FSinfo Command Line Options
6189@comment  node-name,  next,  previous,  up
6190@subsection @code{-v}
6191@cindex verbose, FSinfo command line option
6192
6193Selects verbose mode.  When this is activated, the program will display
6194more messages, and display all the information discovered when
6195performing the semantic analysis phase.  Each verbose message is output
6196to @file{stdout} on a line starting with a @samp{#} character.
6197
6198@node -D-FSinfo Option, -I FSinfo Option, -v FSinfo Option, FSinfo Command Line Options
6199@comment  node-name,  next,  previous,  up
6200@subsection @code{-D} @var{name[=defn]}
6201
6202Defines a symbol @dfn{name} for the preprocessor when reading the
6203configuration files.  Equivalent to @code{#define} directive.
6204
6205@node -I FSinfo Option, -U FSinfo Option, -D-FSinfo Option, FSinfo Command Line Options
6206@comment  node-name,  next,  previous,  up
6207@subsection @code{-I} @var{directory}
6208
6209This option is passed into the preprocessor for the configuration files.
6210It specifies directories in which to find include files
6211
6212@node -U FSinfo Option, , -I FSinfo Option, FSinfo Command Line Options
6213@comment  node-name,  next,  previous,  up
6214@subsection @code{-U} @var{name}
6215
6216Removes any initial definition of the symbol @dfn{name}.  Inverse of the
6217@code{-D} option.
6218
6219@node FSinfo errors, , FSinfo Command Line Options, FSinfo
6220@comment  node-name,  next,  previous,  up
6221@section Errors produced by @i{FSinfo}
6222@cindex FSinfo error messages
6223
6224The following table documents the errors and warnings which @i{FSinfo} may produce.
6225
6226@table @t
6227
6228@item " expected
6229Occurs if an unescaped newline is found in a quoted string.
6230
6231@item ambiguous mount: @var{volume} is a replicated filesystem
6232If several filesystems are declared as having the same volume name, they
6233will be considered replicated filesystems.  To mount a replicated
6234filesystem statically, a specific host will need to be named, to say
6235which particular copy to try and mount, else this error will
6236result.
6237
6238@item can't open @var{filename} for writing
6239Occurs if any errors are encountered when opening an output file.
6240
6241@item cannot determine localname since volname @var{volume} is not uniquely defined
6242If a volume is replicated and an attempt is made to mount the filesystem
6243statically without specifying a local mountpoint, @i{FSinfo} cannot
6244calculate a mountpoint, as the desired pathname would be
6245ambiguous.
6246
6247@item @var{device} has duplicate exportfs data
6248Produced if the @samp{exportfs} option is used multiple times within the
6249same branch of a filesystem definition. For example, if you attempt to
6250set the @samp{exportfs} data at different levels of the mountpoint
6251directory tree.
6252
6253@item dump frequency for @var{host}:@var{device} is non-zero
6254Occurs if @var{device} has its @samp{fstype} declared to be @samp{swap}
6255or @samp{export} and the @samp{dump} option is set to a value greater
6256than zero.  Swap devices should not be dumped.
6257
6258@item duplicate host @var{hostname}!
6259If a host has more than one definition.
6260
6261@item end of file within comment
6262A comment was unterminated before the end of one of the configuration
6263files.
6264
6265@item @var{filename}: cannot open for reading
6266If a file specified on the command line as containing configuration data
6267could not be opened.
6268
6269@item @var{filesystem} has a volname but no exportfs data
6270Occurs when a volume name is declared for a file system, but the string
6271specifying what machines the filesystem can be exported to is
6272missing.
6273
6274@item fs field "@var{field-name}" already set
6275Occurs when multiple definitions are given for one of the attributes of a
6276host's filesystem.
6277
6278@item host field "@var{field-name}" already set
6279If duplicate definitions are given for any of the fields with a host
6280definition.
6281
6282@item @var{host}:@var{device} has more than one mount point
6283Occurs if the mount option for a host's filesystem specifies multiple
6284trees at which to place the mountpoint.
6285
6286@item @var{host}:@var{device} has no mount point
6287Occurs if the @samp{mount} option is not specified for a host's
6288filesystem.
6289
6290@item @var{host}:@var{device} needs field "@var{field-name}"
6291Occurs when a filesystem is missing a required field. @var{field-name} could
6292be one of @samp{fstype}, @samp{opts}, @samp{passno} or
6293@samp{mount}.
6294
6295@item @var{host}:mount field specified for swap partition
6296Occurs if a mountpoint is given for a filesystem whose type is declared
6297to be @samp{swap}.
6298
6299@item malformed IP dotted quad: @var{address}
6300If the Internet address of an interface is incorrectly specified.  An
6301Internet address definition is handled to @b{inet_addr}(3N) to see if it
6302can cope.  If not, then this message will be displayed.
6303
6304@item malformed netmask: @var{netmask}
6305If the netmask cannot be decoded as though it were a hexadecimal number,
6306then this message will be displayed.  It will typically be caused by
6307incorrect characters in the @var{netmask} value.
6308
6309@item mount field "@var{field-name}" already set
6310Occurs when a static mount has multiple definitions of the same field.
6311
6312@item mount tree field "@var{field-name}" already set
6313Occurs when the @var{field-name} is defined more than once during the
6314definition of a filesystems mountpoint.
6315
6316@item netif field @var{field-name} already set
6317Occurs if you attempt to define an attribute of an interface more than
6318once.
6319
6320@item network booting requires both root and swap areas
6321Occurs if a machine has mount declarations for either the root partition
6322or the swap area, but not both.  You cannot define a machine to only
6323partially boot via the network.
6324
6325@item no disk mounts on @var{hostname}
6326If there are no static mounts, nor local disk mounts specified for a
6327machine, this message will be displayed.
6328
6329@item no volname given for @var{host}:@var{device}
6330Occurs when a filesystem is defined to be mounted on @file{default}, but
6331no volume name is given for the file system, then the mountpoint cannot
6332be determined.
6333
6334@item not allowed '/' in a directory name
6335Occurs when a pathname with multiple directory elements is specified as
6336the name for an automounter tree.  A tree should only have one name at
6337each level.
6338
6339@item pass number for @var{host}:@var{device} is non-zero
6340Occurs if @var{device} has its @samp{fstype} declared to be @samp{swap}
6341or @samp{export} and the @b{fsck}(8) pass number is set. Swap devices should not be
6342fsck'd.  @xref{FSinfo filesystems fstype}.
6343
6344@item sub-directory @var{directory} of @var{directory-tree} starts with '/'
6345Within the filesystem specification for a host, if an element
6346@var{directory} of the mountpoint begins with a @samp{/} and it is not
6347the start of the tree.
6348
6349@item sub-directory of @var{directory-tree} is named "default"
6350@samp{default} is a keyword used to specify if a mountpoint should be
6351automatically calculated by @i{FSinfo}.  If you attempt to specify a
6352directory name as this, it will use the filename of @file{default} but
6353will produce this warning.
6354
6355@item unknown \ sequence
6356Occurs if an unknown escape sequence is found inside a string.  Within a
6357string, you can give the standard C escape sequences for strings, such
6358as newlines and tab characters.
6359
6360@item unknown directory attribute
6361If an unknown keyword is found while reading the definition of a host's
6362filesystem mount option.
6363
6364@item unknown filesystem attribute
6365Occurs if an unrecognized keyword is used when defining a host's
6366filesystems.
6367
6368@item unknown host attribute
6369Occurs if an unrecognized keyword is used when defining a host.
6370
6371@item unknown mount attribute
6372Occurs if an unrecognized keyword is found while parsing the list of
6373static mounts.
6374
6375@item unknown volname @var{volume} automounted @i{[} on @i{name} @i{]}
6376Occurs if @var{volume} is used in a definition of an automount map but the volume
6377name has not been declared during the host filesystem definitions.
6378
6379@item volname @var{volume} is unknown
6380Occurs if an attempt is made to mount or reference a volume name which
6381has not been declared during the host filesystem definitions.
6382
6383@item volname @var{volume} not exported from @var{machine}
6384Occurs if you attempt to mount the volume @var{volume} from a machine
6385which has not declared itself to have such a filesystem
6386available.
6387
6388@end table
6389
6390@c ################################################################
6391@node Hlfsd, Assorted Tools, FSinfo, Top
6392@comment  node-name,  next,  previous,  up
6393@chapter Hlfsd
6394@pindex Hlfsd
6395@cindex Home-Link Filesystem
6396
6397@i{Hlfsd} is a daemon which implements a filesystem containing a
6398symbolic link to subdirectory within a user's home directory, depending
6399on the user which accessed that link.  It was primarily designed to
6400redirect incoming mail to users' home directories, so that it can be read
6401from anywhere.  It was designed and implemented by
6402@email{ezk@@cs.columbia.edu,Erez Zadok} and
6403@email{dupuy@@cs.columbia.edu,Alexander Dupuy}, at the
6404@uref{http://www.cs.columbia.edu/,Computer Science Department} of
6405@uref{http://www.columbia.edu/,Columbia University}.  A
6406@uref{http://www.cs.columbia.edu/~ezk/research/hlfsd/hlfsd.html,paper}
6407on @i{Hlfsd} was presented at the Usenix LISA VII conference in 1993.
6408
6409@i{Hlfsd} operates by mounting itself as an NFS server for the directory
6410containing @i{linkname}, which defaults to @file{/hlfs/home}.  Lookups
6411within that directory are handled by @i{Hlfsd}, which uses the
6412password map to determine how to resolve the lookup.  The directory will
6413be created if it doesn't already exist.  The symbolic link will be to
6414the accessing user's home directory, with @i{subdir} appended to it.  If
6415not specified, @i{subdir} defaults to @file{.hlfsdir}.  This directory
6416will also be created if it does not already exist.
6417
6418A @samp{SIGTERM} sent to @i{Hlfsd} will cause it to shutdown.  A
6419@samp{SIGHUP} will flush the internal caches, and reload the password
6420map.  It will also close and reopen the log file, to enable the original
6421log file to be removed or rotated.  A @samp{SIGUSR1} will cause it to
6422dump its internal table of user IDs and home directories to the file
6423@file{/tmp/hlfsddump}.
6424
6425@menu
6426* Introduction to Hlfsd::
6427* Background to Mail Delivery::        
6428* Using Hlfsd::       
6429@end menu
6430
6431@c ================================================================
6432@node Introduction to Hlfsd, Background to Mail Delivery, Hlfsd, Hlfsd
6433@comment  node-name,  next,  previous,  up
6434@section Introduction to Hlfsd
6435@cindex Introduction to Hlfsd
6436@cindex Hlfsd; introduction
6437
6438Electronic mail has become one of the major applications for many
6439computer networks, and use of this service is expected to increase over
6440time, as networks proliferate and become faster.  Providing a convenient
6441environment for users to read, compose, and send electronic mail has
6442become a requirement for systems administrators (SAs).
6443
6444Widely used methods for handling mail usually require users to be logged
6445into a designated ``home'' machine, where their mailbox files reside.
6446Only on that one machine can they read newly arrived mail.  Since users
6447have to be logged into that system to read their mail, they often find
6448it convenient to run all of their other processes on that system as
6449well, including memory and CPU-intensive jobs.  For example, in our
6450department, we have allocated and configured several multi-processor
6451servers to handle such demanding CPU/memory applications, but these were
6452underutilized, in large part due to the inconvenience of not being able
6453to read mail on those machines.  (No home directories were located on
6454these designated CPU-servers, since we did not want NFS service for
6455users' home directories to have to compete with CPU-intensive jobs.  At the
6456same time, we discouraged users from running demanding applications on
6457their home machines.)
6458
6459Many different solutions have been proposed to allow users to read their
6460mail on any host.  However, all of these solutions fail in one or more
6461of several ways:
6462
6463@itemize @bullet
6464
6465@item
6466they introduce new single points of failure
6467
6468@item
6469they require using different mail transfer agents (MTAs) or user agents
6470(UAs)
6471
6472@item
6473they do not solve the problem for all cases, i.e.  the solution is only
6474partially successful for a particular environment.
6475
6476@end itemize
6477
6478We have designed a simple filesystem, called the @dfn{Home-Link File
6479System}, to provide the ability to deliver mail to users' home
6480directories, without modification to mail-related applications. We have
6481endeavored to make it as stable as possible.  Of great importance to us
6482was to make sure the HLFS daemon, @file{hlfsd} , would not hang under
6483any circumstances, and would take the next-best action when faced with
6484problems.  Compared to alternative methods, @i{Hlfsd} is a stable, more
6485general solution, and easier to install/use.  In fact, in some ways, we
6486have even managed to improve the reliability and security of mail
6487service.
6488
6489Our server implements a small filesystem containing a symbolic link
6490to a subdirectory of the invoking user's home directory, and named symbolic
6491links to users' mailbox files.
6492
6493The @i{Hlfsd} server finds out the @var{uid} of the process that is
6494accessing its mount point, and resolves the pathname component @samp{home} as a
6495symbolic link to a subdirectory within the home directory given by the
6496@var{uid}'s entry in the password file.  If the @var{gid} of the process
6497that attempts to access a mailbox file is a special one (called
6498HLFS_GID), then the server maps the name of the @emph{next} pathname
6499component directly to the user's mailbox.  This is necessary so that
6500access to a mailbox file by users other than the owner can succeed.  The
6501server has safety features in case of failures such as hung filesystems
6502or home directory filesystems that are inaccessible or full.
6503
6504On most of our machines, mail gets delivered to the directory
6505@file{/var/spool/mail}. Many programs, including UAs, depend on that
6506path.  @i{Hlfsd} creates a directory @file{/mail}, and mounts itself on
6507top of that directory.  @i{Hlfsd} implements the path name component
6508called @samp{home}, pointing to a subdirectory of the user's home directory.
6509We have made @file{/var/spool/mail} a symbolic link to
6510@file{/mail/home}, so that accessing @file{/var/spool/mail} actually
6511causes access to a subdirectory within a user's home directory.
6512
6513The following table shows an example of how resolving the pathname
6514@file{/var/mail/@i{NAME}} to @file{/users/ezk/.mailspool/@i{NAME}} proceeds.
6515
6516@multitable {Resolving Component} {Pathname left to resolve} {Value if symbolic link}
6517
6518@item @b{Resolving Component}
6519@tab @b{Pathname left to resolve}
6520@tab @b{Value if symbolic link}
6521
6522@item @t{/}
6523@tab @t{var/mail/}@i{NAME}
6524
6525@item @t{var/}
6526@tab @t{mail/}@i{NAME}
6527
6528@item @t{mail}@@
6529@tab @t{/mail/home/}@i{NAME}
6530@tab @t{mail}@@ -> @t{/mail/home}
6531
6532@item @t{/}
6533@tab @t{mail/home/}@i{NAME}
6534
6535@item @t{mail/}
6536@tab @t{home/}@i{NAME}
6537
6538@item @t{home}@@
6539@tab @i{NAME}
6540@tab @t{home}@@ -> @t{/users/ezk/.mailspool}
6541
6542@item @t{/}
6543@tab @t{users/ezk/.mailspool/}@i{NAME}
6544
6545@item @t{users/}
6546@tab @t{ezk/.mailspool/}@i{NAME}
6547
6548@item @t{ezk/}
6549@tab @t{.mailspool/}@i{NAME}
6550
6551@item @t{.mailspool/}
6552@tab @i{NAME}
6553
6554@item @i{NAME}
6555
6556@end multitable
6557
6558@c ================================================================
6559@node Background to Mail Delivery, Using Hlfsd, Introduction to Hlfsd, Hlfsd
6560@comment  node-name,  next,  previous,  up
6561@section Background to Mail Delivery
6562@cindex Background to Mail Delivery
6563@cindex Hlfsd; background
6564
6565This section provides an in-depth discussion of why available methods
6566for delivering mail to home directories are not as good as the one used
6567by @i{Hlfsd}.
6568
6569@menu
6570* Single-Host Mail Spool Directory::
6571* Centralized Mail Spool Directory::
6572* Distributed Mail Spool Service::
6573* Why Deliver Into the Home Directory?::
6574@end menu
6575
6576@c ----------------------------------------------------------------
6577@node Single-Host Mail Spool Directory, Centralized Mail Spool Directory, Background to Mail Delivery, Background to Mail Delivery
6578@comment  node-name,  next,  previous,  up
6579@subsection Single-Host Mail Spool Directory
6580@cindex Single-Host Mail Spool Directory
6581
6582The most common method for mail delivery is for mail to be appended to a
6583mailbox file in a standard spool directory on the designated ``mail
6584home'' machine of the user. The greatest advantage of this method is
6585that it is the default method most vendors provide with their systems,
6586thus very little (if any) configuration is required on the SA's part.
6587All they need to set up are mail aliases directing mail to the host on
6588which the user's mailbox file is assigned.  (Otherwise, mail is
6589delivered locally, and users find mailboxes on many machines.)
6590
6591As users become more sophisticated, and aided by windowing systems, they
6592find themselves logging in on multiple hosts at once, performing several
6593tasks concurrently.  They ask to be able to read their mail on any host
6594on the network, not just the one designated as their ``mail home''.
6595
6596@c ----------------------------------------------------------------
6597@node Centralized Mail Spool Directory, Distributed Mail Spool Service, Single-Host Mail Spool Directory, Background to Mail Delivery
6598@comment  node-name,  next,  previous,  up
6599@subsection Centralized Mail Spool Directory
6600@cindex Centralized Mail Spool Directory
6601
6602A popular method for providing mail readability from any host is to have
6603all mail delivered to a mail spool directory on a designated
6604``mail-server'' which is exported via NFS to all of the hosts on the
6605network.  Configuring such a system is relatively easy.  On most
6606systems, the bulk of the work is a one-time addition to one or two
6607configuration files in @file{/etc}.  The file-server's spool directory
6608is then hard-mounted across every machine on the local network.  In
6609small environments with only a handful of hosts this can be an
6610acceptable solution.  In our department, with a couple of hundred active
6611hosts and thousands of mail messages processed daily, this was deemed
6612completely unacceptable, as it introduced several types of problems:
6613
6614@table @b
6615
6616@item Scalability and Performance
6617
6618As more and more machines get added to the network, more mail traffic
6619has to go over NFS to and from the mail-server. Users like to run
6620mail-watchers, and read their mail often. The stress on the shared
6621infrastructure increases with every user and host added; loads on the
6622mail server would most certainly be high since all mail delivery goes
6623through that one machine.@footnote{ Delivery via NFS-mounted filesystems
6624may require usage of @samp{rpc.lockd} and @samp{rpc.statd} to provide
6625distributed file-locking, both of which are widely regarded as unstable
6626and unreliable.  Furthermore, this will degrade performance, as local
6627processes as well as remote @samp{nfsd} processes are kept busy.}  This
6628leads to lower reliability and performance.  To reduce the number of
6629concurrent connections between clients and the server host, some SAs
6630have resorted to automounting the mail-spool directory.  But this
6631solution only makes things worse: since users often run mail watchers,
6632and many popular applications such as @samp{trn}, @samp{emacs},
6633@samp{csh} or @samp{ksh} check periodically for new mail, the
6634automounted directory would be effectively permanently mounted.  If it
6635gets unmounted automatically by the automounter program, it is most
6636likely to get mounted shortly afterwards, consuming more I/O resources
6637by the constant cycle of mount and umount calls.
6638
6639@item Reliability
6640
6641The mail-server host and its network connectivity must be very reliable.
6642Worse, since the spool directory has to be hard-mounted,@footnote{No SA
6643in their right minds would soft-mount read/write partitions --- the
6644chances for data loss are too great.} many processes which access the
6645spool directory (various shells, @samp{login}, @samp{emacs}, etc.)
6646would be hung as long as connectivity to the mail-server is severed. To
6647improve reliability, SAs may choose to backup the mail-server's spool
6648partition several times a day.  This may make things worse since reading
6649or delivering mail while backups are in progress may cause backups to be
6650inconsistent; more backups consume more backup-media resources, and
6651increase the load on the mail-server host.
6652
6653@end table
6654
6655@c ----------------------------------------------------------------
6656@node Distributed Mail Spool Service, Why Deliver Into the Home Directory?, Centralized Mail Spool Directory, Background to Mail Delivery
6657@comment  node-name,  next,  previous,  up
6658@subsection Distributed Mail Spool Service
6659@cindex Distributed Mail Spool Service
6660
6661Despite the existence of a few systems that support delivery to users'
6662home directories, mail delivery to home directories hasn't caught on.
6663We believe the main reason is that there are too many programs that
6664``know'' where mailbox files reside.  Besides the obvious (the delivery
6665program @file{/bin/mail} and mail readers like @file{/usr/ucb/Mail},
6666@samp{mush}, @samp{mm}, etc.), other programs that know mailbox location
6667are login, from, almost every shell, @samp{xbiff}, @samp{xmailbox}, and
6668even some programs not directly related to mail, such as @samp{emacs}
6669and @samp{trn}.  Although some of these programs can be configured to
6670look in different directories with the use of environment variables and
6671other resources, many of them cannot.  The overall porting work is
6672significant.
6673
6674Other methods that have yet to catch on require the use of a special
6675mail-reading server, such as IMAP or POP.  The main disadvantage of
6676these systems is that UAs need to be modified to use these services ---
6677a long and involved task.  That is why they are not popular at this
6678time.
6679
6680Several other ideas have been proposed and even used in various
6681environments.  None of them is robust.  They are mostly very
6682specialized, inflexible, and do not extend to the general case.  Some of
6683the ideas are plain bad, potentially leading to lost or corrupt mail:
6684
6685@table @b
6686
6687@item automounters
6688
6689Using an automounter such as @i{Amd} to provide a set of symbolic links
6690from the normal spool directory to user home directories is not
6691sufficient.  UAs rename, unlink, and recreate the mailbox as a regular
6692file, therefore it must be a real file, not a symbolic link.
6693Furthermore, it must reside in a real directory which is writable by the
6694UAs and MTAs.  This method may also require populating
6695@file{/var/spool/mail} with symbolic links and making sure they are
6696updated.  Making @i{Amd} manage that directory directly fails, since
6697many various lock files need to be managed as well.  Also, @i{Amd} does
6698not provide all of the NFS operations which are required to write mail
6699such as write, create, remove, and unlink.
6700
6701@item @code{$MAIL}
6702
6703Setting this variable to an automounted directory pointing to the user's
6704mail spool host only solves the problem for those programs which know
6705and use @code{$MAIL}.  Many programs don't, therefore this solution is partial
6706and of limited flexibility.  Also, it requires the SAs or the users to
6707set it themselves --- an added level of inconvenience and possible
6708failures.
6709
6710@item @t{/bin/mail}
6711
6712Using a different mail delivery agent could be the solution.  One such
6713example is @samp{hdmail}.  However, @samp{hdmail} still requires
6714modifying all UAs, the MTA's configuration, installing new daemons, and
6715changing login scripts.  This makes the system less upgradable or
6716compatible with others, and adds one more complicated system for SAs to
6717deal with.  It is not a complete solution because it still requires each
6718user have their @code{$MAIL} variable setup correctly, and that every program
6719use this variable.
6720
6721@end table
6722
6723@c ----------------------------------------------------------------
6724@node Why Deliver Into the Home Directory?, , Distributed Mail Spool Service, Background to Mail Delivery
6725@comment  node-name,  next,  previous,  up
6726@subsection Why Deliver Into the Home Directory?
6727@cindex Why Deliver Into the Home Directory?
6728@cindex Hlfsd; Why Deliver Into the Home Directory?
6729
6730There are several major reasons why SAs might want to deliver mail
6731directly into the users' home directories:
6732
6733@table @b
6734
6735@item Location
6736
6737Many mail readers need to move mail from the spool directory to the
6738user's home directory.  It speeds up this operation if the two are on
6739the same filesystem.  If for some reason the user's home directory is
6740inaccessible, it isn't that useful to be able to read mail, since there
6741is no place to move it to.  In some cases, trying to move mail to a
6742non-existent or hung filesystem may result in mail loss.
6743
6744@item Distribution
6745
6746Having all mail spool directories spread among the many more filesystems
6747minimizes the chances that complete environments will grind to a halt
6748when a single server is down.  It does increase the chance that there
6749will be someone who is not able to read their mail when a machine is
6750down, but that is usually preferred to having no one be able to read
6751their mail because a centralized mail server is down.  The problem of
6752losing some mail due to the (presumably) higher chances that a user's
6753machine is down is minimized in HLFS.
6754
6755@item Security
6756
6757Delivering mail to users' home directories has another advantage ---
6758enhanced security and privacy.  Since a shared system mail spool
6759directory has to be world-readable and searchable, any user can see
6760whether other users have mail, when they last received new mail, or when
6761they last read their mail.  Programs such as @samp{finger} display this
6762information, which some consider an infringement of privacy.  While it
6763is possible to disable this feature of @samp{finger} so that remote
6764users cannot see a mailbox file's status, this doesn't prevent local
6765users from getting the information.  Furthermore, there are more
6766programs which make use of this information.  In shared environments,
6767disabling such programs has to be done on a system-wide basis, but with
6768mail delivered to users' home directories, users less concerned with
6769privacy who do want to let others know when they last received or read
6770mail can easily do so using file protection bits.
6771
6772@c Lastly, on systems that do not export their NFS filesystem with
6773@c @t{anon=0}, superusers are less likely to snoop around others' mail, as
6774@c they become ``nobodies'' across NFS.
6775
6776@end table
6777
6778In summary, delivering mail to home directories provides users the
6779functionality sought, and also avoids most of the problems just
6780discussed.
6781
6782@c ================================================================
6783@node Using Hlfsd, , Background to Mail Delivery, Hlfsd
6784@comment  node-name,  next,  previous,  up
6785@section Using Hlfsd
6786@cindex Using Hlfsd
6787@cindex Hlfsd; using
6788
6789@menu
6790* Controlling Hlfsd:: 
6791* Hlfsd Options::     
6792* Hlfsd Files::       
6793@end menu
6794
6795@c ----------------------------------------------------------------
6796@node Controlling Hlfsd, Hlfsd Options, Using Hlfsd, Using Hlfsd
6797@comment  node-name,  next,  previous,  up
6798@subsection Controlling Hlfsd
6799@cindex Controlling Hlfsd
6800@cindex Hlfsd; controlling
6801@pindex ctl-hlfsd
6802
6803Much the same way @i{Amd} is controlled by @file{ctl-amd}, so does
6804@i{Hlfsd} get controlled by the @file{ctl-hlfsd} script:
6805
6806@table @t
6807
6808@item ctl-hlfsd start
6809Start a new @i{Hlfsd}.
6810
6811@item ctl-hlfsd stop
6812Stop a running @i{Hlfsd}.
6813
6814@item ctl-hlfsd restart
6815Stop a running @i{Hlfsd}, wait for 10 seconds, and then start a new
6816one.  It is hoped that within 10 seconds, the previously running
6817@i{Hlfsd} terminate properly; otherwise, starting a second one could
6818cause system lockup.
6819
6820@end table
6821
6822For example, on our systems, we start @i{Hlfsd} within @file{ctl-hlfsd}
6823as follows on Solaris 2 systems:
6824
6825@example
6826hlfsd -a /var/alt_mail -x all -l /var/log/hlfsd /mail/home .mailspool
6827@end example
6828
6829The directory @file{/var/alt_mail} is a directory in the root partition
6830where alternate mail will be delivered into, when it cannot be delivered
6831into the user's home directory.
6832
6833Normal mail gets delivered into @file{/var/mail}, but on our systems,
6834that is a symbolic link to @file{/mail/home}.  @file{/mail} is managed
6835by @i{Hlfsd}, which creates a dynamic symlink named @samp{home},
6836pointing to the subdirectory @file{.mailspool} @emph{within} the
6837accessing user's home directory.  This results in mail which normally
6838should go to @file{/var/mail/@code{$USER}}, to go to
6839@file{@code{$HOME}/.mailspool/@code{$USER}}.
6840
6841@i{Hlfsd} does not create the @file{/var/mail} symlink.  This needs to
6842be created (manually) once on each host, by the system administrators,
6843as follows:
6844
6845@example
6846mv /var/mail /var/alt_mail
6847ln -s /mail/home /var/mail
6848@end example
6849
6850@c ----------------------------------------------------------------
6851@node Hlfsd Options, Hlfsd Files, Controlling Hlfsd, Using Hlfsd
6852@comment  node-name,  next,  previous,  up
6853@subsection Hlfsd Options
6854@cindex Hlfsd Options
6855@cindex Hlfsd; Options
6856
6857@table @t
6858
6859@item -a @var{alt_dir}
6860Alternate directory.  The name of the directory to which the symbolic
6861link returned by @i{Hlfsd} will point, if it cannot access the home
6862directory of the user.  This defaults to @file{/var/hlfs}.  This
6863directory will be created if it doesn't exist.  It is expected that
6864either users will read these files, or the system administrators will
6865run a script to resend this ``lost mail'' to its owner.
6866
6867@item -c @var{cache-interval}
6868Caching interval.  @i{Hlfsd} will cache the validity of home directories
6869for this interval, in seconds.  Entries which have been verified within
6870the last @var{cache-interval} seconds will not be verified again, since
6871the operation could be expensive, and the entries are most likely still
6872valid.  After the interval has expired, @i{Hlfsd} will re-verify the
6873validity of the user's home directory, and reset the cache time-counter.
6874The default value for @var{cache-interval} is 300 seconds (5 minutes).
6875
6876@item -f
6877Force fast startup.  This option tells @i{Hlfsd} to skip startup-time
6878consistency checks such as existence of mount directory, alternate spool
6879directory, symlink to be hidden under the mount directory, their
6880permissions and validity.
6881
6882@item -g @var{group}
6883Set the special group HLFS_GID to @var{group}.  Programs such as
6884@file{/usr/ucb/from} or @file{/usr/sbin/in.comsat}, which access the
6885mailboxes of other users, must be setgid @samp{HLFS_GID} to work properly.  The
6886default group is @samp{hlfs}.  If no group is provided, and there is no
6887group @samp{hlfs}, this feature is disabled.
6888
6889@item -h
6890Help.  Print a brief help message, and exit.
6891
6892@item -i @var{reload-interval}
6893Map-reloading interval.  Each @var{reload-interval} seconds, @i{Hlfsd}
6894will reload the password map.  @i{Hlfsd} needs the password map for the
6895UIDs and home directory pathnames.  @i{Hlfsd} schedules a @samp{SIGALRM} to
6896reload the password maps.  A @samp{SIGHUP} sent to @i{Hlfsd} will force it to
6897reload the maps immediately.  The default value for
6898@var{reload-interval} is 900 seconds (15 minutes.)
6899
6900@item -l @var{logfile}
6901Specify a log file to which @i{Hlfsd} will record events.  If
6902@var{logfile} is the string @samp{syslog} then the log messages will be
6903sent to the system log daemon by @b{syslog}(3), using the @samp{LOG_DAEMON}
6904facility.  This is also the default.
6905
6906@item -n
6907No verify.  @i{Hlfsd} will not verify the validity of the symbolic link
6908it will be returning, or that the user's home directory contains
6909sufficient disk-space for spooling.  This can speed up @i{Hlfsd} at the
6910cost of possibly returning symbolic links to home directories which are
6911not currently accessible or are full.  By default, @i{Hlfsd} validates
6912the symbolic-link in the background.  The @code{-n} option overrides the
6913meaning of the @code{-c} option, since no caching is necessary.
6914
6915@item -o @var{mount-options}
6916Mount options which @i{Hlfsd} will use to mount itself on top of
6917@var{dirname}.  By default, @var{mount-options} is set to @samp{ro}.  If
6918the system supports symbolic-link caching, default options are set
6919to @samp{ro,nocache}.
6920
6921@item -p
6922Print PID.  Outputs the process-id of @i{Hlfsd} to standard output where
6923it can be saved into a file.
6924
6925@item -v
6926Version.  Displays version information to standard error.
6927
6928@item -x @var{log-options}
6929Specify run-time logging options.  The options are a comma separated
6930list chosen from: @samp{fatal}, @samp{error}, @samp{user}, @samp{warn}, @samp{info}, @samp{map}, @samp{stats}, @samp{all}.
6931
6932@item -C
6933Force @i{Hlfsd} to run on systems that cannot turn off the NFS
6934attribute-cache.  Use of this option on those systems is discouraged, as
6935it may result in loss or misdelivery of mail.  The option is ignored on
6936systems that can turn off the attribute-cache.
6937
6938@item -D @var{log-options}
6939Select from a variety of debugging options.  Prefixing an option with
6940the string @samp{no} reverses the effect of that option.  Options are
6941cumulative.  The most useful option is @samp{all}.  Since this option is
6942only used for debugging other options are not documented here.  A fuller
6943description is available in the program source.  A @samp{SIGUSR1} sent
6944to @i{Hlfsd} will cause it to dump its internal password map to the file
6945@file{/usr/tmp/hlfsd.dump.XXXXXX}, where @samp{XXXXXX} will be replaced
6946by a random string generated by @b{mktemp}(3) or (the more secure)
6947@b{mkstemp}(3).
6948
6949@item -P @var{password-file}
6950Read the user-name, user-id, and home directory information from the
6951file @var{password-file}.  Normally, @i{Hlfsd} will use @b{getpwent}(3)
6952to read the password database.  This option allows you to override the
6953default database, and is useful if you want to map users' mail files to
6954a directory other than their home directory.  Only the username, uid,
6955and home-directory fields of the file @var{password-file} are read and
6956checked.  All other fields are ignored.  The file @var{password-file}
6957must otherwise be compliant with Unix Version 7 colon-delimited format
6958@b{passwd}(4).
6959
6960@end table
6961
6962@c ----------------------------------------------------------------
6963@node Hlfsd Files, , Hlfsd Options, Using Hlfsd
6964@comment  node-name,  next,  previous,  up
6965@subsection Hlfsd Files
6966@cindex Hlfsd Files
6967@cindex Hlfsd; Files
6968
6969The following files are used by @i{Hlfsd}:
6970
6971@table @file
6972
6973@item /hlfs
6974directory under which @i{Hlfsd} mounts itself and manages the symbolic
6975link @file{home}.
6976
6977@item .hlfsdir
6978default sub-directory in the user's home directory, to which the
6979@file{home} symbolic link returned by @i{Hlfsd} points.
6980
6981@item /var/hlfs
6982directory to which @file{home} symbolic link returned by @i{Hlfsd}
6983points if it is unable to verify the that user's home directory is
6984accessible.
6985
6986@end table
6987
6988For discussion on other files used by @i{Hlfsd}, see @xref{lostaltmail}, and
6989@ref{lostaltmail.conf-sample}.
6990
6991@c ################################################################
6992@node Assorted Tools, Examples, Hlfsd, Top
6993@comment  node-name,  next,  previous,  up
6994@chapter Assorted Tools
6995@cindex  Assorted Tools
6996
6997The following are additional utilities and scripts included with
6998am-utils, and get installed.
6999
7000@menu
7001* am-eject::          
7002* amd.conf-sample::   
7003* amd2ldif::          
7004* amd2sun::           
7005* automount2amd::           
7006* ctl-amd::           
7007* ctl-hlfsd::         
7008* expn::              
7009* fix-amd-map::       
7010* fixmount::          
7011* fixrmtab::          
7012* lostaltmail::       
7013* lostaltmail.conf-sample::
7014* mk-amd-map::        
7015* pawd::              
7016* wait4amd::          
7017* wait4amd2die::      
7018* wire-test::         
7019@end menu
7020
7021@c ----------------------------------------------------------------
7022@node am-eject, amd.conf-sample, Assorted Tools, Assorted Tools
7023@comment  node-name,  next,  previous,  up
7024@section am-eject
7025@pindex am-eject
7026
7027A shell script unmounts a floppy or CD-ROM that is automounted, and
7028then attempts to eject the removable device.
7029
7030@c ----------------------------------------------------------------
7031@node amd.conf-sample, amd2ldif, am-eject, Assorted Tools
7032@comment  node-name,  next,  previous,  up
7033@section amd.conf-sample
7034@pindex amd.conf-sample
7035
7036A sample @i{Amd} configuration file. @xref{Amd Configuration File}. 
7037
7038@c ----------------------------------------------------------------
7039@node amd2ldif, amd2sun, amd.conf-sample, Assorted Tools
7040@comment  node-name,  next,  previous,  up
7041@section amd2ldif
7042@pindex amd2ldif
7043
7044A script to convert @i{Amd} maps to LDAP input files.  Use it as follows:
7045
7046@example
7047amd2ldif @i{mapname} @i{base} < @i{amd.mapfile} > @i{mapfile.ldif}
7048@end example
7049
7050@c ----------------------------------------------------------------
7051@node amd2sun, automount2amd, amd2ldif, Assorted Tools
7052@comment  node-name,  next,  previous,  up
7053@section amd2sun
7054@pindex amd2sun
7055
7056A script to convert @i{Amd} maps to Sun Automounter maps.  Use it as
7057follows
7058
7059@example
7060amd2sun < @i{amd.mapfile} > @i{auto_mapfile}
7061@end example
7062
7063@c ----------------------------------------------------------------
7064@node automount2amd, ctl-amd, amd2sun, Assorted Tools
7065@comment  node-name,  next,  previous,  up
7066@section automount2amd
7067@pindex automount2amd
7068
7069A script to convert old Sun Automounter maps to @i{Amd} maps.
7070
7071Say you have the Sun automount file @i{auto.foo}, with these two lines:
7072@example
7073home                  earth:/home
7074moon  -ro,intr        server:/proj/images
7075@end example
7076Running
7077@example
7078automount2amd auto.foo > amd.foo
7079@end example
7080
7081will produce the @i{Amd} map @i{amd.foo} with this content:
7082
7083@example
7084# generated by automount2amd on Sat Aug 14 17:59:32 US/Eastern 1999
7085
7086/defaults \\
7087  type:=nfs;opts:=rw,grpid,nosuid,utimeout=600
7088
7089home \
7090  host==earth;type:=link;fs:=/home \\
7091  rhost:=earth;rfs:=/home
7092
7093moon \
7094  -addopts:=ro,intr \\
7095  host==server;type:=link;fs:=/proj/images \\
7096  rhost:=server;rfs:=/proj/images
7097@end example
7098
7099This perl script will use the following @i{/default} entry
7100@example
7101type:=nfs;opts:=rw,grpid,nosuid,utimeout=600
7102@end example
7103If you wish to override that, define the @b{$DEFAULTS} environment
7104variable, or modify the script.
7105
7106If you wish to generate Amd maps using the @i{hostd} (@pxref{hostd
7107Selector Variable}) @i{Amd} map syntax, then define the environment
7108variable @b{$DOMAIN} or modify the script.
7109
7110Note that automount2amd does not understand newer Sun Automount map
7111syntax, those used by autofs.
7112
7113@c ----------------------------------------------------------------
7114@node ctl-amd, ctl-hlfsd, automount2amd, Assorted Tools
7115@comment  node-name,  next,  previous,  up
7116@section ctl-amd
7117@pindex ctl-amd
7118
7119A script to start, stop, or restart @i{Amd}.  Use it as follows:
7120
7121@table @t
7122@item ctl-amd start
7123Start a new @i{Amd} process.
7124@item ctl-amd stop
7125Stop the running @i{Amd}.
7126@item ctl-amd restart
7127Stop the running @i{Amd} (if any), safely wait for it to terminate, and
7128then start a new process --- only if the previous one died cleanly.
7129@end table
7130
7131@xref{Run-time Administration}, for more details.
7132
7133@c ----------------------------------------------------------------
7134@node ctl-hlfsd, expn, ctl-amd, Assorted Tools
7135@comment  node-name,  next,  previous,  up
7136@section ctl-hlfsd
7137@pindex ctl-hlfsd
7138
7139A script for controlling @i{Hlfsd}, much the same way @file{ctl-amd}
7140controls @i{Amd}.  Use it as follows:
7141
7142@table @t
7143@item ctl-hlfsd start
7144Start a new @i{Hlfsd} process.
7145@item ctl-hlfsd stop
7146Stop the running @i{Hlfsd}.
7147@item ctl-hlfsd restart
7148Stop the running @i{Hlfsd} (if any), wait for 10 seconds for it to
7149terminate, and then start a new process --- only if the previous one
7150died cleanly.
7151@end table
7152
7153@xref{Hlfsd}, for more details.
7154
7155@c ----------------------------------------------------------------
7156@node expn, fix-amd-map, ctl-hlfsd, Assorted Tools
7157@comment  node-name,  next,  previous,  up
7158@section expn
7159@pindex expn
7160
7161A script to expand email addresses into their full name.  It is
7162generally useful when using with the @file{lostaltmail} script, but is a
7163useful tools otherwise.
7164
7165@example
7166$ expn -v ezk@@cs.columbia.edu
7167ezk@@cs.columbia.edu ->
7168        ezk@@shekel.mcl.cs.columbia.edu
7169ezk@@shekel.mcl.cs.columbia.edu ->
7170        Erez Zadok <"| /usr/local/mh/lib/slocal -user ezk || exit 75>
7171        Erez Zadok <\ezk>
7172        Erez Zadok </u/zing/ezk/.mailspool/backup>
7173@end example
7174
7175@c ----------------------------------------------------------------
7176@node fix-amd-map, fixmount, expn, Assorted Tools
7177@comment  node-name,  next,  previous,  up
7178@section fix-amd-map
7179@pindex fix-amd-map
7180
7181Am-utils changed some of the syntax and default values of some
7182variables.  For example, the default value for @samp{$@{os@}} for
7183Solaris 2.x (aka SunOS 5.x) systems used to be @samp{sos5}, it is now
7184more automatically generated from @file{config.guess} and its value is
7185@samp{sunos5}.
7186
7187This script converts older @i{Amd} maps to new ones.  Use it as follows:
7188
7189@example
7190fix-amd-map < @i{old.map} > @i{new.map}
7191@end example
7192
7193@c ----------------------------------------------------------------
7194@node fixmount, fixrmtab, fix-amd-map, Assorted Tools
7195@comment  node-name,  next,  previous,  up
7196@section fixmount
7197@pindex fixmount
7198
7199@samp{fixmount} is a variant of @b{showmount}(8) that can delete bogus
7200mount entries in remote @b{mountd}(8) daemons.  This is useful to
7201cleanup otherwise ever-accumulating ``junk''.  Use it for example:
7202
7203@example
7204fixmount -r @i{host}
7205@end example
7206
7207See the online manual page for @samp{fixmount} for more details of its
7208usage.
7209
7210@c ----------------------------------------------------------------
7211@node fixrmtab, lostaltmail, fixmount, Assorted Tools
7212@comment  node-name,  next,  previous,  up
7213@section fixrmtab
7214@pindex fixrmtab
7215
7216A script to invalidate @file{/etc/rmtab} entries for hosts named.  Also
7217restart mountd for changes to take effect.  Use it for example:
7218
7219@example
7220fixrmtab @i{host1} @i{host2} @i{...}
7221@end example
7222
7223@c ----------------------------------------------------------------
7224@node lostaltmail, lostaltmail.conf-sample, fixrmtab, Assorted Tools
7225@comment  node-name,  next,  previous,  up
7226@section lostaltmail
7227@pindex lostaltmail
7228
7229A script used with @i{Hlfsd} to resend any ``lost'' mail.  @i{Hlfsd}
7230redirects mail which cannot be written into the user's home directory to
7231an alternate directory.  This is useful to continue delivering mail,
7232even if the user's file system was unavailable, full, or over quota.
7233But, the mail which gets delivered to  the alternate directory needs to
7234be resent to its respective users.  This is what the @samp{lostaltmail}
7235script does. 
7236
7237Use it as follows:
7238
7239@example
7240lostaltmail
7241@end example
7242
7243This script needs a configuration file @samp{lostaltmail.conf} set up
7244with the right parameters to properly work.  @xref{Hlfsd}, for more
7245details.
7246
7247@c ----------------------------------------------------------------
7248@node lostaltmail.conf-sample, mk-amd-map, lostaltmail, Assorted Tools
7249@comment  node-name,  next,  previous,  up
7250@section lostaltmail.conf-sample
7251@pindex lostaltmail.conf-sample
7252@cindex lostaltmail; configuration file
7253
7254This is a text file with configuration parameters needed for the
7255@samp{lostaltmail} script.  The script includes comments explaining each
7256of the configuration variables.  See it for more information.  Also
7257@pxref{Hlfsd} for general information.
7258
7259@c ----------------------------------------------------------------
7260@node mk-amd-map, pawd, lostaltmail.conf-sample, Assorted Tools
7261@comment  node-name,  next,  previous,  up
7262@section mk-amd-map
7263@pindex mk-amd-map
7264
7265This program converts a normal @i{Amd} map file into an ndbm database
7266with the same prefix as the named file.  Use it as follows:
7267
7268@example
7269mk-amd-map @i{mapname}
7270@end example
7271
7272@c ----------------------------------------------------------------
7273@node pawd, wait4amd, mk-amd-map, Assorted Tools
7274@comment  node-name,  next,  previous,  up
7275@section pawd
7276@pindex pawd
7277
7278@i{Pawd} is used to print the current working directory, adjusted to
7279reflect proper paths that can be reused to go through the automounter
7280for the shortest possible path.  In particular, the path printed back
7281does not include any of @i{Amd}'s local mount points.  Using them is
7282unsafe, because @i{Amd} may unmount managed file systems from the mount
7283points, and thus including them in paths may not always find the files
7284within.
7285
7286Without any arguments, @i{Pawd} will print the automounter adjusted
7287current working directory.  With any number of arguments, it will print
7288the adjusted path of each one of the arguments.
7289
7290@c ----------------------------------------------------------------
7291@node wait4amd, wait4amd2die, pawd, Assorted Tools
7292@comment  node-name,  next,  previous,  up
7293@section wait4amd
7294@pindex wait4amd
7295
7296A script to wait for @i{Amd} to start on a particular host before
7297performing an arbitrary command.  The command is executed repeatedly,
7298with 1 second intervals in between.  You may interrupt the script using
7299@samp{^C} (or whatever keyboard sequence your terminal's @samp{intr} function
7300is bound to).
7301
7302Examples:
7303
7304@table @t
7305@item wait4amd saturn amq -p -h saturn
7306When @i{Amd} is up on host @samp{saturn}, get the process ID of that
7307running @i{Amd}.
7308@item wait4amd pluto rlogin pluto
7309Remote login to host @samp{pluto} when @i{Amd} is up on that host.  It
7310is generally necessary to wait for @i{Amd} to properly start and
7311initialize on a remote host before logging in to it, because otherwise
7312user home directories may not be accessible across the network.
7313@item wait4amd pluto
7314A short-hand version of the previous command, since the most useful
7315reason for this script is to login to a remote host.  I use it very
7316often when testing out new versions of @i{Amd}, and need to reboot hung
7317hosts.
7318@end table
7319
7320@c ----------------------------------------------------------------
7321@node wait4amd2die, wire-test, wait4amd, Assorted Tools
7322@comment  node-name,  next,  previous,  up
7323@section wait4amd2die
7324@pindex wait4amd2die
7325
7326This script is used internally by @samp{ctl-amd} when used to restart
7327@i{Amd}.  It waits for @i{Amd} to terminate.  If it detected that
7328@i{Amd} terminated cleanly, this script will return an exist status of
7329zero.  Otherwise, it will return a non-zero exit status.
7330
7331The script tests for @i{Amd}'s existence once every 5 seconds, six
7332times, for a total of 30 seconds.  It will return a zero exist status as
7333soon as it detects that @i{Amd} dies.
7334
7335@c ----------------------------------------------------------------
7336@node wire-test, , wait4amd2die, Assorted Tools
7337@comment  node-name,  next,  previous,  up
7338@section wire-test
7339@pindex wire-test
7340
7341A simple program to test if some of the most basic networking functions
7342in am-util's library @file{libamu} work.  It also tests the combination
7343of NFS protocol and version number that are supported from the current
7344host, to a remote one.
7345
7346For example, in this test a machine which only supports NFS Version 2 is
7347contacting a remote host that can support the same version, but using
7348both UDP and TCP.  If no host name is specified, @samp{wire-test} will
7349try @file{localhost}.
7350
7351@example
7352$ wire-test moisil
7353Network name is "mcl-lab-net.cs.columbia.edu"
7354Network number is "128.59.13"
7355Network name is "old-net.cs.columbia.edu"
7356Network number is "128.59.16"
7357My IP address is 0x7f000001.
7358NFS Version and protocol tests to host "moisil"...
7359        testing vers=2, proto="udp" -> found version 2.
7360        testing vers=3, proto="udp" -> failed!
7361        testing vers=2, proto="tcp" -> found version 2.
7362        testing vers=3, proto="tcp" -> failed!
7363@end example
7364
7365@c ################################################################
7366@node Examples, Internals, Assorted Tools, Top
7367@comment  node-name,  next,  previous,  up
7368@chapter Examples
7369
7370@menu
7371* User Filesystems::
7372* Home Directories::
7373* Architecture Sharing::
7374* Wildcard Names::
7375* rwho servers::
7376* /vol::
7377* /defaults with selectors::
7378* /tftpboot in a chroot-ed environment::
7379
7380@end menu
7381
7382@node User Filesystems, Home Directories, Examples, Examples
7383@comment  node-name,  next,  previous,  up
7384@section User Filesystems
7385@cindex User filesystems
7386@cindex Mounting user filesystems
7387
7388With more than one fileserver, the directories most frequently
7389cross-mounted are those containing user home directories.  A common
7390convention used at Imperial College is to mount the user disks under
7391@t{/home/}@i{machine}.
7392
7393Typically, the @samp{/etc/fstab} file contained a long list of entries
7394such as:
7395
7396@example
7397@i{machine}:/home/@i{machine} /home/@i{machine} nfs ...
7398@end example
7399
7400for each fileserver on the network.
7401
7402There are numerous problems with this system.  The mount list can become
7403quite large and some of the machines may be down when a system is
7404booted.  When a new fileserver is installed, @samp{/etc/fstab} must be
7405updated on every machine, the mount directory created and the filesystem
7406mounted.
7407
7408In many environments most people use the same few workstations, but
7409it is convenient to go to a colleague's machine and access your own
7410files.  When a server goes down, it can cause a process on a client
7411machine to hang.  By minimizing the mounted filesystems to only include
7412those actively being used, there is less chance that a filesystem will
7413be mounted when a server goes down.
7414
7415The following is a short extract from a map taken from a research fileserver
7416at Imperial College.
7417
7418Note the entry for @samp{localhost} which is used for users such as
7419the operator (@samp{opr}) who have a home directory on most machine as
7420@samp{/home/localhost/opr}.
7421
7422@example
7423/defaults       opts:=rw,intr,grpid,nosuid
7424charm           host!=$@{key@};type:=nfs;rhost:=$@{key@};rfs:=/home/$@{key@} \
7425                host==$@{key@};type:=ufs;dev:=/dev/xd0g
7426#
7427...
7428
7429#
7430localhost       type:=link;fs:=$@{host@}
7431...
7432#
7433# dylan has two user disks so have a
7434# top directory in which to mount them.
7435#
7436dylan           type:=auto;fs:=$@{map@};pref:=$@{key@}/
7437#
7438dylan/dk2       host!=dylan;type:=nfs;rhost:=dylan;rfs:=/home/$@{key@} \
7439                host==dylan;type:=ufs;dev:=/dev/dsk/2s0
7440#
7441dylan/dk5       host!=dylan;type:=nfs;rhost:=dylan;rfs:=/home/$@{key@} \
7442                host==dylan;type:=ufs;dev:=/dev/dsk/5s0
7443...
7444#
7445toytown         host!=$@{key@};type:=nfs;rhost:=$@{key@};rfs:=/home/$@{key@} \
7446                host==$@{key@};type:=ufs;dev:=/dev/xy1g
7447...
7448#
7449zebedee         host!=$@{key@};type:=nfs;rhost:=$@{key@};rfs:=/home/$@{key@} \
7450                host==$@{key@};type:=ufs;dev:=/dev/dsk/1s0
7451#
7452# Just for access...
7453#
7454gould           type:=auto;fs:=$@{map@};pref:=$@{key@}/
7455gould/staff     host!=gould;type:=nfs;rhost:=gould;rfs:=/home/$@{key@}
7456#
7457gummo           host!=$@{key@};type:=nfs;rhost:=$@{key@};rfs:=/home/$@{key@}
7458...
7459@end example
7460
7461This map is shared by most of the machines listed so on those
7462systems any of the user disks is accessible via a consistent name.
7463@i{Amd} is started with the following command
7464
7465@example
7466amd /home amd.home
7467@end example
7468
7469Note that when mounting a remote filesystem, the @dfn{automounted}
7470mount point is referenced, so that the filesystem will be mounted if
7471it is not yet (at the time the remote @samp{mountd} obtains the file handle).
7472
7473@node Home Directories, Architecture Sharing, User Filesystems, Examples
7474@comment  node-name,  next,  previous,  up
7475@section Home Directories
7476@cindex Home directories
7477@cindex Example of mounting home directories
7478@cindex Mount home directories
7479
7480One convention for home directories is to locate them in @samp{/homes}
7481so user @samp{jsp}'s home directory is @samp{/homes/jsp}.  With more
7482than a single fileserver it is convenient to spread user files across
7483several machines.  All that is required is a mount-map which converts
7484login names to an automounted directory.
7485
7486Such a map might be started by the command:
7487
7488@example
7489amd /homes amd.homes
7490@end example
7491
7492where the map @samp{amd.homes} contained the entries:
7493
7494@example
7495/defaults   type:=link   # All the entries are of type:=link
7496jsp         fs:=/home/charm/jsp
7497njw         fs:=/home/dylan/dk5/njw
7498...
7499phjk        fs:=/home/toytown/ai/phjk
7500sjv         fs:=/home/ganymede/sjv
7501@end example
7502
7503Whenever a login name is accessed in @samp{/homes} a symbolic link
7504appears pointing to the real location of that user's home directory.  In
7505this example, @samp{/homes/jsp} would appear to be a symbolic link
7506pointing to @samp{/home/charm/jsp}.  Of course, @samp{/home} would also
7507be an automount point.
7508
7509This system causes an extra level of symbolic links to be used.
7510Although that turns out to be relatively inexpensive, an alternative is
7511to directly mount the required filesystems in the @samp{/homes}
7512map.  The required map is simple, but long, and its creation is best automated.
7513The entry for @samp{jsp} could be:
7514
7515@example
7516jsp   -sublink:=$@{key@};rfs:=/home/charm \
7517               host==charm;type:=ufs;dev:=/dev/xd0g \
7518               host!=charm;type:=nfs;rhost:=charm
7519@end example
7520
7521This map can become quite big if it contains a large number of entries.
7522By combining two other features of @i{Amd} it can be greatly simplified.
7523
7524First the UFS partitions should be mounted under the control of
7525@samp{/etc/fstab}, taking care that they are mounted in the same place
7526that @i{Amd} would have automounted them.  In most cases this would be
7527something like @samp{/a/@dfn{host}/home/@dfn{host}} and
7528@samp{/etc/fstab} on host @samp{charm} would have a line:@refill
7529
7530@example
7531/dev/xy0g /a/charm/home/charm 4.2 rw,nosuid,grpid 1 5
7532@end example
7533
7534The map can then be changed to:
7535
7536@example
7537/defaults    type:=nfs;sublink:=$@{key@};opts:=rw,intr,nosuid,grpid
7538jsp          rhost:=charm;rfs:=/home/charm
7539njw          rhost:=dylan;rfs:=/home/dylan/dk5
7540...
7541phjk         rhost:=toytown;rfs:=/home/toytown;sublink:=ai/$@{key@}
7542sjv          rhost:=ganymede;rfs:=/home/ganymede
7543@end example
7544
7545This map operates as usual on a remote machine (@i{ie} @code{$@{host@}}
7546not equal to @code{$@{rhost@}}).  On the machine where the filesystem is
7547stored (@i{ie} @code{$@{host@}} equal to @code{$@{rhost@}}), @i{Amd}
7548will construct a local filesystem mount point which corresponds to the
7549name of the locally mounted UFS partition.  If @i{Amd} is started with
7550the @code{-r} option then instead of attempting an NFS mount, @i{Amd} will
7551simply inherit the UFS mount (@pxref{Inheritance Filesystem}).  If
7552@code{-r} is not used then a loopback NFS mount will be made.  This type of
7553mount is known to cause a deadlock on many systems.
7554
7555@node Architecture Sharing, Wildcard Names, Home Directories, Examples
7556@comment  node-name,  next,  previous,  up
7557@section Architecture Sharing
7558@cindex Architecture sharing
7559@cindex Sharing a fileserver between architectures
7560@cindex Architecture dependent volumes
7561
7562@c %At the moment some of the research machines have sets of software
7563@c %mounted in @samp{/vol}.  This contains subdirectories for \TeX,
7564@c %system sources, local sources, prolog libraries and so on.
7565Often a filesystem will be shared by machines of different architectures.
7566Separate trees can be maintained for the executable images for each
7567architecture, but it may be more convenient to have a shared tree,
7568with distinct subdirectories.
7569
7570A shared tree might have the following structure on the fileserver (called
7571@samp{fserver} in the example):
7572
7573@example
7574local/tex
7575local/tex/fonts
7576local/tex/lib
7577local/tex/bin
7578local/tex/bin/sun3
7579local/tex/bin/sun4
7580local/tex/bin/hp9000
7581...
7582@end example
7583
7584In this example, the subdirectories of @samp{local/tex/bin} should be
7585hidden when accessed via the automount point (conventionally @samp{/vol}).
7586A mount-map for @samp{/vol} to achieve this would look like:
7587
7588@example
7589/defaults   sublink:=$@{/key@};rhost:=fserver;type:=link
7590tex         type:=auto;fs:=$@{map@};pref:=$@{key@}/
7591tex/fonts   host!=fserver;type:=nfs;rfs:=/vol/tex \
7592            host==fserver;fs:=/usr/local/tex
7593tex/lib     host!=fserver;type:=nfs;rfs:=/vol/tex \
7594            host==fserver;fs:=/usr/local/tex
7595tex/bin     -sublink:=$@{/key@}/$@{arch@} \
7596            host!=fserver;type:=nfs;rfs:=/vol/tex \
7597            host:=fserver;fs:=/usr/local/tex
7598@end example
7599
7600When @samp{/vol/tex/bin} is referenced, the current machine architecture
7601is automatically appended to the path by the @code{$@{sublink@}}
7602variable.  This means that users can have @samp{/vol/tex/bin} in their
7603@samp{PATH} without concern for architecture dependencies.
7604
7605@node Wildcard Names, rwho servers, Architecture Sharing, Examples
7606@comment  node-name,  next,  previous,  up
7607@section Wildcard Names & Replicated Servers
7608
7609By using the wildcard facility, @i{Amd} can @dfn{overlay} an existing
7610directory with additional entries.
7611The system files are usually mounted under @samp{/usr}.  If instead,
7612@i{Amd} is mounted on @samp{/usr}, additional
7613names can be overlayed to augment or replace names in the ``master'' @samp{/usr}.
7614A map to do this would have the form:
7615
7616@example
7617local  type:=auto;fs:=local-map
7618share  type:=auto;fs:=share-map
7619*      -type:=nfs;rfs:=/export/exec/$@{arch@};sublink:="$@{key@}" \
7620        rhost:=fserv1  rhost:=fserv2  rhost:=fserv3
7621@end example
7622
7623Note that the assignment to @code{$@{sublink@}} is surrounded by double
7624quotes to prevent the incoming key from causing the map to be
7625misinterpreted.  This map has the effect of directing any access to
7626@samp{/usr/local} or @samp{/usr/share} to another automount point.
7627
7628In this example, it is assumed that the @samp{/usr} files are replicated
7629on three fileservers: @samp{fserv1}, @samp{fserv2} and @samp{fserv3}.
7630For any references other than to @samp{local} and @samp{share} one of
7631the servers is used and a symbolic link to
7632@t{$@{autodir@}/$@{rhost@}/export/exec/$@{arch@}/@i{whatever}} is
7633returned once an appropriate filesystem has been mounted.@refill
7634
7635@node rwho servers, /vol, Wildcard Names, Examples
7636@comment  node-name,  next,  previous,  up
7637@section @samp{rwho} servers
7638@cindex rwho servers
7639@cindex Architecture specific mounts
7640@cindex Example of architecture specific mounts
7641
7642The @samp{/usr/spool/rwho} directory is a good candidate for automounting.
7643For efficiency reasons it is best to capture the rwho data on a small
7644number of machines and then mount that information onto a large number
7645of clients.  The data written into the rwho files is byte order dependent
7646so only servers with the correct byte ordering can be used by a client:
7647
7648@example
7649/defaults         type:=nfs
7650usr/spool/rwho    -byte==little;rfs:=/usr/spool/rwho \
7651                      rhost:=vaxA  rhost:=vaxB \
7652                  || -rfs:=/usr/spool/rwho \
7653                      rhost:=sun4  rhost:=hp300
7654@end example
7655
7656@node /vol, /defaults with selectors, rwho servers, Examples
7657@comment  node-name,  next,  previous,  up
7658@section @samp{/vol}
7659@cindex /vol
7660@cindex Catch-all mount point
7661@cindex Generic volume name
7662
7663@samp{/vol} is used as a catch-all for volumes which do not have other
7664conventional names.
7665
7666Below is part of the @samp{/vol} map for the domain @samp{doc.ic.ac.uk}.
7667The @samp{r+d} tree is used for new or experimental software that needs
7668to be available everywhere without installing it on all the fileservers.
7669Users wishing to try out the new software then simply include
7670@samp{/vol/r+d/@{bin,ucb@}} in their path.@refill
7671
7672The main tree resides on one host @samp{gould.doc.ic.ac.uk}, which has
7673different @samp{bin}, @samp{etc}, @samp{lib} and @samp{ucb}
7674sub-directories for each machine architecture.  For example,
7675@samp{/vol/r+d/bin} for a Sun-4 would be stored in the sub-directory
7676@samp{bin/sun4} of the filesystem @samp{/usr/r+d}.  When it was accessed
7677a symbolic link pointing to @samp{/a/gould/usr/r+d/bin/sun4} would be
7678returned.@refill
7679
7680@example
7681/defaults    type:=nfs;opts:=rw,grpid,nosuid,intr,soft
7682wp           -opts:=rw,grpid,nosuid;rhost:=charm \
7683             host==charm;type:=link;fs:=/usr/local/wp \
7684             host!=charm;type:=nfs;rfs:=/vol/wp
7685...
7686#
7687src          -opts:=rw,grpid,nosuid;rhost:=charm \
7688             host==charm;type:=link;fs:=/usr/src \
7689             host!=charm;type:=nfs;rfs:=/vol/src
7690#
7691r+d          type:=auto;fs:=$@{map@};pref:=r+d/
7692# per architecture bin,etc,lib&ucb...
7693r+d/bin      rhost:=gould.doc.ic.ac.uk;rfs:=/usr/r+d;sublink:=$@{/key@}/$@{arch@}
7694r+d/etc      rhost:=gould.doc.ic.ac.uk;rfs:=/usr/r+d;sublink:=$@{/key@}/$@{arch@}
7695r+d/include  rhost:=gould.doc.ic.ac.uk;rfs:=/usr/r+d;sublink:=$@{/key@}
7696r+d/lib      rhost:=gould.doc.ic.ac.uk;rfs:=/usr/r+d;sublink:=$@{/key@}/$@{arch@}
7697r+d/man      rhost:=gould.doc.ic.ac.uk;rfs:=/usr/r+d;sublink:=$@{/key@}
7698r+d/src      rhost:=gould.doc.ic.ac.uk;rfs:=/usr/r+d;sublink:=$@{/key@}
7699r+d/ucb      rhost:=gould.doc.ic.ac.uk;rfs:=/usr/r+d;sublink:=$@{/key@}/$@{arch@}
7700# hades pictures
7701pictures     -opts:=rw,grpid,nosuid;rhost:=thpfs \
7702             host==thpfs;type:=link;fs:=/nbsd/pictures \
7703             host!=thpfs;type:=nfs;rfs:=/nbsd;sublink:=pictures
7704# hades tools
7705hades        -opts:=rw,grpid,nosuid;rhost:=thpfs \
7706             host==thpfs;type:=link;fs:=/nbsd/hades \
7707             host!=thpfs;type:=nfs;rfs:=/nbsd;sublink:=hades
7708# bsd tools for hp.
7709bsd          -opts:=rw,grpid,nosuid;arch==hp9000;rhost:=thpfs \
7710             host==thpfs;type:=link;fs:=/nbsd/bsd \
7711             host!=thpfs;type:=nfs;rfs:=/nbsd;sublink:=bsd
7712@end example
7713
7714@node /defaults with selectors, /tftpboot in a chroot-ed environment, /vol, Examples
7715@comment  node-name,  next,  previous,  up
7716@section @samp{/defaults} with selectors
7717@cindex /defaults with selectors
7718@cindex selectors on default
7719
7720It is sometimes useful to have different defaults for a given map.  To
7721achieve this, the @samp{/defaults} entry must be able to process normal
7722selectors.  This feature is turned on by setting
7723@samp{selectors_on_default = yes} in the @file{amd.conf} file.
7724@xref{selectors_on_default Parameter}.
7725
7726In this example, I set different default NFS mount options for hosts
7727which are running over a slower network link.  By setting a smaller size
7728for the NFS read and write buffer sizes, you can greatly improve remote
7729file service performance.
7730
7731@example
7732/defaults \
7733  wire==slip-net;opts:=rw,intr,rsize=1024,wsize=1024,timeo=20,retrans=10 \
7734  wire!=slip-net;opts:=rw,intr
7735@end example
7736
7737@node /tftpboot in a chroot-ed environment, , /defaults with selectors, Examples
7738@comment  node-name,  next,  previous,  up
7739@section @samp{/tftpboot} in a chroot-ed environment
7740@cindex /tftpboot in a chroot-ed environment
7741@cindex chroot: /tftpboot example
7742
7743In this complex example, we attempt to run an @i{Amd} process
7744@emph{inside} a chroot-ed environment.  @samp{tftpd} (Trivial FTP) is
7745used to trivially retrieve files used to boot X-Terminals, Network
7746Printers, Network routers, diskless workstations, and other such
7747devices.  For security reasons, @samp{tftpd} (and also @samp{ftpd})
7748processes are run using the @b{chroot}(2) system call.  This provides an
7749environment for these processes, where access to any files outside the
7750directory where the chroot-ed process runs is denied.
7751
7752For example, if you start @samp{tftpd} on your system with
7753
7754@example
7755chroot /tftpboot /usr/sbin/tftpd
7756@end example
7757
7758@noindent
7759then the @samp{tftpd} process will not be able to access any files
7760outside @file{/tftpboot}.  This ensures that no one can retrieve files
7761such as @file{/etc/passwd} and run password crackers on it.
7762
7763Since the TFTP service works by broadcast, it is necessary to have at
7764least one TFTP server running on each subnet.  If you have lots of files
7765that you need to make available for @samp{tftp}, and many subnets, it
7766could take significant amounts of disk space on each host serving them.
7767
7768A solution we implemented at Columbia University was to have every host
7769run @samp{tftpd}, but have those servers retrieve the boot files from
7770two replicated servers.  Those replicated servers have special
7771partitions dedicated to the many network boot files.
7772
7773We start @i{Amd} as follows:
7774
7775@example
7776amd /tftpboot/.amd amd.tftpboot
7777@end example
7778
7779That is, @i{Amd} is serving the directory @file{/tftpboot/.amd}.  The
7780@samp{tftp} server runs inside @file{/tftpboot} and is chroot-ed in that
7781directory too.  The @file{amd.tftpboot} map looks like:
7782
7783@example
7784#
7785# Amd /tftpboot directory -> host map
7786#
7787
7788/defaults  opts:=nosuid,ro,intr,soft;fs:=/tftpboot/import;type:=nfs
7789
7790tp         host==lol;rfs:=/n/lol/import/tftpboot;type:=lofs \
7791           host==ober;rfs:=/n/ober/misc/win/tftpboot;type:=lofs \
7792           rhost:=ober;rfs:=/n/ober/misc/win/tftpboot \
7793           rhost:=lol;rfs:=/n/lol/import/tftpboot
7794@end example
7795
7796To help understand this example, I list a few of the file entries that
7797are created inside @file{/tftpboot}:
7798
7799@example
7800$ ls -la /tftpboot
7801dr-xr-xr-x   2 root   512 Aug 30 23:11 .amd
7802drwxrwsr-x  12 root   512 Aug 30 08:00 import
7803lrwxrwxrwx   1 root    33 Feb 27  1997 adminpr.cfg -> ./.amd/tp/hplj/adminpr.cfg
7804lrwxrwxrwx   1 root    22 Dec  5  1996 tekxp -> ./.amd/tp/xterms/tekxp
7805lrwxrwxrwx   1 root     1 Dec  5  1996 tftpboot -> .
7806@end example
7807
7808Here is an explanation of each of the entries listed above:
7809
7810@table @code
7811
7812@item .amd
7813This is the @i{Amd} mount point.  Note that you do not need to run a
7814separate @i{Amd} process for the TFTP service.  The @b{chroot}(2) system
7815call only protects against file access, but the same process can still
7816serve files and directories inside and outside the chroot-ed
7817environment, because @i{Amd} itself was not run in chroot-ed mode.
7818
7819@item import
7820This is the mount point where @i{Amd} will mount the directories
7821containing the boot files.  The map is designed so that remote
7822directories will be NFS mounted (even if they are already mounted
7823elsewhere), and local directories are loopback mounted (since they are
7824not accessible outside the chroot-ed @file{/tftpboot} directory).
7825
7826@item adminpr.cfg
7827@itemx tekxp
7828Two manually created symbolic links to directories @emph{inside} the
7829@i{Amd}-managed directory.  The crossing of the component @file{tp} will
7830cause @i{Amd} to automount one of the remote replicas.  Once crossed,
7831access to files inside proceeds as usual.  The @samp{adminpr.cfg} is a
7832configuration file for an HP Laser-Jet 4si printer, and the @samp{tekxp}
7833is a directory for Tektronix X-Terminal boot files.
7834
7835@item tftpboot
7836This innocent looking symlink is important.  Usually, when devices boot
7837via the TFTP service, they perform the @samp{get file} command to
7838retrieve @var{file}.  However, some devices assume that @samp{tftpd}
7839does not run in a chroot-ed environment, but rather ``unprotected'', and
7840thus use a full pathname for files to retrieve, as in @samp{get
7841/tftpboot/file}.  This symlink effectively strips out the leading
7842@file{/tftpboot/}.
7843
7844@end table
7845
7846@c ################################################################
7847@node Internals, Acknowledgments & Trademarks, Examples, Top
7848@comment  node-name,  next,  previous,  up
7849@chapter Internals
7850
7851Note that there are more error and logging messages possible than are
7852listed here.  Most of them are self-explanatory.  Refer to the program
7853sources for more details on the rest.
7854
7855@menu
7856* Log Messages::
7857@end menu
7858
7859@node Log Messages, , Internals, Internals
7860@comment  node-name,  next,  previous,  up
7861@section Log Messages
7862
7863In the following sections a brief explanation is given of some of the
7864log messages made by @i{Amd}.  Where the message is in @samp{typewriter}
7865font, it corresponds exactly to the message produced by @i{Amd}.  Words
7866in @dfn{italic} are replaced by an appropriate string.  Variables,
7867@code{$@{@i{var}@}}, indicate that the value of the appropriate variable is
7868output.
7869
7870Log messages are either sent directly to a file,
7871or logged via the @b{syslog}(3) mechanism.  @xref{log_file Parameter}.
7872In either case, entries in the file are of the form:
7873@example
7874@i{date-string}  @i{hostname} @t{amd[}@i{pid}@t{]}  @i{message}
7875@end example
7876
7877@menu
7878* Fatal errors::
7879* Info messages::
7880@end menu
7881
7882@node Fatal errors, Info messages, Log Messages, Log Messages
7883@comment  node-name,  next,  previous,  up
7884@subsection Fatal errors
7885
7886@i{Amd} attempts to deal with unusual events.  Whenever it is not
7887possible to deal with such an error, @i{Amd} will log an appropriate
7888message and, if it cannot possibly continue, will either exit or abort.
7889These messages are selected by @samp{-x fatal} on the command line.
7890When @b{syslog}(3) is being used, they are logged with level
7891@samp{LOG_FATAL}.  Even if @i{Amd} continues to operate it is likely to
7892remain in a precarious state and should be restarted at the earliest
7893opportunity.
7894
7895@table @t
7896
7897@item Attempting to inherit not-a-filesystem
7898The prototype mount point created during a filesystem restart did not
7899contain a reference to the restarted filesystem.  This error ``should
7900never happen''.
7901
7902@item Can't bind to domain "@i{NIS-domain}"
7903A specific NIS domain was requested on the command line, but no server
7904for that domain is available on the local net.
7905
7906@item Can't determine IP address of this host (@i{hostname})
7907When @i{Amd} starts it determines its own IP address.  If this lookup
7908fails then @i{Amd} cannot continue.  The hostname it looks up is that
7909obtained returned by @b{gethostname}(2) system call.
7910
7911@item Can't find root file handle for @i{automount point}
7912@i{Amd} creates its own file handles for the automount points.  When it
7913mounts itself as a server, it must pass these file handles to the local
7914kernel.  If the filehandle is not obtainable the mount point is ignored.
7915This error ``should never happen''.
7916
7917@item Must be root to mount filesystems (euid = @i{euid})
7918To prevent embarrassment, @i{Amd} makes sure it has appropriate system
7919privileges.  This amounts to having an euid of 0.  The check is made
7920after argument processing complete to give non-root users a chance to
7921access the @code{-v} option.
7922
7923@item No work to do - quitting
7924No automount points were given on the command line and so there is no
7925work to do.
7926
7927@item Out of memory
7928While attempting to malloc some memory, the memory space available to
7929@i{Amd} was exhausted.  This is an unrecoverable error.
7930
7931@item Out of memory in realloc
7932While attempting to realloc some memory, the memory space available to
7933@i{Amd} was exhausted.  This is an unrecoverable error.
7934
7935@item cannot create rpc/udp service
7936Either the NFS or AMQ endpoint could not be created.
7937
7938@item gethostname: @i{description}
7939The @b{gethostname}(2) system call failed during startup.
7940
7941@item host name is not set
7942The @b{gethostname}(2) system call returned a zero length host name.
7943This can happen if @i{Amd} is started in single user mode just after
7944booting the system.
7945
7946@item ifs_match called!
7947An internal error occurred while restarting a pre-mounted filesystem.
7948This error ``should never happen''.
7949
7950@item mount_afs: @i{description}
7951An error occurred while @i{Amd} was mounting itself.
7952
7953@item run_rpc failed
7954Somehow the main NFS server loop failed.  This error ``should never
7955happen''.
7956
7957@item unable to free rpc arguments in amqprog_1
7958The incoming arguments to the AMQ server could not be free'ed.
7959
7960@item unable to free rpc arguments in nfs_program_1
7961The incoming arguments to the NFS server could not be free'ed.
7962
7963@item unable to register (AMQ_PROGRAM, AMQ_VERSION, udp)
7964The AMQ server could not be registered with the local portmapper or the
7965internal RPC dispatcher.
7966
7967@item unable to register (NFS_PROGRAM, NFS_VERSION, 0)
7968The NFS server could not be registered with the internal RPC dispatcher.
7969
7970@end table
7971
7972XXX: This section needs to be updated
7973
7974@node Info messages, , Fatal errors, Log Messages
7975@comment  node-name,  next,  previous,  up
7976@subsection Info messages
7977
7978@i{Amd} generates information messages to record state changes.  These
7979messages are selected by @samp{-x info} on the command line.  When
7980@b{syslog}(3) is being used, they are logged with level @samp{LOG_INFO}.
7981
7982The messages listed below can be generated and are in a format suitable
7983for simple statistical analysis.  @dfn{mount-info} is the string
7984that is displayed by @dfn{Amq} in its mount information column and
7985placed in the system mount table.
7986
7987@table @t
7988
7989@item "@t{$@{@i{path}@}}" forcibly timed out
7990An automount point has been timed out by the @i{Amq} command.
7991
7992@item "@t{$@{@i{path}@}}" has timed out
7993No access to the automount point has been made within the timeout
7994period.
7995
7996@item Filehandle denied for "$@{@i{rhost}@}:$@{@i{rfs}@}"
7997The mount daemon refused to return a file handle for the requested filesystem.
7998
7999@item Filehandle error for "$@{@i{rhost}@}:$@{@i{rfs}@}": @i{description}
8000The mount daemon gave some other error for the requested filesystem.
8001
8002@item Finishing with status @i{exit-status}
8003@i{Amd} is about to exit with the given exit status. 
8004
8005@item Re-synchronizing cache for map @t{$@{@i{map}@}}
8006The named map has been modified and the internal cache is being re-synchronized.
8007
8008@item file server @t{$@{@i{rhost}@}} is down - timeout of "@t{$@{@i{path}@}}" ignored
8009An automount point has timed out, but the corresponding file server is
8010known to be down.  This message is only produced once for each mount
8011point for which the server is down.
8012
8013@item file server @t{$@{@i{rhost}@}} type nfs is down
8014An NFS file server that was previously up is now down.
8015
8016@item file server @t{$@{@i{rhost}@}} type nfs is up
8017An NFS file server that was previously down is now up.
8018
8019@item file server @t{$@{@i{rhost}@}} type nfs starts down
8020A new NFS file server has been referenced and is known to be down.
8021
8022@item file server @t{$@{@i{rhost}@}} type nfs starts up
8023A new NFS file server has been referenced and is known to be up.
8024
8025@item mount of "@t{$@{@i{path}@}}" on @t{$@{@i{fs}@}} timed out
8026Attempts to mount a filesystem for the given automount point have failed
8027to complete within 30 seconds.
8028
8029@item @i{mount-info} mounted fstype @t{$@{@i{type}@}} on @t{$@{@i{fs}@}}
8030A new file system has been mounted.
8031
8032@item @i{mount-info} restarted fstype @t{$@{@i{type}@}} on @t{$@{@i{fs}@}}
8033@i{Amd} is using a pre-mounted filesystem to satisfy a mount request.
8034
8035@item @i{mount-info} unmounted fstype @t{$@{@i{type}@}} from @t{$@{@i{fs}@}}
8036A file system has been unmounted.
8037
8038@item @i{mount-info} unmounted fstype @t{$@{@i{type}@}} from @t{$@{@i{fs}@}} link @t{$@{@i{fs}@}}/@t{$@{@i{sublink}@}}
8039A file system of which only a sub-directory was in use has been unmounted.
8040
8041@item restarting @i{mount-info} on @t{$@{@i{fs}@}}
8042A pre-mounted file system has been noted.
8043
8044@end table
8045
8046XXX: This section needs to be updated
8047
8048@c ################################################################
8049@node Acknowledgments & Trademarks, Index, Internals, Top
8050@comment  node-name,  next,  previous,  up
8051@unnumbered Acknowledgments & Trademarks
8052
8053Many thanks to the @email{amd-dev@@majordomo.cs.columbia.edu,Amd
8054Developers} mailing list through the months developing am-utils.  These
8055members have contributed to the discussions, ideas, code and
8056documentation, and subjected their systems to alpha quality code.
8057Special thanks go to those
8058@uref{http://www.cs.columbia.edu/~ezk/am-utils/AUTHORS.txt,authors} who
8059have submitted patches.
8060
8061Thanks to the Formal Methods Group at Imperial College for suffering
8062patiently while @i{Amd} was being developed on their machines.
8063
8064Thanks to the many people who have helped with the development of
8065@i{Amd}, especially Piete Brooks at the Cambridge University Computing
8066Lab for many hours of testing, experimentation and discussion.
8067
8068Thanks to the @email{amd-workers@@majordomo.glue.umd.edu,Amd Workers}
8069mailing list members for many suggestions and bug reports to @i{Amd}.
8070
8071@itemize @bullet
8072@item
8073@b{DEC}, @b{VAX} and @b{Ultrix} are registered trademarks of Digital
8074Equipment Corporation.
8075@item
8076@b{AIX} and @b{IBM} are registered trademarks of International Business
8077Machines Corporation.
8078@item
8079@b{Sun}, @b{NFS} and @b{SunOS} are registered trademarks of Sun
8080Microsystems, Inc.
8081@item
8082@b{UNIX} is a registered trademark in the USA and other countries,
8083exclusively licensed through X/Open Company, Ltd.
8084@item
8085All other registered trademarks are owned by their respective owners.
8086@end itemize
8087
8088@c ################################################################
8089@node Index, , Acknowledgments & Trademarks, Top
8090@comment  node-name,  next,  previous,  up
8091@unnumbered Index
8092
8093@printindex cp
8094
8095@contents
8096@bye
8097
8098@c ====================================================================
8099@c ISPELL LOCAL WORDS:
8100@c LocalWords:  setfilename amdref overfullrule settitle titlepage titlefont nz
8101@c LocalWords:  authorfont vskip ifinfo iftex cindex unnumberedsec dfn xref vol
8102@c LocalWords:  locationN pxref jpo nott concentrix Sjoerd sjoerd cwi Eitan vuw
8103@c LocalWords:  Mizrotsky eitan shumuji dgux fpx scp hcx metcalf masala hlh OTS
8104@c LocalWords:  Presnell srp cgl Trost trost ogi pyrOSx OSx tubsibr riscix iX
8105@c LocalWords:  Piete pb Lindblad cjl ai umax utek xinu Mitchum D'Souza dsouza
8106@c LocalWords:  mrc apu alliant aviion AViiON fps macII multimax tahoe vax emph
8107@c LocalWords:  mapdefault valA valB valC YPTSDIR ETCDIR substr MAKEDBM YPDBDIR
8108@c LocalWords:  NOPUSH njw dylan dk dylan njw anydir domN achilles mjh pref sel
8109@c LocalWords:  gdef loc loc loc ldots autodir remopts rwho rwho styx styx yoyo
8110@c LocalWords:  noindent gould rvdmount rvdunmount fserver mtmp unioned logfile
8111@c LocalWords:  dmn esac phjk toytown toytown toytown toytown phjk RdDir RdLnk
8112@c LocalWords:  volname attrs netif dougal inaddr hwaddr ec mountmaps passno xy
8113@c LocalWords:  freq dumpset hfs brian florence localinfo fstabs automaps defn
8114@c LocalWords:  localname fsck'd opr gummo sjv ganymede sjv fserv fserv fserv
8115@c LocalWords:  vaxA vaxB wp thpfs nbsd asis ifs amqprog free'ed printindex gov
8116@c LocalWords:  LocalWords syncodeindex Distrib bsdnet lanl AutoMounter acis ic
8117@c LocalWords:  ac uk aix bsd Mullender nl il DG lcs hpux irix ucsf NeXT cse cl
8118@c LocalWords:  mt FX hp ibm mips utils def def Domainname eg hostd getwd tmp
8119@c LocalWords:  subsubsection rw grpid intr noconn nocto nodevs nosuid retrans
8120@c LocalWords:  rsize tcp timeo nounmount utimeout DDEBUG nodaemon fd hostnames
8121@c LocalWords:  pid Amd's pendry vangogh nfsx backoff stats nomap nostats CRIT
8122@c LocalWords:  noinfo clustername RVD dsk dsk amq hostports osver statfs str
8123@c LocalWords:  ou counter's amdmaps proj src tftpboot sh mv cd sbin ypcat inet
8124@c LocalWords:  Getattr getattr localhost fhandles netmask fstype noquota addr
8125@c LocalWords:  exportfs Dumpsets dumpsets pindex ldif fixmount fixrmtab euid
8126@c LocalWords:  lostaltmail realloc netnumber itemx primnetnum primnetname ARG
8127@c LocalWords:  subsnetname subsnetnum netgrp netgroup multitable Shlib dec osf
8128@c LocalWords:  hppa pc bsdi freebsd netbsd openbsd ncr sysv rs acdirmax fsid
8129@c LocalWords:  acdirmin acregmax acregmin actimeo dumbtimr nfsv noac noauto sd
8130@c LocalWords:  nocache nodev noint nosub pgthresh posix rdonly suid symttl mfs
8131@c LocalWords:  AMFS umapfs myftpdir unionfs es mapname mapfile mapfile slocal
8132@c LocalWords:  mailspool saturn saturn notknown lol ober dr xr xr drwxrwsr cfg
8133@c LocalWords:  lrwxrwxrwx adminpr hplj adminpr cfg tekxp xterms tekxp Dupuy tp
8134@c LocalWords:  linkname hlfsddump dirname rmtab pluto rlogin direntry pg vr dn
8135@c LocalWords:  maxmem hlfsdir xmailbox showmount cn amdmap amdmapName resvport
8136@c LocalWords:  objectClass amdmapKey amdmapValue ln powerpc amdmapTimestamp ez
8137@c LocalWords:  moisil FSinfo Libtool Unmounting sublink fileservers NullProc
8138@c LocalWords:  gethostname mount's unmounts linkx remounts unmounting UAs SA's
8139@c LocalWords:  mountpoint mountpoints unescaped UIDs util's overlayed uref EFS
8140@c LocalWords:  serv maxgroups nfsl cachedir copt cfsadmin efs addopts fg ROMs
8141@c LocalWords:  nointr extatt setchapternewpage columnfractions alphaev gnulibc
8142@c LocalWords:  freebsdelf gnuoldld ifhtml defperm nodefperm norrip RRIP rrip
8143@c LocalWords:  noversion attr XXXXXX netgrpd rh mkstemp
8144