Lucid desktop install with lvm2

2 minute read

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.


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:

$ sudo apt-get update
$ sudo apt-get install lvm2

As I already created logical volumes with the alternate installer, all I had to do is activate them:

$ sudo vgchange -ay

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:

  1. Prepare the harddrive(s) with sudo fdisk /dev/sdX, you need at least one partition with type set to “e8”
  2. Create a physical volume: sudo pvcreate /dev/sdXY (do that for every partition you’ve created in step 1 with type set to “e8”).
  3. Create a volume group: sudo vgcreate <VOLGROUPNAME> /dev/sdXY /dev/sdZY (if you want to have multiple disks in the group)
  4. Create the logical volumes within the volume group: sudo lvcreate -L <SIZE, i.e. 25G> -n <VOLNAME> <VOLGROUPNAME>
  5. Activate the newly created volumes: sudo vgscan --mknodes && sudo vgchange -ay
  6. 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):

$ sudo mount /dev/mapper/volgrp0-rootlv /mnt

Once done, mount all other devices including the virtual filesystems:

$ sudo mount /dev/mapper/volgrp0-homelv /mnt/home
$ sudo mount /dev/sda2 /mnt/boot #(/boot is extremely crucial!)
$ sudo mount --bind /dev /mnt/dev
$ sudo mount --bind /dev/pts /mnt/dev/pts
$ sudo mount --bind /proc /mnt/proc

Now install lvm2:

$ sudo chroot /mnt apt-get update
$ sudo chroot /mnt apt-get install lvm2

Umount everything:

$ sudo umount /mnt/proc  /mnt/dev/pts /mnt/dev /mnt/boot /mnt/home /mnt

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!