[comp.sys.sun] Automounter loops: summary of responses

shprentz@bdmrrr.bdm.com (Joel Shprentz) (02/17/90)

In <4647@brazos.Rice.edu>, I asked for help using the automounter to mount
home directories on servers.  The consensus among the many people who
responded is that the Sun manuals are a little unclear:  they recommend
hard mounting local home directory partitions as /home/host and also
recommend using /home as an automounter mount point.  With this approach
the automounter on /home hides the physical /home/host partition.

The approach most often recommended to me (and now working here) is as
follows:  Mount local home directories as /export/home or some other path
that does not include /home.  Include the line

	/home	auto.home	-rw,intr,noquota

in the auto.master map.  Create an auto.home map that looks like this:

	server1		server1:/export/home
	server2		server2:/export/home
	server3		server3:/export/home

The manual suggests that wildcards could reduce the auto.home file to

	*		&:/export/home

but this line will crash the automounter if auto.home is distributed
through the yellow pages (Sun bug #1,023,528).  I decided to use the
yellow pages, so I had to use explicit entries for each server.

Sun does not recommend using wildcards in yellow pages maps because they
can hide other entries. For example, if /etc/auto.home contained

	+auto.home
	+auto.other
	server4		server4:/unusual/home

then a wildcard entry in the auto.home yellow pages map would hide all the
information in the auto.other map and the local special case.

The yellow pages makefile had to be revised to make the auto.master and
auto.home maps.  I added auto.master and auto.home to the "all" dependency
line:

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

Then I added the following lines to strip off comments, make the yellow
pages database, and push the maps to slave servers.

	auto.master.time: $(DIR)/auto.master
		-@if [ -f $(DIR)/auto.master ]; then \
			sed -e "/^#/d" -e s/#.*$$// $(DIR)/auto.master | \
				$(MAKEDBM) - $(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.home.time: $(DIR)/auto.home
		-@if [ -f $(DIR)/auto.home ]; then \
			sed -e "/^#/d" -e s/#.*$$// $(DIR)/auto.home | \
				$(MAKEDBM) - $(YPDBDIR)/$(DOM)/auto.home; \
			touch auto.home.time; \
			echo "updated auto.home"; \
			if [ ! $(NOPUSH) ]; then \
				$(YPPUSH) auto.home; \
				echo "pushed auto.home"; \
			else \
				: ; \
			fi \
		else \
			echo "couldn't find $(DIR)/auto.home"; \
		fi

Finally, the following extra lines complete the picture:

	auto.master: auto.master.time
	auto.home: auto.home.time
	$(DIR)/auto.home:
	$(DIR)/auto.master:

On each system using the automounter, I added these lines to /etc/rc.local
after the biod commands:

	# Start the YP automounter
	if [ -f /usr/etc/automount ]; then
		/usr/etc/automount ;	(echo -n ' automount')	>/dev/console
	fi

After rebooting, everything works.  For example, if I am on server1, a
reference to /home/server1 establishes the symbolic link /home/server1 ->
/export/home.  A reference to /home/server2 mounts server2:/export/home on
/tmp_mnt/home/server2 and establishes the link /home/server2 ->
/tmp_mnt/home/server2.

My thanks to respondents 
	roberto@bondi.phyast.pitt.edu	(Roberto Gomez)
	brent@eng.sun.com		(Brent Callaghan)
	cs.utexas.edu!oakhill!toddb 	(Todd Bridges)
	gfr@swift.mitre.org		(Glenn Roberts)
	Anthony.Worrall@reading.ac.uk	(Anthony D. Worrall)
	shn@think.com			(Sam Nuwayser)
	poffen@sj.ate.slb.com		(Russ Possnberger)
	crl@east.sun.com		(Charles LaBrec)
	uccba!mead!dem			(David Myers)

Joel Shprentz                   Phone:  (703) 848-7305
BDM International, Inc.         Uucp:  {rutgers,vrdxhq,rlgvax}!bdmrrr!shprentz
7915 Jones Branch Drive         Internet:  shprentz@bdmrrr.bdm.com
McLean, Virginia  22102