As I recently “reorganized” the partitioning scheme on my desktop system to gain some space for my flac music files I also changed the linux partitions to further run from logical volumes. To install Ubuntu on logical volumes you need to run the alternate installer - which in my case pretty much failed. I don’t know why, but half the way of copying the new system the installer insisted on putting in the CD medium (which of course was still in the drive) and no matter what option I chose - “Continue” or “Cancel” - the request wouldn’t go away. This was the first time an Ubuntu installer didn’t work out for me. Still wanting to install Ubuntu’s latest release I came across a post in Linux Mint’s (another Ubuntu offspring) forum, describing how to install Linux Mint with lvm2. See the original post by piratesmack (thanks!) here. I more or less followed this howto.
So, this is how it worked for me, but: PLEASE KEEP IN MIND THAT MESSING WITH PARTITIONS MAY CAUSE DATA LOSS!!! SO BACK UP YOUR DATA!!!
Having that said, let’s begin by getting the default Ubuntu Lucid Lynx desktop live iso from here, burn it to CD and boot from it. When you’re being asked to either try it out or install Ubuntu, go for the first option. Once the desktop is loaded, open a terminal from the “Applications” menu and install lvm2:
As I already created logical volumes with the alternate installer, all I had to do is activate them:
If you don’t have your logical volumes created already, do so now. I guess if you want/need logical volumes you know what you’re doing, but this is roughly how it would work:
- Prepare the harddrive(s) with
sudo fdisk /dev/sdX, you need at least one partition with type set to “e8”
- Create a physical volume:
sudo pvcreate /dev/sdXY(do that for every partition you’ve created in step 1 with type set to “e8”).
- Create a volume group:
sudo vgcreate <VOLGROUPNAME> /dev/sdXY /dev/sdZY(if you want to have multiple disks in the group)
- Create the logical volumes within the volume group:
sudo lvcreate -L <SIZE, i.e. 25G> -n <VOLNAME> <VOLGROUPNAME>
- Activate the newly created volumes:
sudo vgscan --mknodes && sudo vgchange -ay
- Format the volumes:
sudo mkfs.ext4 /dev/mapper/<VOLGROUPNAME>-<VOLNAME>
Now close the terminal, start the Ubuntu installer and go on as usual. Remember to choose the “Custom partitioning” option when the installer asks for the disk layout. From here you can choose your logical volumes and assign mount points. Once the install is finished** DO NOT REBOOT**, but click “Continue testing”. As the newly installed system lacks lvm2 we need to add it now by setting up a chroot environment.
Open a terminal again and mount your root partition (please adjust the devices accordingly):
Once done, mount all other devices including the virtual filesystems:
Now install lvm2:
And now choose to reboot from the applet at the upper right corner. If everything went well you should then be running Lucid Lynx with lvm support!