Hypothetically speaking, say I have a system with the following configuration

  • One hard drive (/dev/sda) partitioned as...
    • /dev/sda1: 25G unused space
    • /dev/sda2: 50G Windows partition
    • /dev/sda3: 25G unused space

Now I want to combine all of the unused space using LVM so that I have the full 50G available to me for my Ubuntu installation. I don't want to use /dev/sda1 and /dev/sda2 as separate 25G partitions. How can I go about configuring LVM and performing the installation so that I can run Windows and Ubuntu post-install?


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.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.