I have been avoiding using LVM because I thought it is far too insecure as far as booting goes. This is because neither Lilo nor Grub can read a LVM. So in order to boot a Linux residing in a LVM that Linux must have a /boot in a Ext2/3 or Reiserfs filing system to host the kernels, initrd files and Grub. Once the kernel has been booted up it is up to the kernel to read the LVM and load the Linux.
As a growing up process I am now ready to tackle LVM and have managed to install two Red Hat distros ( Fedora 7 and Foresught 1.4.1) and a OpenSuse 10.3. It sounds great but the distros I couldn't install include Ubuntu, Xubuntu, DSL, Slamp64 (Slackware in 64 bit), Debian RC4 and also Mandriva 2008.
The first big hurdle I found is that many installers does not support LVM or would not load a driver to read it. My intention is to create one big Volume Group of 200Gb and then have as many logical volumes as the system would permit. I therefore create one logical volume for installing one distro. If a Linux installer does not support LVM then the LVM would not be mounted and so no installation is possible.
The second hurdle appears that some distros expect only one operationg system would use the entire Volume Group and so do not have a facility to create additional logical volumes during installaation. Making them to use the LVM is equivalent to formatting the partition, thereby destroying the existing logical volumes.
If I can't get a normal distro into a LVM then using LVM for multi Linux installation will have a limited application.
Just wonder has anybody had experience to share on installing several Linux into one LVM.
--------------------------------------------------------------------------------------------------------------------------
Detail of my approach
Use a Live CD to partition a 400Gb Pata hard disk and create sda1 5Gb as /boot and sda2 as LVM (using partition type 8e).
Code:
Disk /dev/sda: 400.0 GB, 400088457216 bytes
255 heads, 63 sectors/track, 48641 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 608 4883728+ 83 Linux
/dev/sda2 609 24923 195310237+ 8e Linux LVM
I installed Foresight first. Being a Red Hat distro it has a facility to edit the LVM. With which I could create my first logical volume and put Foresight inside. sda1 was formatted and mounted as /boot. When Foresight was booted after installation I made a directory /boot/LogVol01 and moved the content of /boot into there. To make it boot I edited the Grub's menu.lst to "source" the kernel and initrd files from the newly created directory. It booted successfully as expected.
For the second system, which is Fedora 7 I did the same thing, I edited the LVM to install Fedora into second logical volume. This time I insisted on the sda1 /boot partition not to be formatted. So /boot was reused. I then combined the booting instructions of Foresight and Fedora in the new menu.lst and saved a copy in /boot under the name of allin.lst. When both Fedora and Foresight booted satisfactorily I proceeded to install the next system
I repeated the same procedure as the second distro installation for Suse 10.3, again mounting sda1 as /boot but no formatting. A third logical volume was created and formatted to install Suse.
Finally I edit the menu.lst to boot all 3 systems. The latest menu.lst looks like this
Code:
title Foresight (2.6.22) @ LogVol01
root (hd0,0)
kernel /LogVol01/vmlinuz-2.6.22.4-0.0.1.smp.gcc3.4.x86.i686 ro root=/dev/VolGroup00/LogVol01 rhgb quiet
initrd /LogVol01/initrd-2.6.22.4-0.0.1.smp.gcc3.4.x86.i686.img
title Fedora (2.6.21-1.3194.fc7) in LogVol02
root (hd0,0)
kernel /LogVol02/vmlinuz-2.6.21-1.3194.fc7 ro root=/dev/VolGroup00/LogVol02 rhgb quiet
initrd /LogVol02/initrd-2.6.21-1.3194.fc7.img
title openSUSE 10.3 in LogVol03
root (hd0,0)
kernel /LogVol03/vmlinuz-2.6.20-2-default root=/dev/VolGroup00/3 vga=0x31a resume=/dev/VolGroup00/LogVol00 splash=silent showopts
initrd /LogVol03/initrd-2.6.20-2-default
I did not change the booting instruction except modifying the partition references (marked purple).
My /boot now looks like this
Code:
allin.lst
allin.lst~
backup_mbr
boot
grub
LogVol01
LogVol02
LogVol03
lost+found
The blue bits are directories.
Typically the /boot/LogVol01 was the original /boot and has the following files inside
Code:
config-2.6.22.4-0.0.1.smp.gcc3.4.x86.i686
initrd-2.6.22.4-0.0.1.smp.gcc3.4.x86.i686.img
System.map-2.6.22.4-0.0.1.smp.gcc3.4.x86.i686
vmlinux-2.6.22.4-0.0.1.smp.gcc3.4.x86.i686
vmlinuz-2.6.22.4-0.0.1.smp.gcc3.4.x86.i686
In the above I installed one distro into one logical volume.
Thus if other distros support LVM we could have a huge number of Linux installed into one LVM.