Installing Ubuntu with LVM on a single volume group that spans multiple physical partitions
Getting ready
Boot into Ubuntu from a live USB or live CD and open a terminal window (ctrl+alt+T). For convenience sake, run sudo -i
to change to root
. We'll be working in this terminal window to set up LVM.
LVM Setup
Just to demonstrate that my setup matches that in the question, here's what fdisk -l /dev/sda
shows in my VM
Disk /dev/sda: 100 GiB, 107374182400 bytes, 209715200 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x4856d148
Device Boot Start End Sectors Size Id Type
/dev/sda1 2048 52430847 52428800 25G 0 Empty
/dev/sda2 52430848 157288447 104857600 50G 7 HPFS/NTFS/exFAT
/dev/sda3 157288448 209715199 52426752 25G 0 Empty
In answer to the question, and using the same partition structure specified, run the following commands:
pvcreate /dev/sda1 /dev/sda3
<-- Specify all partitions you want to pool for install. These need not necessarily be on the same physical disk.
vgcreate vg0 /dev/sda1 /dev/sda3
<-- Here, vg0
is an arbitrary name for the volume group
- At this point we can run
vgs
and see that we have a 50G (reported as 49.99g) to work with. Now we need to create some logical volumes onto which we'll install Ubuntu. I'm only going to create root and swap partitions, but you could create other partitions as well if, for example, you wanted a separate home partition.
lvcreate --name swap --size 4G vg0
<-- this creates a 4G parition I'll use for swap
lvcreate --name root --extents 100%free vg0
<-- this creates a new partition that uses all of the remaining space in vg0. We'll use this as our /
(root) partition.
That's it for setting up LVM. Now it's time to install Ubuntu.
Ubuntu installation
Run the installer from the live OS to begin installation. When you get to the section titled Installation type select the something else option

Then you assign mount points to the logical volumes we created so that Ubuntu can install the system.

Dual booting
As the install is finishing, grub should install, detect Windows and setup a boot menu that will allow you to boot into either OS.