[NCLUG] Re: LILO on fragile flies
Aaron D. Johnson
adj at ccltd.com
Sun Nov 11 22:21:50 MST 2001
In message <20011111022602.42241.qmail at web14105.mail.yahoo.com>, Person Who Asked To Have Her Name Removed From The Internet writes
> i tried both options, and it only now does:
>
> LILO 21.7-5 boot: win
> Loading win
> _
>
> then stuck there until hard reboot
> other=/dev/hdb1
> table=/dev/hdb
> label=WIN
>
> OR
> other=/dev/hdb1
> table=/dev/hda
> label=WIN
>
> note, after changing lilo.conf i did run 'lilo'
> also note that my boot option is set as follows:
>
> boot=/dev/hda
>
> I can still get Linux to boot fine.
>
> help?
I'll try.
Here's what I'd do. Recognizing that Microsoft never considered the
possibility that someone would want to put Windows on their second
hard drive, and that Linux doesn't care where you're booting it from
(as long as it can tell where to find its root filesystem), the path
of least resistance is going to be putting Windows on the first drive.
Here's a recipe:
0) Print all this out. It will come in handy when your computer is
off and you need to read it.
1) Make a note of what device your root filesystem is on. Running
the mount command should tell you this, but also try looking for a
"root=" line in your lilo.conf.
2) Insert a floppy disk and copy a kernel image to it. The kernel
image will be referenced in your lilo.conf file. A line starting
with "image=" will end with a filename. Copy that file to the
floppy like so:
dd of=/dev/fd0 bs=9k if=FILENAME
(Replace FILENAME with the file referenced in your lilo.conf.
/dev/fd0 should be your floppy drive. The "bs=9k" thing tells dd
what size blocks to write out at once. 9K is a single track on a
standard format 1.44Mbyte floppy and just works well when a floppy
is what you're writing to.)
3) Now you'll need to tell the kernel of the floppy what its root
filesystem should be. There's a program called rdev that does
this. It probably lives in /usr/sbin or /sbin on your machine:
/usr/sbin/rdev /dev/fd0 ROOTDEV
Replace ROOTDEV with the root device you discovered in step 1.
4) Try out the boot floppy. Reboot the computer with the floppy
still in the drive. You may have to fiddle with some BIOS
settings to get your PC to boot from the floppy. You'll see a
message with a bunch of '.'s going slowly by before the normal
kernel startup messages if the kernel is being loaded from the
floppy disk. Also, the floppy light will be on for a while. You
shouldn't see a "LILO" prompt.
5) If Linux doesn't come up, remove the floppy from drive, reboot,
and send a note to the mailing list. We'll have to do some
diagnosis.
6) If you get this far, congratulations! You've just
established that you can boot Linux from a floppy disk. Next step
is to make a second Linux boot floppy which can brong Linux up on
the second hard drive. Repeat step 2 with a different floppy in
the drive:
dd of=/dev/fd0 bs=9k if=FILENAME
Replace FILENAME with the same thing you used in step 2.
7) Now, use rdev and to set the root filesystem as the same partition
on the second disk. This is pretty simple. ROOTDEV from step 3
should have been something like "/dev/hda1", "/dev/hda2", or
"/dev/hda5" (the number will be specific to your installation).
ROOTDEV will be the same thing, except replace the "hda" with
"hdb". If you used "/usr/sbin/rdev /dev/fd0 /dev/hda1" in step 3,
use "/usr/sbin/rdev /dev/fd0 /dev/hdb1" this time.
8) Repeat step 4, trying out the new boot floppy. You'll probably
get an error message about not being able to mount the root
filesystem or being unable to find init. This is expected and
shows that you're looking at the other hard drive.
9) Swap the hard drives around so that the Windows drive is the first
one and the Linux drive is the second. There are a couple of
possible ways to do this. Either way, you'll need to get a look
at the jumpers on both of the hard drives and the labels or
booklets for the drives that say what jumper combinations do what.
Take note of which drive is plugged in to which connector on the
IDE ribbon cable and of the jumper settings on both drives. In
case this doesn't work out, you'll want to restore them to the way
they were.
What you want to accomplish is setting the present "primary" or
"master" drive to be the "secondary" or "slave" drive and vice
versa. If the jumpers on both drives are set to "cable select,"
you'll just need to swap the drives' positions on the IDE ribbon
cable and you'll be done. Otherwise, you'll need to move the
jumpers around to affect this change.
Make sure everything is plugged back in.
10) Boot the machine with boot floppy number two removed. If
everything works out nicely, Windows will come up. If it doesn't
put things back as they were before step 9 and send a note to the
mailing list. We'll need to figure out what went wrong.
11) Boot the machine with boot floppy number two inserted. Linux
should come up. Possibly with a few error messages you'll fix in
the next step.
12) Now you need to fix up your /etc/fstab file, which may no longer
reflect reality. Make a backup copy of /etc/fstab and change any
references to /dev/hdaN in the real copy to /dev/hdbN. These will
only be located in the first column of the file and may not be
present at all.
This is the first point where your hard disks' contents is
actually changed.
13) Reboot again with boot floppy two still in the drive. Any errors
about being unable to mount this or that filesystem should be
gone.
14) Next, you'll be telling LILO to boot Linux off of the second disk
instead of the first, and Windows from the first disk:
# make a backup of /etc/lilo.conf
cp -p /etc/lilo.conf /etc/lilo.conf.keep
# Edit /etc/lilo.conf
# Change lines reading "root=/dev/hdaN" to "root=/dev/hdbN"
# to "/dev/hdbN". Don't change the "boot=/dev/hda" option.
# Remove or comment out any "table" lines.
vi /etc/lilo.conf
# Run lilo, see if there's any problem
/sbin/lilo || echo Something went wrong.
If you're not comforatble with vi, use whatever editor you are
comfortable with. When you're done editing, you're Windows
section should look something like this:
other=/dev/hda1
label=win
You'll get the "Something went wrong." message if lilo thinks
something didn't work out right. If that happens, send some mail
to the list and we'll get you straightened out. You should still
be able to boot Linux from floppy and Windows from the hard disk
if something bad happens.
15) Remove boot floppy two and reboot. You should be able to do Linux
and Windows now. Hopefully. Booting is probably the most fragile
aspect of Linux...
Feel free to ask for clarification about anything I've written above
before you try this out.
- Aaron
More information about the NCLUG
mailing list