nedson.net | links | pgp

Notes: Logical Volume Management

I have resisted the urge to use Logical Volume Management (LVM). LVM adds a bit of complexity that I have purposely avoided using and learning about. I have used LVM when doing a Debian install with the root filesystem encrypted. Everything "just works" and I have blissfully ignored the underlying Debian setup. Fast forward to today...I have been reading about setting up full disk encryption with Gentoo and realized that I didn't fully understand LVM. LVM is kind of necessary for an encrypted system unless you want to, at minimum, enter a password for your root filesystem and another for swap. LVM gives you many options...a good way to think about LVM, I think, is 'dynamic partitioning'.

Here is a breakdown of the layers of LVM:

Steps to Add a New Logical Volume

1. Install a new hard drive
2. Create a physical volume
3. Assign the physical volume to a volume group (or create a new one)
4. Create a new logical volume from space in the volume group
5. Add the drive details to /etc/fstab
6. Mount the filesytem!

Here is an example:

Create the physical volume from drive /dev/sdc1 (1 partition has been made: sdc1)
$ pvcreate /dev/sdc1

Assign the physical volume to a volume group
$ vgcreate new_volume_group /dev/sdc1

Create the logical volume
$ lvcreate -l 100%VG -n root new_volume_group

After these commands, the logical volume should be accessed at /dev/mapper/new_volume_group-root. Now a files system can be created and the logical volume can be mounted).


contact: nme at nedson.net