LVM (Logical Volume Manager) provides flexible disk management by abstracting physical storage into logical volumes that can be resized, snapshotted, and moved. This guide explains how to create and manage LVM volumes on Ubuntu 24.04 LTS.

Tested and valid on:

  • Ubuntu 24.04 LTS

Prerequisites

  • Ubuntu 24.04 LTS server
  • One or more additional block devices (e.g. /dev/sdb, /dev/sdc)
  • A user with sudo privileges

Step 1 – Install LVM2

LVM2 is usually pre-installed. Verify:

sudo apt install lvm2 -y
pvdisplay

Step 2 – Create Physical Volumes

Initialise disks as LVM physical volumes:

sudo pvcreate /dev/sdb /dev/sdc
sudo pvdisplay

Step 3 – Create a Volume Group

Combine physical volumes into a volume group:

sudo vgcreate myvg /dev/sdb /dev/sdc
sudo vgdisplay

Step 4 – Create Logical Volumes

Create a logical volume using all available space:

sudo lvcreate -l 100%FREE -n mylv myvg
sudo lvdisplay

Step 5 – Format and Mount

Create a filesystem and mount the logical volume:

sudo mkfs.ext4 /dev/myvg/mylv
sudo mkdir /mnt/data
sudo mount /dev/myvg/mylv /mnt/data

Step 6 – Add to /etc/fstab

Make the mount persistent:

echo '/dev/myvg/mylv /mnt/data ext4 defaults 0 2' | sudo tee -a /etc/fstab

Step 7 – Extend a Logical Volume

Resize the logical volume and its filesystem:

sudo lvextend -L +10G /dev/myvg/mylv
sudo resize2fs /dev/myvg/mylv

Step 8 – Create a Snapshot

Take a point-in-time snapshot for backup:

sudo lvcreate -s -n mylv_snap -L 5G /dev/myvg/mylv

Conclusion

LVM is now configured on Ubuntu 24.04 LTS. Logical Volume Manager gives you the flexibility to resize storage online without downtime — essential for database servers and high-growth applications.