[comp.sys.sun] How to deal with trashed fstabs

roy%phri@uunet.uu.net (Roy Smith) (08/06/89)

During the process of replacing our XY-450 disk controller with a Ciprico
Rimfire, I ran into a sticky detail.  You have to change your fstab to
indicate that your disks are now rf0, rf1, etc, instead of xy0, xy1, etc.
Once you do this, there is no turning back, i.e. if you can't get the new
controller to work and want to go back to the xy, you can't.  Even if you
save a copy of your old xy-based kernal and boot it, when it comes up,
even single-user, it will read the rf-based fstab, all of which will refer
to non-existant rf disks.  Here's how I dealt with the problem.

First off, even though the entry for / in fstab is wrong, root gets
mounted anyway (I'm not quite sure if "mounting the root file system" has
any meaning, suffice it to say it's there).  Problem is, you don't even
have a /bin, because that's on /pub.MC68020, which didn't get mounted.
Fortunately, you do have a shell (that's about all you have).  You can do
something like:

	% echo '/dev/xy0a / 4.2 rw 0 0' > /etc/fstab
	% echo '/dev/xy0d /pub.MC68020 4.2 rw 0 0' >> /etc/fstab

and reboot.  The next step is to make your life a bit easier should
anything like that ever happen again.  I made a /minibin and put a
"survival kit" in it.  Ask yourself what programs you would most want if
you were stranded on a desert island with only 150 kbytes of binaries.  I
picked cat, cp, dd, ed, ls, mv, ps, rm, and stty.  It's cheap insurance.
Someday it might give you enough to work with on a badly trashed system to
avoid having to drag out the distribution tapes and doing a cold install.

-- 
Roy Smith, Public Health Research Institute
455 First Avenue, New York, NY 10016
{att,philabs,cmcl2,rutgers,hombre}!phri!roy -or- roy@alanine.phri.nyu.edu
"The connector is the network"

dupuy@cs.columbia.edu (Alex Dupuy) (08/22/89)

> I made a /minibin and put a "survival kit" in it. ...  I picked cat, cp, dd,
> ed, ls, mv, ps, rm, and stty.

% file -L /bin/{cat,cp,dd,ed,ls,mv,ps,rm,stty}
/bin/cat:       sparc pure dynamically linked executable
/bin/cp:        sparc pure dynamically linked executable
/bin/dd:        sparc pure dynamically linked executable
/bin/ed:        sparc demand paged dynamically linked executable
/bin/ls:        sparc pure dynamically linked executable
/bin/mv:        sparc demand paged executable
/bin/ps:        sparc pure dynamically linked set-gid executable
/bin/rm:        sparc pure dynamically linked executable
/bin/stty:      sparc pure dynamically linked executable

I hope all your programs in /minibin are statically linked, otherwise, you
had better set up a /minilib with a copy of libc.so.* and ld.so so you can
do runtime linking.

Personally, why bother with anything you can do using sh?  The only thing
I would want in a /minibin would be restore.  Everything else which can't
be done with I/O redirection and builtin echo isn't critical in
single-user mode.

% file /usr/etc/restore
/usr/etc/restore:       sparc demand paged executable

@alex