Linux VPS

LVM basics: grow a logical volume on a Linux VPS

Understand LVM physical volumes, volume groups and logical volumes, then extend a logical volume and its filesystem online after your VPS disk is enlarged.

AdvancedLinux VPS2 min read

LVM (Logical Volume Manager) puts a flexible layer between your disks and your filesystems, so you can grow volumes without repartitioning. AlmaLinux and Rocky Linux use LVM by default, and Ubuntu often does too. This guide explains the pieces and the most common job: using new space after a disk upgrade.

Before you start

  • Root or sudo access, and a recent backup (see back up a Linux VPS).
  • The extra space already added to the VPS disk, or a new disk attached.

The three LVM layers

  • Physical volume (PV): a disk or partition prepared for LVM, e.g. /dev/vda3.
  • Volume group (VG): a pool made from one or more PVs.
  • Logical volume (LV): a slice of the pool that holds a filesystem, like /dev/almalinux/root.
sudo pvs
sudo vgs
sudo lvs
lsblk

If lvs shows nothing, your server does not use LVM and you grow the partition and filesystem directly.

Grow the partition after a disk resize

If the disk got bigger but the PV partition did not, grow it. growpart comes from cloud-guest-utils (apt) or cloud-utils-growpart (dnf):

sudo growpart /dev/vda 3
sudo pvresize /dev/vda3

Using a new disk instead? Add it to the pool:

sudo pvcreate /dev/vdb
sudo vgextend almalinux /dev/vdb

Extend the logical volume and filesystem

Give all free space in the group to the root volume and resize the filesystem in one step:

sudo lvextend -r -l +100%FREE /dev/almalinux/root

-r resizes ext4 or XFS automatically, online, without unmounting. To add a fixed amount use -L +20G. Confirm with df -h /.

Note: Volume group names differ: almalinux, rl on Rocky Linux, ubuntu-vg on Ubuntu. Use the names vgs and lvs show.

Warning: XFS can grow but never shrink. Shrinking ext4 requires unmounting and is risky; plan sizes with growth in mind.

Troubleshooting

  • Insufficient free space: the VG has no free extents yet; run pvresize or vgextend first and check vgs.
  • NOCHANGE from growpart: the partition already fills the disk, or the VPS has not seen the new size yet; reboot from your control panel.
  • Space still missing in df: the filesystem was not resized; run sudo xfs_growfs / or sudo resize2fs /dev/mapper/....

Next steps

Was this guide helpful?

Still stuck?

Ask MdmHost AI for a quick answer, or open a ticket and our team will take a look. We are here 24/7.