Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 1 Sep 1995 10:58:25 -0400 (EDT)
From:      MARC Giannoni <marc@cmc.eng.comsat.com>
To:        questions@FreeBSD.org
Subject:   Re: Help! I blew away init
Message-ID:  <Pine.3.87.9509011025.B5168-0100000@cmc>
In-Reply-To: <Pine.3.87.9508301851.E18277-0100000@cmc>

next in thread | previous in thread | raw e-mail | index | archive | help

Well for anyone who is interested, there is an answer here.  I know what 
I did was relly dumb, but that is how I learn stuff.

Creating a boot floppy which will also contain a single user root file
system is quite a trick.  First you will need a kernel - the smallest 
possable.  If you have access to a kernel source tree, create one which 
has the minimum you will need to mount your hard disk.  Tough to do if 
your root file system is blown away, this may be something you will want 
to set up for emergencies!  Use the pseudo-device 'gzip' so that you can 
have the support programs on the floppy compressed.  (Who cares about 
performance now!)

The floppy disk will need three directories, /dev, /bin, /sbin.  In /dev
you will have to have all your device nodes.  These are small so you can
afford to have quite a variety.  Next you will need to have a copy of init
in /sbin, and a copy of sh in /bin.  Most importantly you will need a copy
of mount and umount along with fsck to get access to the hard disk for
repairs.  If you have the pseudo-device 'gzip' in your kernel, these can
be gzipped. 

By this point the floppy will be filling up, possably overfull.  The
question here is how can we allow for a floppy disk change following
bootup and before init does a chroot to the floppy?  I have seen boot
disks do this, they will pause and request that a root floppy be placed in
the drive.  This two disk alternative would provide much more space.

With this skeletal setup, the trick is to boot the floppy and try to 
mount something which will provide you with much support.  A cdrom 
is nice, so is another floppy disk.

One more thing that I noticed during this exercise is that init announced 
that it was changing to root device fd0c.  So when I setup the floppy, 
for the 10th time, I edited the disk label to have partition c equivalent 
to partition a.

For a 1440 disk:
3 partitions:
#        size   offset    fstype   [fsize bsize   cpg]
  a:     2880        0    4.2BSD      512  4096    16   # (Cyl.    0 - 79)
  b:     2880        0    unused      512  4096         # (Cyl.    0 - 79)
  c:     2880        0    4.2BSD      512  4096    16   # (Cyl.    0 - 79)


| Marc V. Giannoni             | Voice:    (301) 428-2547             |
| COMSAT Mobile Communications | Fax:      (301) 601-5959             |
| 22300 Comsat Drive           | Internet: marc@cmc.eng.comsat.com    |
| Clarksburg, MD 20871         | Title:    Software Engineer          |




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.3.87.9509011025.B5168-0100000>