SUMMARY: Bootable CD

From: Lars Bro (Lars.Bro@nettest.com)
Date: Fri Jul 12 2002 - 22:09:32 EDT


Hi, managers

I put a question to the board about how to manage the "time of last shutdown" on a
homemade bootable CD. The answer came promptly from Tom Blinn, that this was
a difficult matter and probably not worth trying to deal with.

But several people have asked me: How DO you actually make a bootable CD with
a fair amount of functionality and so on.

The whole thing was actually documented by HP during the horrendous days of "new
hardware delivery" as you probably all know. But I will explain as good as I can:

First of all, you need a Unix system. I installed a system on an empty machine,
trying to make it not all too big. As far as I remember, there were several choices,
such as "minimal" or "custom". I think that I chose "minimal", but that may be a
matter of taste. As long as it fits into a 700 Mb CD.

Then, I copied the whole thing into our repository host, so that I had a complete
file system hierarchy below one directory /export/tools/CD/install_cd-1.4
That directory will in the following be referred to as the "root" (/) directory.

In order to make the thing boot on any system, I simply copied /vmunix
to /unix.

As everything is read-only on the CD, I made an "mfs" file system for /tmp.
The following is in /etc/fstab:
-s204800 /tmp mfs rw 1 0
This means that /tmp will be a memory file system of 100 Mb.

Then, in order to make file domains, I made /ets/fdmns a link to
 /tmp/fdmns.

I did not do anything to /dev. That remained on the CD, as /dev is full of
things like kmem and stuff that are needed, but of course, the entries in
/dev are invalid on the system to boot. Instead, in order to make access to
the disks of the computer you boot, you have to do something like
cd /tmp
/dev/MAKEDEV rz7
makefdmn /tmp/rz7f some_domain
...

When the system boots, init changes the runlevel to whatever is specified
by initdefault in /etc/inittab. If you assign the runlevel to S, the
system comes up, runs /.profile and gives you a boot prompt. So in
/etc/inittab:
is:S:initdefault

The .profile of root then only needs to contain the following:
mount -a
PATH=$PATH:/usr/local/bin
export PATH

mkdir /tmp/fdmns

/opt/install/inst

The mount -a command makes the memory filesystem for /tmp
The mkdir command makes the /etc/fdmns link valid
And the last command only applies to those of you who are interested
in that auto-install thing it all started with:-)

I then had two scripts, one to make the CD image and one to write the
CD. It is roughly about making an ISO9660 image, then
allign it on a kilobyte boundary and at last disklabel it, so it becomes
bootable. The script that makes the CD also copies my program into
/opt/install, but that only applies to those that are interested in that.
You are free to use your scissors.

lbr@dogbert /export/tools/CD/install> cat make_image
VERSION=1.4

IMAGE=install_cd-$VERSION.iso
if [ -f $IMAGE ]
then
        echo $IMAGE: already exists >&2
        exit 1
fi

cp install-$VERSION/* install_cd-$VERSION/opt/install
mkisofs -R -D -a -o $IMAGE install_cd-$VERSION
disklabel -w -t cdfs -f $IMAGE
echo "\0\c" | /usr/bin/dd bs=1024k conv=sync >> $IMAGE
lbr@dogbert /export/tools/CD/install>

lbr@dogbert /export/tools/CD/install> cat write_cd
if [ `ls *.iso 2>/dev/null | wc -w` = 0 ]
then
        echo "No image file *.iso found" >&2
        exit 1
fi

if [ `ls *.iso | wc -w` -gt 1 ]
then
        echo "More than one image file *.iso found" >&2
        exit 1
fi

echo "Ready to record(y/[n])\c"
read ANS

if [ "$ANS" = "y" ]
then
        cdrecord dev=5,0 speed=4 *.iso
fi

lbr@dogbert /export/tools/CD/install>

That is all about that.

I hope, I did not leave anything out, and that I have not done anything
obviously stupid. Comments are welcome. If you have problems, ask me
and I will try to help as good as I can, but I am no expert.

BTW. I made quite a nice disaster recovery CD that on backup would record
all the disk labels of the disks and then make a tape with these(and some other
information). Then, it would place vdumps of /, /usr and /var consecutively on
the tape. The trick was, that on recovery, the system would first boot on the CD,
then recover the labels of all disks, make new file domains for /, /usr and /var
and then boot the system into singleuser mode. Because first when the system
is booted and /var is operational, whatever licenses for ADVFS-UTILITIES or LSM
would be activated. At this time, /.profile would be exchanged with a
fake /.profile that drove the next phase which was to create all the file domains
and file sets (with whatever multi-volume and stuff needed). Then, the system
would exchange /.profile with the original and rename all entries in /etc/rc3.d that
had to do with Oracle, Sybase, xlogin, TeMip and so on. Finally, it would place
a pointer to the 3.rd phase in /sbin/rc3.d and reboot to multiuser mode. As the
system comes up in multiuser mode, phase 3 simply asks NSR to recover ALL
file sets belonging to the system and then reboot for the last time. All over and
done without operator intervention, just boot from the disaster CD. This has worked
fine at our greatest customer, but has some flaws: You cannot put in a new
ES40 with PCI cards put in differently as the original, because the kernel would
not be able to recognize the external devices. The recovery machine must be
identical to the original. I ask myself: why do we need anything else than
genvmunix?

If anybody are interested, you can have that as well.

Enjoy your summer holidays,
Lars Bro

Lars Bro | System Programmer - Denmark
email Lars.Bro@nettest.com | dir +45 72112405
NetTest DK | Kirkebjerg allé 90, Broendby, zip 2605 | DK
web www.nettest.com | tel +45 72112200 | fax +45 72 11 22 10



This archive was generated by hypermail 2.1.7 : Sat Apr 12 2008 - 10:48:46 EDT