backup root partitions and Re: making xd1 bootable

Matt Crawford matt at oddjob.uchicago.edu
Wed May 17 05:00:29 AEST 1989


> I set up the eeprom to boot off of xd(0,1,0).  Fine.  I booted, and it got
> vmunix off of xd1, as expected.  But it suddenly decided to use the root
> and swap off of xd0:

It looks like you are running 4.X, so your kernel could be getting its
swap and root devices from an rpc.bootparamd server.  But since you have
local disks, this is almost certainly not the case.

What you *do* need to do is configure a kernel that has you desired root
and swap partitions compiled in.  See the chapter "Reconfiguring the
System Kernel" in your "System & Network Administration" manual.


But this would be a good time for me to show how I maintain a current
backup root partition ... information which I offered months ago and then
never provided.  (Appy-polly-woggies to those who sent requests.)

My usual root partition is xy0a and I have a near-copy of it on xy2a,
mounted on /backuproot.  Files which differ between the two copies are
/vmunix and /etc/fstab.  (This is all under 3.5, not 4.X.) Vmunix on xy0a
is a link to vmunix.xy0 while on xy2a it is a link to vmunix.xy2.  The two
versions are generated from a config file /sys/conf/ODDJOB which contains:

config		vmunix		root on xy0a swap on xy0b and xy1b and xy2b
config		vmunixtwo	root on xy2a swap on xy2b and xy1b and xy0b


The /etc/fstab is similarly a link to either fstab.xy0 or fstab.xy2,
the difference being:

% diff /etc/fstab.xy0 /etc/fstab.xy2
1c1
< /dev/xy0a	/		4.2	rw			1 1
---
> /dev/xy2a	/		4.2	rw			1 1
18c18
< /dev/xy2a	/backuproot	4.2	rw			7 2
---
> /dev/xy0a	/bentuproot	4.2	rw			1 2

(When running from xy2a, xy0a may be mounted on /bentuproot.)


To keep the two root partitions in sync, I use rdist.  (But some
things must still be maintained by hand -- /dev, for instance.)  Note
that this means that root on the local machine must be listed in
/.rhosts.  In a script run nightly from crontab appear the following
lines.

   ================begin excerpt==================
   echo ""
   if [ -d /backuproot/lost+found ]; then
	   echo "Running rdist:"
	   date >> /usr/adm/rdist-errs
	   rdist -f /usr/local/lib/Distfile backuproot 2>&1 | \
		   tee -a /usr/adm/rdist-errs
   else
	   if [ -d /bentuproot/lost+found ]; then
		   echo "Running reverse rdist:"
		   date >> /usr/adm/rdist-errs
		   rdist -f /usr/local/lib/Distfile reversebackup 2>&1 | \
			   tee -a /usr/adm/rdist-errs
	   else
		   echo "/backuproot not mounted -- skipping rdist"
	   fi
   fi
   =================end excerpt===================

(The test for the existence of a lost+found directory is to prevent
the rdist from running when the other "root" partition is not mounted.)
Here is /usr/local/lib/Distfile.

================Distfile================
ROOTFILES = ( /.cshrc /.login /.plan /.profile /.rhosts /PhoneNumbers
		/dumpall /bin /boot /private /etc /kadb /lib /dev/MAKEDEV*
		/mbox /stand /sys /tftpboot /genvmunix /vmunix* )
# It's a pity we can't rdist /dev !

EXROOT = ( /vmunix /etc/fstab )

ROOTSPECIAL = ( /vmunix.xy2 )
ETCSPECIAL = ( /etc/fstab.xy2 )

backuproot:
${ROOTFILES} -> oddjob
	install -w -R /backuproot ;
	except ${EXROOT} ;
	special ${ROOTSPECIAL}	"name=/backuproot/`basename $FILE .xy2` ;
				 rm $name;	ln $name.xy2 $name";
	special ${ETCSPECIAL}	"name=/backuproot/etc/`basename $FILE .xy2` ;
				 rm $name;	ln $name.xy2 $name";

REVROOTSPECIAL = ( /vmunix.xy0 )
REVETCSPECIAL = ( /etc/fstab.xy0 )

reversebackup:
${ROOTFILES} -> oddjob
	install -w -R /bentuproot ;
	except ${EXROOT} ;
	special ${REVROOTSPECIAL} "name=/bentuproot/`basename $FILE .xy0` ;
				 rm $name;	ln $name.xy0 $name";
	special ${REVETCSPECIAL} "name=/bentuproot/etc/`basename $FILE .xy0` ;
				 rm $name;	ln $name.xy0 $name";
================end of Distfile================

Matt Crawford	     		matt at oddjob.uchicago.edu



More information about the Comp.sys.sun mailing list