[comp.sys.sun] sharing /pub read/write on 3.x

geoff@utstat.toronto.edu (04/26/89)

I don't recall seeing this discussed in sun-spots.  We are still running
3.5 kernels and are unlikely to switch all our machines to 4.x soon;
others in the same situation may appreciate this suggestion, which is due
to Charles Forsyth of York University in England.

Mounting /pub via ND (read-only of course) means that changing any file in
/bin or /lib on a file server will crash its clients, or at the very least
necessitate rebooting them to update their ND caches, since Sun apparently
provided no user-level hook to flush an ND cache (and unmounting and
remounting /pub when running multi-user is unwise, not to mention
difficult).

For the last week, we have been running with modified rc.boots, as shown
below.  The key change is to mount /pub via ND just long enough to execute
hostname and ifconfig, unmount /pub and mount /pub via NFS.  Thereafter,
the clients or the server may change files in /pub without crashing the
clients.  This has made software maintenance much more pleasant than
before.

Our fstabs have been adjusted to mount /pub via NFS, as below:
---
/dev/nd0	    /			4.2 rw 1 1
# /dev/ndp1	    /pub		4.2 ro 0 0
utstat:/pub.MC68020 /pub		nfs rw,suid 0 0
utstat:/            /n/utstat           nfs rw,suid 0 0
utstat:/usr	    /n/utstat/usr	nfs rw,suid 0 0
---

Our rc.boots now look like this:
---
#! /bin/sh
#	@(#)rc.boot 1.1 85/12/18 SMI
# Executed once at boot time
# modified as suggested by John Bruner to check the root before
# changing files on it.
PATH=/etc:/bin; export PATH
hostname=utubrutus			# change this to suit your machine
root=/dev/nd0				# change this to suit your machine

exec >/dev/console 2>&1
if [ ! -f /fastboot ]; then
	fsck -p $root			# check root ...
	case $? in
	0)	;;			# root is all happy
	4)	echo Root fixed - rebooting.;	reboot -q -n ;;
	8)	echo "Automatic reboot failed... help!";	exit 1 ;;
	12)	echo "Reboot interrupted";	exit 1 ;;
	*)	echo "Unknown error in reboot";	exit 1 ;;
	esac
fi

> /etc/mtab				# ... before modifying!
mount -f /

mount -r /dev/ndp1 /pub			# temporary, for hostname & ifconfig
hostname $hostname
ifconfig ie0 $hostname -trailers up netmask 255.255.255.0
ifconfig le0 $hostname -trailers up netmask 255.255.255.0
umount /dev/ndp1

umount -at nfs
mount /pub

sync
---

Geoff Collyer	utzoo!utstat!geoff, geoff@utstat.toronto.edu