SUMMARY Automounter Confusion (LONG!!)

From: Kathryn Fielding (kat@genisco.gtc.com)
Date: Fri May 10 1991 - 13:14:28 CDT


Well, I seem to have hit the jackpot on questions to ask. I received
many responses, some of which I've summarized here. My apologies to
everyone who's response I ommitted, or edited, but the file was well
over 1000 lines. Anyone who wants the complete file can email me, and
I'll send it on.

Thanks to:

(Ronan-Yann Lorin)" <litsun.epfl.ch!lorin>
Alastair Young <eucad.co.uk!alastair>
Canada.Sun.COM!Tony.Santos (Tony Santos - Sys/Net Administrator Sun Toronto)
Claus Assmann <RELAY.CS.NET!ca%idefix.informatik.uni-kiel.dbp.de>
Mike Sullivan <bae.bellcore.com!mbs>
Richard Elling <eng.auburn.edu!elling>
Steve Riley <sacto.West.Sun.COM!pacacc!steve>
dhostwo.convex.com!thurlow (Robert Thurlow)
eds.com!thompson (Joel Thompson)
hao.ucar.edu!sitongia (Leonard Sitongia)
hao.ucar.edu!spivey (Keeper of Arcane Lore)
lgc.com!dinah
math.ufl.edu!bb
morgan.vest.sdata.no!birger ( Birger Wathne)
ncbi.nlm.nih.gov!randy (Rand S. Huntzinger)
phyast.nhn.uoknor.edu!feldt (Andy Feldt)
sunlite.concordia.ca!girish
sunne.East.Sun.COM!stern (Hal Stern - Consultant)
tnt!bice (Brent A. Bice)
trc.amoco.com!zjat02 (Jon A. Tankersley)
uunet.UU.NET!auspex!jst (Jason Thomasser)
uunet.UU.NET!bmskc!oz!paul (Paul Evan Matz)

-Kathryn

kat@gtc.com {uunet!zardoz|elroy.jpl.nasa.gov}!genisco!kat

My opinions are exclusively mine - although I might sell them cheap!

------------------------------------------------------------------------------------

------------------------------------------

From: elroy!sunne.East.Sun.COM!stern (Hal Stern - Consultant)

ah. the trick to making some machines ignore a map is to
use the magic -null map.

first of all, it's best to use indirect maps if you can.
they're easier to manage, and you can change an indirect map
on the fly and have the automounter "take" the change. direct
map entries can't be changed without restarting the automounter
because they get advertised in /etc/mtab once when the automounter starts
up.

so let's say you have a map associated with /var/spool/news but
you want to break this association on some machines. your
auto.master looks like:
        /var/spool/news -rw svr:/spool/news

on those machines where you don't want to automount /var/spool/news,
start AM this way:
        automount /var/spool/news -null

this wipes out the automounter's notion of any map for the mount
point /var/spool/news

all of this, and many more examples, are in the new O'Reilly and Associates
"Nutshell Guide to NFS and NIS", which will hit the press next week and
be available at usenix. the automounter chapter is about 30 pages long
and has a bunch of examples.

------------------------------------------
From: elroy!dhostwo.convex.com!thurlow (Robert Thurlow)

In info.sun-managers you write:

>I would greatly appreciate some illumination from any
>automounter guru's out there. I don't entirely
>understand the interaction between the automounter
>and NIS. I've been able to develop some basic maps
>to get my home directories and some of my application
>directories automounted. I've been trying to read the
>manual, but I'm a little confused.

Been there :-)

>What I want to do is to set things up so that most
>of my maps are in the yellow pages, so that I won't have
>to maintain multiple copies of everything.

I agree, this is the easiest way to get everyone agreeing.

>What I want to do is to create a yellow pages map
>that will run on all machines and will mount these
>directories on the appropriate mount points. Here's where
>my confusion comes in. [Enter confusion] If this is
>in a yellow pages map like auto.direct, won't this machine
>see this and try and do something with it? In other words,
>what I want to do is to have a series of maps that all my
>machines see, but that certain ones ignore. How do you
>set this up. Would it be better to do this using indirect maps?

I don't think you want indirect maps for this purpose, though you'll
possibly use them when you need them (they're great for managing a
series of related filesystems). What you want to do is to have a local
master map that pulls in the maps you need on each machine that isn't
"plain vanilla". Automount pulls in maps by looking for a flat file
and then pulling in an NIS map if that's not found, so you should be
able to do machine-specific stuff easily.

As for getting maps into NIS, have you worked out how to build
the maps yet? Just in case, here's a clip from our NIS makefile:

auto.master.time: $(DIR)/auto.master
        -@if [ -f $(DIR)/auto.master ]; then \
                umask 022; \
                sed "/^#/d" < $(DIR)/auto.master | \
                $(MAKEDBM) - $(DOMDIR)/auto.master; \
                touch auto.master.time; \
                echo "updated auto.master"; \
                if [ ! $(NOPUSH) ]; then \
                        $(YPPUSH) auto.master; \
                        echo "pushed auto.master"; \
                else \
                        : ; \
                fi \
        else \
                echo "couldn't find $(DIR)/auto.master"; \
        fi

auto.direct.time: $(DIR)/auto.direct
        -@if [ -f $(DIR)/auto.direct ]; then \
                umask 022; \
                sed "/^#/d" < $(DIR)/auto.direct | \
                $(MAKEDBM) - $(DOMDIR)/auto.direct; \
                touch auto.direct.time; \
                echo "updated auto.direct"; \
                if [ ! $(NOPUSH) ]; then \
                        $(YPPUSH) auto.direct; \
                        echo "pushed auto.direct"; \
                else \
                        : ; \
                fi \
        else \
                echo "couldn't find $(DIR)/auto.direct"; \
        fi

This will probably need editing if you're using SunOS 4.1 or greater.

------------------------------------------

From: Claus Assmann <elroy!RELAY.CS.NET!ca%idefix.informatik.uni-kiel.dbp.de>

I hope our setup can help you (although I'm not a guru :-( :
We have a 4/390 (majestix), which is a NIS master server, file- und mailserver.
We have the following maps created there:
% ypcat -k auto.master
/home /etc/auto.home -rw,hard,intr,noquota
/- /etc/auto.direct -rw,hard,intr,noquota

% ypcat -k auto.home.sun
majestix -rw,hard,intr,quota &:/home/&
dagobert -rw,hard,intr &:/home/&

% ypcat -k auto.direct.usr
/var/spool/news -rw,hard,intr,noquota,nosuid majestix:/var/spool/news
/usr/openwin -rw,hard,intr,noquota majestix:/usr/openwin
/usr/lib/tex -rw,hard,intr,noquota,nosuid majestix:/usr/lib/tex
/usr/local -rw,hard,intr,noquota majestix:/usr/local
/usr/games -rw,hard,intr,noquota majestix:/usr/games
/usr/lang -rw,hard,intr,noquota,nosuid majestix:/usr/lang
/usr/demo -rw,hard,intr,noquota,nosuid majestix:/usr/demo

On our clients, we have the following files:
% cat /etc/auto.home
+auto.home.sun
+auto.home.apollo

% cat /etc/auto.direct
+auto.direct.usr

On the hosts which don't automount other directories (like our for fileservers),
we have either deleted the entry in /etc/rc.local:
# don't start up the automounter
#
# if [ -f /usr/etc/automount ]; then
# automount && echo -n ' automount'
# fi

or the files /etc/auto.home and /etc/auto.direct are missing.
This way either the automounter doesn't start or it exits silently.
Another way to do this, is not to have a NIS map for auto.master
and not to have a file /etc/auto.master.
This would stop the automounter too.

------------------------------------------

From: elroy!ncbi.nlm.nih.gov!randy (Rand S. Huntzinger)

   The auto.master map tells automount which files to read to get map
information. For example:

        NIS auto.master contains
        ========================
/net -hosts -noquota,hard,intr
/am /etc/auto.mounts -noquota,hard,intr
/- /etc/auto.direct -noquota,hard,intr

This will cause the automount program to look in /etc/auto.mounts for
indirect mount points mounted under /am and /etc/auto.direct for direct
mounts.

   Then on your workstation you'll need files named /etc/auto.mounts and
auto.direct. On machines to read the auto.direct map you can place:

        +auto.direct

which will refer the system back to the auto.direct NIS map as well as some
local mount points if you wish. If you don't want to reference the auto.direct
NIS map on a given machine, you omit the line "+auto.direct" from your
/etc/auto.direct file on that machine (you could probably even omit it
entirely. I don't remember whether you get an ugly message or not.

   Other autmount maps can be handled in a similar manner.
------------------------------------------
From: elroy!trc.amoco.com!zjat02 (Jon A. Tankersley)

Go ahead and make the mounts known as /var/spool/mail and /var/spool/news.

Move the server mounts to export and fix /etc/exports.

server and clients should be able to find the right things....

auto.direct: snapshot -
/var/spool/mail server:/export/var/spool/mail
/var/spool/news server:/export/var/spool/news

------------------------------------------
From: Alastair Young <elroy!eucad.co.uk!alastair>

I think what you want is to configure your auto.master to get the machines to
look in a local (ie real file not NIS) map. This can then refer them on to
the NIS maps that should be used eg:

auto.master:

/- /etc/auto.local

/etc/auto.local on each machine:

/publicstuff auto.publicstuff
/secreststuff auto.secretstuff
/net -hosts

where auto.publicstuff and auto.secretstuff are NIS maps. As the
/etc/auto.local map is local to each machine it can be different on each
machine. In this way different machines can have different automount
configurations.

------------------------------------------

From: Richard Elling <elroy!eng.auburn.edu!elling>

> What I want to do is to set things up so that most
> of my maps are in the yellow pages, so that I won't have
> to maintain multiple copies of everything.

This is a good idea. Also fairly easily implemented.

> I have a server that exports /var/spool/mail and
> /var/spool/news... ...Would it be better to do this using indirect maps?

No. /var/spool/mail is best not automounted. This may seem like a pain, but
it can be easily handled by adding a line to the client /etc/fstab which looks
like:
        mailhost:/var/spool/mail /var/spool/mail nfs rw,hard,bg,intr 0 0

Then make an alias in the hosts database for the server which is the mailhost.
This way you can move the mail host around without reconfiguring any fstabs. Also,
if you use the default Sun sendmail.cf for client machines which remote mount
/var/spool/mail, it won't interact properly with an automounted /var/spool/mail.

For /var/spool/news, I suggest a symbolic link to /vol/news or some such. Reason
being that you want to avoid direct mounts as much as possible because they are
more difficult to reconfigure (direct automounts are only configured when the
automounter starts up, so if you change the map, you have to kill -TERM all of
the automount daemons and restart them :-(. Note that if you symlink /var/spool/mail,
then you will definitely break the sendmail interaction.

> I would appreciate it if someone could shed some light on this.
> My boss wants to have all the maps in the Yellow Pages, and
> obfuscate the file systems as minimally as possible.

A grand idea, and automount sure will help keep you sane (once you figure it out :-).
------------------------------------------

From: elroy!uunet.UU.NET!bmskc!oz!paul (Paul Evan Matz)

> [Enter confusion] If this is in a yellow pages map like auto.direct,
> won't this machine see this and try and do something with it?

No, the automounter is smart enough to understand that it is the
supplier of the directory; a "cd /var/spool/mail" will land you
right in the local directory on the server, and on the client,
a daemon process is attached to the mount point to handle the
nfs access.

You have to use the direct mapping for /var/spool/mail, if you
want mail to work (:-). This is true for any volume that has to
be mounted at a specific position; indirect maps always have a
prefix like /home/... or /vol/...

I've included an old mail message I sent to someone re: automount.
It's focus is 386i-ish, which is were alot of the auto conventions
started. However, the direct maps on the 386i had a problem which
was never fixed, as far as I could find out from Sun, although it
was acknowledged as a problem.

Direct maps work fine on sun3/sun4. The automount manpage talks
about all of it. The hardest part is updating the /var/yp makefile
to support the various maps (which were standard on the 386i).

--------begin forwarding--------------------------------------------
You might try and get a "white paper" from your Sun Sales Rep. called
"The Automounter", by Brent Callaghan and Tom Lyon (date unknown). In
addition to that, "Using the Network Beginner's Guide, section 3.4, and
the Sun386i Advanced Administration manual, section 6.3, have some
details. The man pages on automount, auto.vol, auto.home, also contain
some info. All together, you might begin to get a better idea of how it
works.

Basically, in SunOS 4.0.1 for the 386i (and to a lesser extent, for the
Sun3), they have some basic conventions for the standard OS. The
automount runs off of ypmaps that define a set of network accessible
file systems (otherwise known as volumes) and where the volumes can be
found. In fact, there can be multiple servers for an identical
network volume, so if one machine is down, another picks up the slack.

The automount ypmaps consist of the main map auto.master, which in turn
references auto.home, auto.vol, and the hosts file. When a user tries
to reference a file within a directory that is handled by the
automounter, the exported NFS volume is mounted on a temporary mount
point /tmp_mnt, and a symbolic link from within the "volume" directory
is made to point to the newly mounted file system. A network
accessible volume is the directory name associated with the network
acck!nathanessible resource. Currently there are three: /home, /vol and
/net. They have the form of:

/home/username : home directories
/vol/volumename : network volumes,
/net/hostname : any exported file system from any host

The biggest problem trying to explain the new conventions to users.
The idea of mounting the file system on /tmp_mnt, and referencing it via
a symbolic link, really confuses people. Home directories especially;
If you do a pwd before a cd, immediately after login, your current
directory shows as something like "/tmp_mnt/auto226a00121", instead
of /home/paul. Users, who were use to having their homes in the
same directory as their co-workers, can't do a "cd ../joe" anymore.
They've got to do a "cd ~joe". And if a volume is not yet mounted, "ls
/vol/volumename" doesn't work; You've got to cd to it first to get it
mounted. Finally, if no nfs server if available, you tend to hang
forever, as one might expect, but may never get use to. No big deal.

All in all, Automount is a great idea. I only wish I never had to
learn how to do fixed mounting of file systems in the first place.
Try to get that white paper, if you can. It's quite good.

[There is a 4th convention not covered many places, except for in that
white paper, called auto.direct. It allows mounts on mount points other
than /net, /home and /vol. It is actually what you're trying to do.
Below is an example entry from a 386i:

/usr/cluster -ro,intr bud:/export/cluster/sun386.sunos4.0.1

I would suspect that, in your example, the 2nd colon is confusing the
automounter:-------------------------|
                                     V
        bin/X11 ursa:/usr/bin:X11

We've never actually been able to get direct mounts to work, so if you
come across anyone who has, let me know. Thanks].

--------end forwarding--------------------------------------------
------------------------------------------

>From elroy!lgc.com!dinah Fri May 3 08:02:22 1991

HI. First of all, do you get SunExpert magazine? If so, dig up the February
and March issues for this year. I have 2 articles in there on the automounter
that should help clear up a couple of things.

Second, indirect maps are usually better than direct ones. This is what
I would do:

In auto.home

mail mailserver:/var/spool/mail
news newsever:/var/spool/mail

THen on each client

ln -s /home/mail /var/spool/mail
ln -s /home/news /var/spool/news

FOr clients you don't want to use the automounter, simply don't make the
link (and make the regular directory.) Or if you want to use a different
host, include the link and in the client`s own /etc/auto.home file:

mail other_mailserver:/var/spool/mail
+

That should do the trick. Let me know if you have other questions.
------------------------------------------

From: elroy!hao.ucar.edu!sitongia (Leonard Sitongia)

I've done that recently. I created the auto.* files in /etc on
the NIS master, then edited the /var/yp/Makefile to make the NIS maps
from the /etc/auto.* files. Extracts from the Makefile look like:

all: passwd group hosts ethers networks rpc services protocols \
        netgroup bootparams aliases publickey netid netmasks c2secure \
        auto.master auto.direct auto.home auto.yoda auto.hao auto.sting \
        auto.leia auto.src auto.slug auto.flower auto.worsel

auto.master.time: $(DIR)/auto.master
        @(while read L; do echo $$L; done < $(DIR)/auto.master $(CHKPIPE)) | \
          (sed -e "/^#/d" -e s/#.*$$// -e "/^ *$$/d" $(CHKPIPE)) | \
          $(MAKEDBM) - $(YPDBDIR)/$(DOM)/auto.master;
        @touch auto.master.time
        @echo "updated auto.master";
        @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOM) auto.master; fi
        @if [ ! $(NOPUSH) ]; then echo "pushed auto.master"; fi

auto.master: auto.master.time

Then each NIS client's corresponding file contains the reference to NIS
rather than the contents of the auto.* file. For example, on the
NIS master, auto.master contains:

# MASTER automounter map
#
#Mount-point Map [Mount Options]
#
/- /etc/auto.direct
/flower /etc/auto.flower
/ha /etc/auto.hao
/home /etc/auto.home
/leia /etc/auto.leia
/slug /etc/auto.slug
/src /etc/auto.src -ro
/sting /etc/auto.sting
/worsel /etc/auto.worsel
/yoda /etc/auto.yoda

But on a client it is:
# MASTER automounter map
#
+auto.master

------------------------------------------

From: elroy!phyast.nhn.uoknor.edu!feldt (Andy Feldt)

   You are not confused. It is true that the server will also see the
map and try to mount those directories on top of themselves and then
*IT* will get quite confused. What I have done is shown in the following
simplified version of my automount maps:

================ auto.master ======================
/home auto.home -rw,intr
/net -hosts -ro,intr
/- auto.direct -ro,intr

================ auto.home ========================
* &:/myhome

================ auto.direct ======================
/usr/openwin phyast:/myhome/local/openwin
/usr/lib/ps phyast:/myhome/local/ps
/usr/local -rw,intr phyast:/myhome/local
/usr/lang phyast:/myhome/lang
/usr/imsl phyast:/myhome/local/imsl
/usr/tex phyast:/myhome/local/tex
/usr/man phyast:/usr/share/man

'phyast' is the name of my server. This allows all references to
/home/machine to translate to machine:/myhome and is done this way
so that there is no need to do anything special with the /home map
for each machine's own home directory. When I install SunOS, I always
make a mount point for /myhome, not /home and let the automounter do
the rest. To share the man pages, there is one additional trick that
needs to be done on the server only and that is to remove the /usr/man
link to /usr/share/man the very first time this is set up (and at each
SunOS upgrade) *BEFORE* attempting to start the automounter with these
maps.

To do the mail thing, you could try simply starting the automounter
on your server with
   automount /var/spool/mail -null /var/spool/news -null
to negate the automount of these direct maps. I don't have a 'news', but
I have, so far, explicitly mounted /var/spool/mail in the fstab on
all my machines because I set it up before I figured out how to use the
automounter and and never tried to test it out since then.

------------------------------------------
From: elroy!morgan.vest.sdata.no!birger ( Birger Wathne)

I guess you already got a lot of responses to this one, but:

You may move the original file systems (on the server) to a new name, and
automount everywhere, including the server. Put /var/spool/mail in
/export/spool/mail and automount on all clients, including the server.
Automount is smart enough to make just a simple link from /var/spool directly to /export/spool/mail when it sees the file system is local.

Another solution is to use something like "automount /var/spool/mail -null"
on the server. This overrides the default map.

------------------------------------------

From: elroy!uunet.UU.NET!auspex!jst (Jason Thomasser)

I have included a set of auto mount files and the accompanying NIS
makefile. The tricky thing I found was how to set up auto.master.
this can be inferred from the doc but as you have experienced is not
straight forward. the +<map name> stuff can be reallly confusing. this
map can of course be bbroken up into more maps, the on detail is that
an additonal NIS map needs to gbe generated. any way this will work by default
on sunos4.1 machines automagically, on 4.0.x machines you will have to add :

if [ -f /usr/etc/automount]; then
        automount & (echo -n ' automount') >/dev/console
fi

to rc.local. For special case machines this line will have to be modiifeid
to exclude the maps you specify. the documentation in sunos4.1 (or the
att sysVr4 manuals at the bookstore, systems administration volume) is
pretty clear on this. If you have any problems feel free to call. to be
honest i've been thinking it might a good idea to start setting up
a network of sysadmin for verbal exchange. this email stuff can get to be
a bit of a pain.... anyway call if you need a hand.

#
# /etc/auto.master
#
/- auto.user

#
# /etc/auto.user
# A direct Map
#
/home/auspex auspex:/home/auspex
/user/apps \
        / auspex:/user/export/apps/sunos.4.0.3/$ARCH \
        /share auspex:/user/export/apps/share
/user/eng/build auspex:/home/build
/user/eng/src auspex:/home/src
/user/sysadmin auspex:/user/export/sysadmin
/var/spool/mail mailhost:/var/spool/mail
/var/spool/news newshost:/var/spool/news

#
# @(#)make.script 1.24 88/02/08 SMI
#
# Modified: 02/22/91 [jst@auspex.com}
# Comments: Added ypservers map generation
#
DIR =/etc
DOM = `domainname`
NOPUSH = ""
ALIASES = /etc/aliases
YPDIR=/usr/etc/yp
YPDBDIR=/var/yp
YPPUSH=$(YPDIR)/yppush
MAKEDBM=$(YPDIR)/makedbm
REVNETGROUP=$(YPDIR)/revnetgroup
STDETHERS=$(YPDIR)/stdethers
STDHOSTS=$(YPDIR)/stdhosts
MKNETID=$(YPDIR)/mknetid
MKALIAS=$(YPDIR)/mkalias

all: ypservers passwd group hosts ethers networks rpc services protocols \
        netgroup bootparams aliases publickey netid c2secure netmasks \
        auto.master auto.user

auto.master.time: $(DIR)/auto.master
        -@if [ -f $(DIR)/auto.master ]; then \
                $(MAKEDBM) $(DIR)/auto.master $(YPDBDIR)/$(DOM)/auto.master; \
                touch auto.master.time; \
                echo "updated auto.master"; \
                if [ ! $(NOPUSH) ]; then \
                        $(YPPUSH) auto.master; \
                        echo "pushed auto.master"; \
                else \
                        : ; \
                fi \
        else \
                echo "couldn't find $(DIR)/auto.master"; \
        fi

auto.user.time: $(DIR)/auto.user
        -@if [ -f $(DIR)/auto.user ]; then \
                $(MAKEDBM) $(DIR)/auto.user $(YPDBDIR)/$(DOM)/auto.user; \
                touch auto.user.time; \
                echo "updated auto.user"; \
                if [ ! $(NOPUSH) ]; then \
                        $(YPPUSH) auto.user; \
                        echo "pushed auto.user"; \
                else \
                        : ; \
                fi \
        else \
                echo "couldn't find $(DIR)/auto.user"; \
        fi

auto.master: auto.master.time
auto.user: auto.user.time
------------------------------------------



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:06:13 CDT