This is something very much not trivial. Let's assume you've two (or more) disks. You create a partition with the same size on each and create a RAID volume from them. You create an LVM volume group on this RAID volume and create one (or more) logical volume(s) in it. The point is that you have the "/boot" directory in a logical volume in the RAID volume and boot the system from it.
The default bootloader in Ubuntu is Grub. However (AFAIK) Grub does not support the above configuration. It can be used if you've "/boot" as a separate partition outside the LVM volume group, but still in the RAID volume ... but it does not support booting from an LVM partition that is on a software RAID volume. Of course all is not lost: LILO can be used in this case. In fact, the Ubuntu installer is smart enough to detect this (if you've created a partitioning scheme similiar to the one above) and automatically chooses LILO for you.
I tried to dig up some info on how to set up
lilo.conf
to support the above configuration, but I could not find a thing. On the other hand, I already knew that the Ubuntu installer (or some script/app that it calls) can create a proper lilo.conf, so downloaded the latest Ubuntu Server ISO and installed it into a virtual machine ... just to get the
lilo.conf
after the installation completed successfully.
Here're the important parts from the config:
# The boot block will be installed on the RAID volume. LILO will automatically
# detect that this is a RAID volume device file and it will install the proper
# boot sector on each disk/partition that is part of the RAID volume.
boot=/dev/md0
# Without the following option you'd get a "Fatal: map file must be on the boot RAID partition" error.
# I tried specifying the devices in the RAID volume (/dev/sda, /dev/sdb) here, but it did not work.
# So you _must_ use the "mbr-only" value.
raid-extra-boot=mbr-only
# The tricky part (that I did not find on the net) is the per-image section.
# You've to use the "/dev/mapper/*" notation of the logical volume since that's the one that is
# available to the kernel. The "/dev/vg01/root" path is created later during the boot process.
image=/vmlinuz
initrd=/initrd.img
root=/dev/mapper/vg01-root
label=Linux
read-only
I've attached the generated
lilo.conf
so you can take a look at the whole file.
The example config (both above and in the attached
lilo.conf
) assumes the following setup:
- there're two disks: /dev/sda and /dev/sdb
- each of both disks have one single primary partition, which are organized into a single RAID1 volume (/dev/md0)
- there's a single LVM volume group (vg01) on this RAID volume and a single partition ("root") in that volume group
- the whole OS (Ubuntu) is installed into that LVM logical volume (/dev/vg01/root) including the
/boot
directory
Of course in practice you would most probably have several other logical volumes (for the various parts of the filesystem like
/usr
,
/tmp
,
/var
,
/var/log
, etc.), but they're irrelevant for the boot process. Only the partition of
/boot
matters for setting up the boot loader.
Comments
This helped me today!
Today, it helped me sort out a similar issue on a Slackware 13 server.
Cheers from Ukraine.