Logical Volume Management(LVM)
LVM allows multiple disks or partitions to be combined into a storage pool and divided into logical volumes.
- Provides flexible storage management
- Allows logical volumes to be extended without directly modifying physical disk partitions
- Makes it easier to add storage when needed
LVM Components
- PV (Physical Volume)
- A disk or partition initialized for LVM
- Example: /dev/nvme1n1
- VG (Volume Group)
- Combines one or more PVs into a storage pool
- Example: docker_vg combines multiple PVs
- LV (Logical Volumes)
- Allocates storage from a VG to create usable volumes
- Example: docker_lv
Key Benefits
- Combine multiple disks into one storage pool
- Create multiple logical volumes from a VG
- Add more PVs to increase VG capacity
- Extend LVs when the VG has enough free space, or after adding more storage
- Mount LVs to directories such as /docker or /postgres
Add a Disk and Create an LVM Partition
-
Install LVM utilities
For RHEL, AlmaLinux, Rocky Linux, or Amazon Linux 2023:
dnf install lvm2 -y
Verify:
pvdisplay --help
-
Check available disks
Run it before adding a new disk
fdisk -l lsblk
Run the following command once more time after adding a new disk.
fdisk -l lsblk
Identify the new disk, for example,/dev/nvme1n1 -
Create an LVM partition
fdisk /dev/nvme1n1Inside fdisk:
- n – Create a new partition
- Accept the default partition number and sector ranges, if appropriate.
- t – change the partition type
- 8e – set the partition type in Linux LVM
- w – Write changes and exit


Verify:
lsblk
If you accidentally make a mistake and want to delete the partition and recreate it, please visit this page.
-
Create a Physical Volume (PV)
pvcreate /dev/nvme1n1p1
Display PV information
pvdisplay pvs
-
Create a Volume Group (VG)
vgcreate docker_vg /dev/nvme1n1p1
Display VG information
vgdisplay vgs
-
Create a Logical Volume (LV)
Create a 1 GB logical volume named
docker_lv:lvcreate -n docker_lv --size 1G docker_vg
Verify
lvdisplay lvs
-
Create a Logical Volume (LV)
Create a 1 GB logical volume named
docker_lv:lvcreate -n docker_lv --size 1G docker_vg
Verify
lvdisplay lvs
-
Create an XFS filesystem
mkfs.xfs /dev/docker_vg/docker_lv
-
Create a mount point and mount the LV
mkdir -p /docker mount /dev/docker_vg/docker_lv /docker
Verify
df -hT lsblk
- df -hT – shows mounted filesystems, their sizes, usage, and filesystem types
- lsblk – shows the disk, partition, and LVM structure
-
Mount the LV automatically at boot
-
Get its UUID
blkid /dev/docker_vg/docker_lv
-
Edit
/etc/fstabAdd a line using the actual UUID by
blkid:vi /etc/fstab
Important: Replace the example UUID with your actual UUID
-
Reload
systemctl daemon-reload
-
Test the configuration
umount /docker mount -a df -Th /docker
If the commands succeed, the filesystem should mount correctly, and
/etc/fstabwill configure it to mount automatically at boot.
-
Recommendation: Read Next: How to extend disk using LVM after proceeding with the steps above.