--- title: "How to Extend an LVM Logical Volume on Ubuntu 24.04" description: "Extend an LVM logical volume and its ext4 or XFS filesystem online on Ubuntu 24.04 using free space in the volume group, a grown disk or a newly added disk." category: "Storage Management" language: en source: https://cubepath.com/docs/storage-management/how-to-expand-lvm-partitions updated: 2026-09-25 --- # How to Extend an LVM Logical Volume on Ubuntu 24.04 LVM (Logical Volume Manager) puts a flexible layer between your disks and your filesystems, so you can grow a volume without repartitioning or unmounting it. In this tutorial you will inspect an LVM setup and extend a logical volume and its filesystem online on Ubuntu 24.04 in the three situations you will actually meet: the volume group already has free space, the underlying disk has been enlarged, or you add a new disk. ## Prerequisites To follow this guide you need: - A server running Ubuntu 24.04 LTS that uses LVM, with a non-root user that has `sudo` privileges. Ubuntu Server installs from the ISO use LVM by default; many cloud images do not. Step 1 shows how to check. - A recent backup of the data on the volume. Growing a volume is a safe, routine operation, but a typo in a device name is not. - Console access to the server is recommended if you are working on the root volume. ## How LVM is organized LVM has three layers. You grow them from the bottom up: | Layer | Command to inspect | What it is | |-------|--------------------|------------| | Physical volume (PV) | `pvs` | A disk or partition prepared for LVM, for example `/dev/sda3` | | Volume group (VG) | `vgs` | A pool of space made from one or more PVs, for example `ubuntu-vg` | | Logical volume (LV) | `lvs` | A slice of the VG that holds a filesystem, for example `ubuntu-lv` mounted on `/` | A logical volume can only grow into free space in its volume group. The volume group only grows when a physical volume grows or a new one is added. ## Step 1 - Inspecting the current layout First, check whether the filesystem you want to extend sits on LVM: ```bash df -hT / ``` ```output Filesystem Type Size Used Avail Use% Mounted on /dev/mapper/ubuntu--vg-ubuntu--lv ext4 48G 41G 4.9G 90% / ``` A `/dev/mapper/...` device means LVM. If you see `/dev/vda1` or `/dev/sda1` instead, the filesystem is on a plain partition and you only need `growpart` and `resize2fs`, not this guide. Show the whole storage tree: ```bash lsblk ``` ```output NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS sda 8:0 0 100G 0 disk ├─sda1 8:1 0 1M 0 part ├─sda2 8:2 0 2G 0 part /boot └─sda3 8:3 0 98G 0 part └─ubuntu--vg-ubuntu--lv 252:0 0 49G 0 lvm / ``` Then look at each LVM layer: ```bash sudo pvs sudo vgs sudo lvs ``` ```output PV VG Fmt Attr PSize PFree /dev/sda3 ubuntu-vg lvm2 a-- <98.00g <49.00g VG #PV #LV #SN Attr VSize VFree ubuntu-vg 1 1 0 wz--n- <98.00g <49.00g LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert ubuntu-lv ubuntu-vg -wi-ao---- <49.00g ``` The `VFree` column tells you which step applies: - **`VFree` is greater than zero:** the space is already in the volume group. Go to Step 2. - **The disk is bigger than its partitions** (for example, `lsblk` shows `sda` at 150G but `sda3` at 98G): go to Step 3. - **You attached a new disk:** go to Step 4. The output above is a very common case: the Ubuntu Server installer only allocates part of the volume group to `ubuntu-lv` and leaves the rest free. ## Step 2 - Extending a volume using free space in the volume group Use `lvextend` with `-l +100%FREE` to give the logical volume all the free space in its group, and `-r` (`--resizefs`) to grow the filesystem in the same command. `-r` detects whether the filesystem is ext4 or XFS and calls the right tool, and both can be grown while mounted: ```bash sudo lvextend -r -l +100%FREE /dev/ubuntu-vg/ubuntu-lv ``` ```output Size of logical volume ubuntu-vg/ubuntu-lv changed from <49.00 GiB (12543 extents) to <98.00 GiB (25087 extents). Logical volume ubuntu-vg/ubuntu-lv successfully resized. resize2fs 1.47.0 (5-Feb-2023) Filesystem at /dev/mapper/ubuntu--vg-ubuntu--lv is mounted on /; on-line resizing required old_desc_blocks = 7, new_desc_blocks = 13 The filesystem on /dev/mapper/ubuntu--vg-ubuntu--lv is now 25689088 (4k) blocks long. ``` To add a fixed amount instead of all the free space, use `-L`, for example `sudo lvextend -r -L +20G /dev/ubuntu-vg/ubuntu-lv`. Keeping some free space in the volume group is useful if you have several logical volumes or plan to use LVM snapshots. Verify the new size: ```bash df -h / sudo vgs ``` ```output Filesystem Size Used Avail Use% Mounted on /dev/mapper/ubuntu--vg-ubuntu--lv 97G 41G 52G 45% / VG #PV #LV #SN Attr VSize VFree ubuntu-vg 1 1 0 wz--n- <98.00g 0 ``` ## Step 3 - Extending after the disk has been enlarged When the virtual disk behind the server gets bigger, for example after moving to a larger plan, LVM does not see the extra space until you grow the partition and then the physical volume. ### Making the kernel see the new disk size Check the disk size with `lsblk`. On virtio disks (`vda`) the new size usually appears on its own. On SCSI or SATA disks (`sda`), ask the kernel to rescan the device: ```bash echo 1 | sudo tee /sys/class/block/sda/device/rescan lsblk /dev/sda ``` ```output NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS sda 8:0 0 150G 0 disk ├─sda1 8:1 0 1M 0 part ├─sda2 8:2 0 2G 0 part /boot └─sda3 8:3 0 98G 0 part └─ubuntu--vg-ubuntu--lv 252:0 0 98G 0 lvm / ``` The disk is now 150G, but `sda3` is still 98G. ### Growing the partition `growpart` extends a partition to the end of the disk while it is in use. It comes with the `cloud-guest-utils` package: ```bash sudo apt install cloud-guest-utils sudo growpart /dev/sda 3 ``` ```output CHANGED: partition=3 start=4198400 old: size=205516767 end=209715166 new: size=310374367 end=314572766 ``` The partition number is a separate argument: `/dev/sda 3`, not `/dev/sda3`. `growpart` only works on the last partition of the disk. ### Growing the physical volume and the logical volume Tell LVM that the physical volume is now bigger: ```bash sudo pvresize /dev/sda3 ``` ```output Physical volume "/dev/sda3" changed 1 physical volume(s) resized or updated / 0 physical volume(s) not resized ``` The new space is now free in the volume group. Check it and extend the logical volume exactly as in Step 2: ```bash sudo vgs sudo lvextend -r -l +100%FREE /dev/ubuntu-vg/ubuntu-lv df -h / ``` ```output Filesystem Size Used Avail Use% Mounted on /dev/mapper/ubuntu--vg-ubuntu--lv 146G 41G 99G 30% / ``` ## Step 4 - Extending by adding a new disk If you cannot enlarge the existing disk, add a second one to the volume group. Identify it first; it should have no partitions and no mount point: ```bash lsblk ``` ```output NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS sda 8:0 0 100G 0 disk ├─sda1 8:1 0 1M 0 part ├─sda2 8:2 0 2G 0 part /boot └─sda3 8:3 0 98G 0 part └─ubuntu--vg-ubuntu--lv 252:0 0 98G 0 lvm / sdb 8:16 0 50G 0 disk ``` > Warning: `pvcreate` erases any data on the disk you give it. Make sure `sdb` is the new, empty disk. Initialize the whole disk as a physical volume: ```bash sudo pvcreate /dev/sdb ``` ```output Physical volume "/dev/sdb" successfully created. ``` Add it to the volume group: ```bash sudo vgextend ubuntu-vg /dev/sdb ``` ```output Volume group "ubuntu-vg" successfully extended ``` Confirm the group has two physical volumes and new free space, then extend the logical volume: ```bash sudo vgs sudo lvextend -r -l +100%FREE /dev/ubuntu-vg/ubuntu-lv ``` ```output VG #PV #LV #SN Attr VSize VFree ubuntu-vg 2 1 0 wz--n- 147.99g <50.00g ``` After this, the logical volume spans both disks. Losing either disk damages the whole volume, so on a production server put the extra space on redundant storage (for example a RAID 1 array created with `mdadm`) or make sure your backups are current. ## Step 5 - Verifying the result Check each layer and the filesystem: ```bash sudo pvs sudo vgs sudo lvs df -hT / ``` If you extended the volume without `-r`, the logical volume is bigger but the filesystem is not. `df` shows the old size in that case. Grow the filesystem by hand: ```bash sudo resize2fs /dev/ubuntu-vg/ubuntu-lv ``` For XFS, pass the mount point instead of the device: ```bash sudo xfs_growfs / ``` ## Troubleshooting **`Insufficient free space: ... extents needed, but only 0 available`.** The volume group has no free space. Follow Step 3 or Step 4 to add space to the group first. **`df` still shows the old size after `lvextend`.** The filesystem was not resized. Run `resize2fs` (ext4) or `xfs_growfs` (XFS) as shown in Step 5. **`pvresize` reports no change.** The partition was not grown or the kernel still sees the old size. Check `lsblk`; run the rescan and `growpart` from Step 3, then `pvresize` again. **`NOCHANGE: partition 3 is size ... it cannot be grown`.** The disk has not grown from the kernel's point of view, or the LVM partition is not the last one on the disk. Rescan the disk, and if another partition sits after it, add a new partition or disk as a separate physical volume instead. **You want to make a volume smaller.** ext4 can be shrunk only while unmounted (`lvreduce -r` handles it) and XFS cannot be shrunk at all. Plan sizes with room to grow instead of allocating everything up front. ## Conclusion You inspected the PV, VG and LV layers and extended a logical volume and its filesystem online using free space, a grown disk and a new disk. As next steps, create separate logical volumes for data such as `/var/lib/mysql` from the remaining free space, try LVM snapshots (`lvcreate -s`) before risky upgrades, and set up disk usage alerts so you extend volumes before they fill up.