Ubuntu is one of many Linux distributions with support for LVM, the Linux Logical Volume Manager. LVM is a disk partitioning scheme that brings a level of flexibility to disk management that is not possible with the traditional method. With LVM, you can, if necessary, increase the size of a partition online, that is, while the system is running, without unmounting the partition. You can also add another disk to the system if the old one becomes full. There are many more benefits that LVM offers, but the those two are more than enough reasons to consider using it.

This tutorial presents a step by step guide on how to install Ubuntu 11.04, the latest stable release, on an encrypted LVM file system. Why is it necessary to encrypt the disk? For the reasons detailed here, disk encryption protects your data from unauthorized physical access. Like LVM, there is no downside to encrypting your disk.

Because the edition of Ubuntu with the graphical installer does not have support for setting up LVM and disk encryption, you will have to use an Alternate Installer ISO image. You may download a CD or DVD version here.

If you are new to LVM, here a a few terms you need to understand:

  • Physical Volume (PV) – In LVM parlance, this is a disk or disk partition that has been initialized for use by LVM.
  • Volume Group (VG) – A virtual container for PVs. So, you create a PV, create a VG, then add the PV to the VG. You can add very many PVs to a VG. The size of a VG is the sum of the sizes of its member PVs.
  • Logical Volume (LV) – This is the equivalent of a disk partition. Just like you would create a partition from a disk, you carve out an LV from a VG. When carving out Logical Volumes, a rule of thumb is to allocate just enough space needed to install the system. If necessary, you can always increase or grow the size of an LV. You can also decrease or shrink it, but at the risk of losing data.

When using LVM, the installer creates one non-LVM partition for /boot, and two logical volumes – one for /, the root directory, and the other for Swap, disk space that the computer may use as virtual memory. In this tutorial, three logical volumes will be created – /, Swap and /home. Creating a separate LV for /home makes it a bit easier when you need to upgrade the system.

Ok, enough introduction. Let us get down to business. The tutorial starts at the disk detection phase. Four options are offered. The one of choose is Manual. Enter. Note this is not a graphical installer, so navigation is by keyboard. After making a selection, press the Enter key.
uLVM

This step shows the disk available. If there are more than one, select the primary one, the one you want to use. Enter.
uLVM1

You will see this only if the disk has not been initialized. Key to Yes, then Enter.
uLVM2

The disk has been initialized. Ready to create the first partition. Select it, then Enter.
uLVM3

We want to create a new partition. Enter.
uLVM4

The first partition will be mounted at /boot. This is where all bootloader-related programs will be installed. On a default installation of Ubuntu, the size of this partition is 258 MB. You may use the same size or go slightly higher. Many Linux distributions assign 500 MB to it. Enter.
uLVM4

If this is a standalone installation, the installer will always want to create the first partition as a primary partition. If you are attempting to dual-boot and there are, say, three primary partitions existing under the other OS, the installer will automatically create it as a logical partition. For this standalone installation, we will take the default. Enter.
uLVM6

Stick with the default here. Enter.
uLVM7

The tasks at this step is to specify the file system and the mount point. For the boot partition, ext2 is the default on Ubuntu. For the mount point, select /boot. Scroll down to “Done setting up the partition.” Enter.
uLVM8

With the boot partition out of the way, the next task is to initialize the remaining space for use by LVM. Select the free space, then create another partition like you did for the first partition. By default, the installer will attempt to set it up as a logical partition. For a standalone installation like this tutorial’s, you may change it to “primary.” If trying to dual-boot with another OS, you will likely want to take the default.
uLVM9

These are the choices available for the “Use as” step. You might be tempted to select “Physical volume for encryption,” but the correct option is “Physical volume for LVM.”
uLVM23

Here is what it should be when you are done specifying how you want to use this partition. Scroll to “Done setting up the partition.” Enter.
uLVM24