Annotation of 43BSDReno/usr.sbin/amd/doc/examples.tex, revision 1.1

1.1     ! root        1: % $Id: examples.tex,v 5.2 90/06/23 22:21:57 jsp Rel $
        !             2: %
        !             3: % Copyright (c) 1989 Jan-Simon Pendry
        !             4: % Copyright (c) 1989 Imperial College of Science, Technology & Medicine
        !             5: % Copyright (c) 1989 The Regents of the University of California.
        !             6: % All rights reserved.
        !             7: %
        !             8: % This code is derived from software contributed to Berkeley by
        !             9: % Jan-Simon Pendry at Imperial College, London.
        !            10: %
        !            11: % Redistribution and use in source and binary forms are permitted provided
        !            12: % that: (1) source distributions retain this entire copyright notice and
        !            13: % comment, and (2) distributions including binaries display the following
        !            14: % acknowledgement:  ``This product includes software developed by the
        !            15: % University of California, Berkeley and its contributors'' in the
        !            16: % documentation or other materials provided with the distribution and in
        !            17: % all advertising materials mentioning features or use of this software.
        !            18: % Neither the name of the University nor the names of its contributors may
        !            19: % be used to endorse or promote products derived from this software without
        !            20: % specific prior written permission.
        !            21: % THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
        !            22: % WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
        !            23: % MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
        !            24: %
        !            25: %      @(#)examples.tex        5.1 (Berkeley) 7/19/90
        !            26: 
        !            27: 
        !            28: \Chapter{Examples}
        !            29: 
        !            30: \Section{Starting \Amd}
        !            31: \Amd\ is best started from {\tt /etc/rc.local}:
        !            32: \begin{verbatim}
        !            33: if [ -f /usr/local/etc/amd.start ]; then
        !            34:         sh /usr/local/etc/amd.start; (echo -n ' amd')      >/dev/console
        !            35: fi
        !            36: \end{verbatim}
        !            37: The shell script, {\tt amd.start}, contains:
        !            38: \begin{verbatim}
        !            39: PATH=/usr/local/etc:/bin:/usr/bin:/usr/ucb:$PATH export PATH
        !            40: 
        !            41: #
        !            42: # Either name of logfile or "syslog"
        !            43: #
        !            44: LOGFILE=syslog
        !            45: #LOGFILE=/var/adm/am.log
        !            46: 
        !            47: #
        !            48: # Figure out whether domain name is in host name
        !            49: # If the hostname is just the machine name then
        !            50: # pass in the name of the local domain so that the
        !            51: # hostnames in the map are domain stripped correctly.
        !            52: #
        !            53: case `hostname` in
        !            54: *.*) dmn= ;;
        !            55: *) dmn='-d doc.ic.ac.uk'
        !            56: esac
        !            57: 
        !            58: #
        !            59: # Zap earlier log file
        !            60: #
        !            61: case "$LOGFILE" in
        !            62: */*)
        !            63:         mv "$LOGFILE" "$LOGFILE"-
        !            64:         > "$LOGFILE"
        !            65:         ;;
        !            66: syslog)
        !            67:         : nothing
        !            68:         ;;
        !            69: esac
        !            70: 
        !            71: cd /usr/local/etc
        !            72: #
        !            73: # -r            restart
        !            74: # -d dmn        local domain
        !            75: # -w wait       wait between unmount attempts
        !            76: # -l log        logfile or "syslog"
        !            77: #
        !            78: eval ./amd -r $dmn -w 240 -l "$LOGFILE" \
        !            79:         /homes amd.homes -cache:=inc \
        !            80:         /home amd.home -cache:=inc \
        !            81:         /vol amd.vol -cache:=inc \
        !            82:         /n amd.net -cache:=inc
        !            83: \end{verbatim}
        !            84: 
        !            85: If the list of automount points and maps is contained in a file or YP map
        !            86: it is easily incorporated onto the command line:
        !            87: \begin{verbatim}
        !            88: ...
        !            89: eval ./amd -r $dmn -w 240 -l "$LOGFILE" `ypcat -k auto.master`
        !            90: \end{verbatim}
        !            91: 
        !            92: \Section{User Filesystems}
        !            93: With more than one fileserver, the directories most frequently
        !            94: cross-mounted are those containing user home directories.
        !            95: A common convention used at Imperial College is to mount
        !            96: the user disks under {\tt /home/}{\em machine}.
        !            97: Typically, the {\tt /etc/fstab} file\footnote{{\tt /etc/checklist}
        !            98: on System V} contained a long list of entries
        !            99: such as:
        !           100: \begin{quote}
        !           101: {\em machine}{\tt :/home/}{\em machine}\ \ \tt /home/{\em machine}\ nfs \ldots
        !           102: \end{quote}
        !           103: for each fileserver on the network.
        !           104: 
        !           105: There are numerous problems with this system.
        !           106: The mount list can become quite large and some of the machines
        !           107: may be down when a system is booted.
        !           108: When a new fileserver is installed, {\tt /etc/fstab} must be
        !           109: updated on every machine, the mount directory created and
        !           110: the filesystem mounted.
        !           111: In research environments most
        !           112: people use the same few workstations, but it is convenient to go
        !           113: to a colleague's machine and access your own files.
        !           114: When a server goes down, it can cause a process on a client machine to
        !           115: hang.  By minimising the mounted filesystems to only include those
        !           116: actively being used, there is less chance that a filesystem will be mounted
        !           117: when a server goes down.
        !           118: 
        !           119: The following is a short extract from a map taken from a research fileserver
        !           120: at Imperial College.
        !           121: Note the entry for {\tt localhost} which is used for users such as
        !           122: the operator ({\tt opr}) who have a home directory on most machine as
        !           123: {\tt /home/localhost/opr}.
        !           124: \begin{verbatim}
        !           125: /defaults       opts:=rw,intr,grpid,nosuid
        !           126: charm           host!=${key};type:=nfs;rhost:=${key};rfs:=/home/${key} \
        !           127:                 host==${key};type:=ufs;dev:=/dev/xd0g
        !           128: #
        !           129: ...
        !           130: 
        !           131: #
        !           132: localhost       type:=link;fs:=${host}
        !           133: ...
        !           134: #
        !           135: # dylan has two user disks so have a
        !           136: # top directory in which to mount them.
        !           137: #
        !           138: dylan           type:=auto;fs:=${map};pref:=${key}/
        !           139: #
        !           140: dylan/dk2       host!=dylan;type:=nfs;rhost:=dylan;rfs:=/home/${key} \
        !           141:                 host==dylan;type:=ufs;dev:=/dev/dsk/2s0
        !           142: #
        !           143: dylan/dk5       host!=dylan;type:=nfs;rhost:=dylan;rfs:=/home/${key} \
        !           144:                 host==dylan;type:=ufs;dev:=/dev/dsk/5s0
        !           145: ...
        !           146: #
        !           147: toytown         host!=${key};type:=nfs;rhost:=${key};rfs:=/home/${key} \
        !           148:                 host==${key};type:=ufs;dev:=/dev/xy1g
        !           149: ...
        !           150: #
        !           151: zebedee         host!=${key};type:=nfs;rhost:=${key};rfs:=/home/${key} \
        !           152:                 host==${key};type:=ufs;dev:=/dev/dsk/1s0
        !           153: #
        !           154: # Just for access...
        !           155: #
        !           156: gould           type:=auto;fs:=${map};pref:=${key}/
        !           157: gould/staff     host!=gould;type:=nfs;rhost:=gould;rfs:=/home/${key}
        !           158: #
        !           159: gummo           host!=${key};type:=nfs;rhost:=${key};rfs:=/home/${key}
        !           160: ...
        !           161: \end{verbatim}
        !           162: 
        !           163: This map is shared by most of the machines listed so on those
        !           164: systems any of the user disks is accessible via a consistent name.
        !           165: \Amd\ is started with the following command
        !           166: \begin{quote}
        !           167: \tt amd /home amd.home
        !           168: \end{quote}
        !           169: 
        !           170: Note that when mounting a remote filesystem, the {\em automounted}
        !           171: mount point is referenced, so that the filesystem will be mounted if
        !           172: it is not yet (at the time the remote mountd obtains the file handle).
        !           173: 
        !           174: \Section{Home Directories}
        !           175: One convention for home directories is to locate them in {\tt /homes} so
        !           176: user {\tt jsp}'s home directory is {\tt /homes/jsp}.
        !           177: With more than a single fileserver it is convenient
        !           178: to spread user files across several machines.
        !           179: All that is required is a mount-map
        !           180: which converts login names to an automounted directory.
        !           181: 
        !           182: Such a map might be started by the command:
        !           183: \begin{quote}
        !           184: \tt amd /homes amd.homes
        !           185: \end{quote}
        !           186: where the map {\tt amd.homes} contained the entries:
        !           187: \begin{quote}\raggedright
        !           188: \tt
        !           189: /defaults\ \ \ type:=link\ \ \ \# All the entries are of type:=link \\
        !           190: jsp\ \ \ \ \ \ \ \ \ fs:=/home/charm/jsp\\
        !           191: njw\ \ \ \ \ \ \ \ \ fs:=/home/dylan/dk5/njw\\
        !           192: ...\\
        !           193: phjk\ \ \ \ \ \ \ \ fs:=/home/toytown/ai/phjk\\
        !           194: sjv\ \ \ \ \ \ \ \ \ fs:=/home/ganymede/sjv
        !           195: \end{quote}
        !           196: Whenever a login name is accessed in {\tt /homes} a symbolic link
        !           197: appears pointing to the real location of that user's home directory.
        !           198: In this example, {\tt /homes/jsp} would appear to be a symbolic link
        !           199: pointing to {\tt /home/charm/jsp}.
        !           200: Of course, {\tt /home} would also be an automount point.
        !           201: 
        !           202: This system causes an extra level of symbolic links to be used.
        !           203: Although that turns out to be relatively inexpensive, an alternative is
        !           204: to directly mount the required filesystems in the {\tt /homes}
        !           205: map.  The required map is simple, but long, and its creation best automated.
        !           206: The entry for {\tt jsp} could be:
        !           207: {\tt\begin{tabbing}
        !           208: jsp\ \ \ \ \ \ \= -sublink:=\$\{key\};rfs:=/home/charm {\verb+\+}\kill \\
        !           209: jsp            \> -sublink:=\$\{key\};rfs:=/home/charm {\verb+\+}\\
        !           210:                \> host==charm;type:=ufs;dev:=/dev/xd0g {\verb+\+}\\
        !           211:                \> host!=charm;type:=nfs;rhost:=charm
        !           212: \end{tabbing}}
        !           213: 
        !           214: This map can become quite big if it contains a large number of
        !           215: entries.  By combining two other features of \amd\ it can be greatly
        !           216: simplified.  First the \UFS\ partitions should be mounted under the
        !           217: control of {\tt /etc/fstab}, taking care that they are mounted in the
        !           218: same place that \amd\ would have automounted them, {\ie\ {\tt /a/{\em host}/home/{\em host}}}.
        !           219: In this case {\tt /etc/fstab} on host {\tt charm} would have a line
        !           220: \begin{verbatim}
        !           221: /dev/xy0g /a/charm/home/charm 4.2 rw,nosuid,grpid 1 5
        !           222: \end{verbatim}
        !           223: The map can then be changed to:
        !           224: \begin{quote}\raggedright
        !           225: \tt
        !           226: /defaults\ \ \ \ type:=nfs;sublink:=\Var{key};opts:=rw,intr,nosuid,grpid\\
        !           227: jsp\ \ \ \ \ \ \ \ \ \ rhost:=charm;rfs:=/home/charm\\
        !           228: njw\ \ \ \ \ \ \ \ \ \ rhost:=dylan;rfs:=/home/dylan/dk5\\
        !           229: ...\\
        !           230: phjk\ \ \ \ \ \ \ \ \ rhost:=toytown;rfs:=/home/toytown;sublink:=ai/\Var{key}\\
        !           231: sjv\ \ \ \ \ \ \ \ \ \ rhost:=ganymede;rfs:=/home/ganymede
        !           232: \end{quote}
        !           233: 
        !           234: This map operates as usual on a remote machine (ie \Var{host} $\not=$ \Var{rhost}).
        !           235: On the machine where the filesystem is stored (ie \Var{host} $=$ \Var{rhost}),
        !           236: \amd\ will construct a local filesystem mount point which corresponds to
        !           237: the name of the locally mounted \UFS\ partition.  If \amd\ is started
        !           238: with the ``-r'' option then instead of attempting an \NFS\ mount, \amd\ will
        !           239: simply inherit the \UFS\ mount (\see \Ref{ifs}).
        !           240: 
        !           241: %\Section{System Filesystem}
        !           242: 
        !           243: \Section{Architecture Sharing}
        !           244: %At the moment some of the research machines have sets of software
        !           245: %mounted in {\tt /vol}.  This contains subdirectories for \TeX,
        !           246: %system sources, local sources, prolog libraries and so on.
        !           247: Often a filesystem will be shared by machines of different architectures.
        !           248: Separate trees can be maintained for the executable images for each
        !           249: architecture, but it may be more convenient to have a shared tree,
        !           250: with distinct subdirectories.
        !           251: 
        !           252: A shared tree might have the following structure on the fileserver (called
        !           253: {\tt fserver} in the example):
        !           254: \begin{quote}\raggedright
        !           255: \tt
        !           256: local/tex \\
        !           257: local/tex/fonts \\
        !           258: local/tex/lib \\
        !           259: local/tex/bin \\
        !           260: local/tex/bin/sun3 \\
        !           261: local/tex/bin/sun4 \\
        !           262: local/tex/bin/hp9000 \\
        !           263: ...
        !           264: \end{quote}
        !           265: In this example, the subdirectories of {\tt local/tex/bin} should be
        !           266: hidden when accessed via the automount point (conventionally {\tt /vol}).
        !           267: A mount-map for {\tt /vol} to achieve this would look like:
        !           268: {\tt\begin{tabbing}
        !           269: tex/fonts\ \ \ \ \ \= \kill \\
        !           270: /defaults          \> rfs:=/vol;sublink:=\$\{key\};rhost:=fserver;type:=link\\
        !           271: tex                \> type:=auto;fs:=\$\{map\};pref:=\$\{key\}/\\
        !           272: tex/fonts          \> host!=fserver;type:=nfs\ {\verb+\+}\\
        !           273:                    \> host==fserver;fs:=/usr/local \\
        !           274: tex/lib            \> host!=fserver;type:=nfs\ {\verb+\+}\\
        !           275:                    \> host==fserver;fs:=/usr/local \\
        !           276: tex/bin            \> -sublink:=\$\{key\}/\$\{arch\} host!=fserver;type:=nfs\ {\verb+\+}\\
        !           277:                    \> host:=fserver;fs:=/usr/local
        !           278: \end{tabbing}}
        !           279: When {\tt /vol/tex/bin} is referenced, the current machine architecture
        !           280: is automatically appended to the path by the \Var{sublink} variable.
        !           281: This means that users can have {\tt /vol/tex/bin} in their {\tt PATH}
        !           282: without concern for architecture dependencies.
        !           283: 
        !           284: \Section{Wildcard names \& Replicated Servers}
        !           285: By using the wildcard facility, \amd\ can {\em overlay} an existing
        !           286: directory with additional entries.
        !           287: The system files are usually mounted under {\tt /usr}.  If instead
        !           288: \amd\ is mounted on {\tt /usr}, additional
        !           289: names can be overlayed to augment or replace names in the ``master'' {\tt /usr}.
        !           290: A map to do this would have the form:
        !           291: {\tt\begin{tabbing}
        !           292: local\ \ \ \ \ \= blah \kill \\
        !           293: local          \> type:=auto;fs:=local-map\\
        !           294: share          \> type:=auto;fs:=share-map\\
        !           295: {}*            \> -type:=nfs;rfs:=/export/exec/\$\{arch\};sublink:="\$\{key\}"\ \verb+\+\\
        !           296:                \> \ \ \ \ rhost:=fserv1\ \ rhost:=fserv2\ \ rhost:=fserv3 \\
        !           297: \end{tabbing}}
        !           298: Note that the assignment to \Var{sublink} is surrounded by double quotes to
        !           299: prevent the incoming key from causing the map to be misinterpreted.
        !           300: This map has the effect of directing any access to {\tt /usr/local} or {\tt /usr/share}
        !           301: to another automount point.
        !           302: In this example, it is assumed that the {\tt /usr} files are replicated on
        !           303: three fileservers: {\tt fserv1}, {\tt fserv2} and {\tt fserv3}.
        !           304: For any references other than to {\tt local}
        !           305: and {\tt share} one of the servers is used and a symbolic link to
        !           306: {\tt \Var{autodir}/\Var{rhost}/export/exec/\Var{arch}/}{\em whatever}
        !           307: is returned once an appropriate filesystem has been mounted.
        !           308: 
        !           309: \Section{{\tt rwho} servers\label{example:rwho}}
        !           310: 
        !           311: The {\tt /usr/spool/rwho} directory is a good candidate for automounting.
        !           312: For efficiency reasons it is best to capture the rwho data on a small
        !           313: number of machines and then mount that information onto a large number
        !           314: of clients.  The data written into the rwho files is byte order dependent
        !           315: so only servers with the correct byte ordering can be used by a client:
        !           316: {\tt\begin{tabbing}
        !           317: usr/spool/rwho\ \ \ \ \ \= blah \kill \\
        !           318: /defaults               \> type:=nfs \\
        !           319: usr/spool/rwho          \> -byte==little;rfs:=/usr/spool/rwho \verb+\+\\
        !           320:                         \>\ \ \ \ rhost:=vaxA\ \ rhost:=vaxB \verb+\+\\
        !           321:                         \>|| -rfs:=/usr/spool/rwho \verb+\+\\
        !           322:                         \>\ \ \ \ rhost:=sun4\ \ rhost:=hp300\\
        !           323: \end{tabbing}}
        !           324: 
        !           325: \Section{{\tt /vol}}
        !           326: {\tt /vol} is used as a catch-all for volumes which do not have other conventional names.
        !           327: 
        !           328: Below is part of the {\tt /vol} map for the domain {\tt doc.ic.ac.uk}.
        !           329: The {\tt r+d} tree is used for new or experimental software that needs to be
        !           330: available everywhere without installing it on all the fileservers.  Users wishing to
        !           331: try out the new software then simply include {\tt /vol/r+d/{bin,ucb}} in their path.
        !           332: 
        !           333: The main tree resides on one host {\tt gould.doc.ic.ac.uk}, which has different
        !           334: {\tt bin}, {\tt etc}, {\tt lib} and {\tt ucb} sub-directories for each machine
        !           335: architecture.  For example, {\tt /vol/r+d/bin} for a Sun-4 would be stored in
        !           336: the sub-directory {\tt bin/sun4} of the filesystem {\tt /usr/r+d}.  When it was
        !           337: accessed a symbolic link pointing to {\tt /a/gould/usr/r+d/bin/sun4} would be
        !           338: returned.
        !           339: 
        !           340: \begin{verbatim}
        !           341: /defaults    type:=nfs;opts:=rw,grpid,nosuid,intr,soft
        !           342: wp           -opts:=rw,grpid,nosuid;rhost:=charm \
        !           343:              host==charm;type:=link;fs:=/usr/local/wp \
        !           344:              host!=charm;type:=nfs;rfs:=/vol/wp
        !           345: ...
        !           346: #
        !           347: src          -opts:=rw,grpid,nosuid;rhost:=charm \
        !           348:              host==charm;type:=link;fs:=/usr/src \
        !           349:              host!=charm;type:=nfs;rfs:=/vol/src
        !           350: #
        !           351: r+d          type:=auto;fs:=${map};pref:=r+d/
        !           352: # per architecture bin,etc,lib&ucb...
        !           353: r+d/bin      rhost:=gould.doc.ic.ac.uk;rfs:=/usr/r+d;sublink:=${/key}/${arch}
        !           354: r+d/etc      rhost:=gould.doc.ic.ac.uk;rfs:=/usr/r+d;sublink:=${/key}/${arch}
        !           355: r+d/include  rhost:=gould.doc.ic.ac.uk;rfs:=/usr/r+d;sublink:=${/key}
        !           356: r+d/lib      rhost:=gould.doc.ic.ac.uk;rfs:=/usr/r+d;sublink:=${/key}/${arch}
        !           357: r+d/man      rhost:=gould.doc.ic.ac.uk;rfs:=/usr/r+d;sublink:=${/key}
        !           358: r+d/src      rhost:=gould.doc.ic.ac.uk;rfs:=/usr/r+d;sublink:=${/key}
        !           359: r+d/ucb      rhost:=gould.doc.ic.ac.uk;rfs:=/usr/r+d;sublink:=${/key}/${arch}
        !           360: # hades pictures
        !           361: pictures     -opts:=rw,grpid,nosuid;rhost:=thpfs \
        !           362:              host==thpfs;type:=link;fs:=/nbsd/pictures \
        !           363:              host!=thpfs;type:=nfs;rfs:=/nbsd;sublink:=pictures
        !           364: # hades tools
        !           365: hades        -opts:=rw,grpid,nosuid;rhost:=thpfs \
        !           366:              host==thpfs;type:=link;fs:=/nbsd/hades \
        !           367:              host!=thpfs;type:=nfs;rfs:=/nbsd;sublink:=hades
        !           368: # bsd tools for hp.
        !           369: bsd          -opts:=rw,grpid,nosuid;arch==hp9000;rhost:=thpfs \
        !           370:              host==thpfs;type:=link;fs:=/nbsd/bsd \
        !           371:              host!=thpfs;type:=nfs;rfs:=/nbsd;sublink:=bsd
        !           372: \end{verbatim}
        !           373: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.