[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: How many Linux is enough for lilo!?



Quoting Viktor Lakics (lakicsv@usa.net):

> I run into a prob with lilo. I want to have two Linuxes on the same
> hard drive (root partitions /hda8 and /hda9 respectively) and have
> lilo on the MBR.
> 
> Whatever I do, lilo can only recognize the kernel from one root
> partition. I can have several kernels bootable by lilo, as long as
> the reside on the same root or boot (if you have a separate /boot
> partition) partition.

Unfortunately you haven't said what you are trying to do and what
error messages you get when it doesn't work. (What does "recognize"
mean?)

> Maybe i overlooked something, could anyone give me an exerpt from
> lilo.conf, where lilo boots two different Linux distro from two
> different root partition?

Well, firstly, you presumably recognise that there's only one MBR,
so the last instance of running /sbin/lilo (from any of your linuxes)
is the one that takes effect. Usually one would only run lilo from one
version, so that you only have to maintain one instance of
/etc/lilo.conf.

If your two kernels are each contained in their respective partitions,
hda8 and hda9, then both partitions must be mounted when you run
/sbin/lilo. For example, if you're running with hda8 as root,
hda9 might be mounted as /mnt, and the two kernels will be
image=/boot/kernel-for-hda8
and
image=/mnt/boot/kernel-for-hda9
(you can leave out "boot/" if there are symlinks in the respective
root directories.)

Next, how to set the root device for each kernel. There are two ways:
move the root= line from the global part of the file (you've probably
got it near the top) and put it into each image= paragraph:

image=/boot/kernel-for-hda8
    root=/dev/hda8
    read-only
    ... etc.

image=/mnt/boot/kernel-for-hda9
    root=/dev/hda9
    ... etc.

The other method is to leave it out altogether and use rdev on each
kernel to set the device, e.g.

rdev /mnt/boot/kernel-for-hda9 /dev/hda9
(assuming you can write to /dev/hda9)
Actually there's no harm in doing both.

Obviously you leave the boot= line alone:

boot=/dev/hda

as this determines where lilo writes the boot sector, to the MBR.

What happens when you run /sbin/lilo is that lilo sees where all the
kernels are (in terms of filesystems on partitions), works out where
they are physically on the disk (in terms of blocks) and builds a
map of those blocks. It also notes down the corresponding root
devicenames (and all the other info in the image= paragraph).

When you boot and the MBR runs, the kernel is loaded by block numbers
off the disk, and any root= value is applied. If there wasn't a root=
then it uses a magic offset in the kernel just loaded (which is
what you can set with rdev).

If you have a huge disk, it makes sense to collect all the kernels
into the "classic" /boot partition near the start. But kernels can
be placed in all sorts of different partitions/filesystems so long
as /sbin/lilo can see them all mounted (and listed in /etc/lilo.conf)
when you run it.

Hope that makes sense.

Cheers,

-- 
Email:  d.wright@open.ac.uk   Tel: +44 1908 653 739  Fax: +44 1908 655 151
Snail:  David Wright, Earth Science Dept., Milton Keynes, England, MK7 6AA
Disclaimer:   These addresses are only for reaching me, and do not signify
official stationery. Views expressed here are either my own or plagiarised.



Reply to: