Lvm

Lvm is a solution to manage multiple disks and partition under a linux system. It allows to create logical volumes that can span across multiple physical disks, and to resize them on the fly without unmounting them.

Core concepts

LVM manages 3 entities:

flowchart TD PV1@{label: "Physical Volume 1 /dev/sda", shape: "cylinder"} PV2@{label: "Physical Volume 2 /dev/sdb1", shape: "cylinder"} VG1[Volume Group 1] LV1[Logical Volume 1] LV2[Logical Volume 2] PV1 --> VG1 PV2 --> VG1 VG1 --> LV1 VG1 --> LV2

Extend a logical volume after extending a physical volume

To extend a physical volume, run the following

pvresize /dev/sda1

Given a physical volume that has been extended, the logical volume can be extended like this

lvextend -l +100%FREE /dev/vg1/lv1