Skip to content

Expand an LVM Volume and Filesystem Online

When a Linux filesystem approaches capacity, LVM can add space from a newly provisioned disk without moving the existing mount. This example adds an empty /dev/sdb to vg_app and grows /dev/vg_app/lv_data. Device and volume names vary; verify every mapping before changing storage.

Take or verify a backup and confirm that the new device contains no data you need. The pvcreate command writes LVM metadata to the selected device.


01

Identify the Filesystem and Candidate Device

Pre-change Check

Trace the mount point to its logical volume and confirm the candidate disk is the newly attached empty device. Compare size, serial, signatures, and the provisioning record; do not infer identity from its device name alone.

Terminal window
findmnt /srv/app
df -hT /srv/app
lsblk -o NAME,SIZE,TYPE,FSTYPE,MOUNTPOINTS,SERIAL
pvs
vgs
lvs -a -o +devices
❯ View Expected Console Output
NAME SIZE TYPE FSTYPE MOUNTPOINTS
sda 80G disk
└─sda2 60G part LVM2_member
└─vg_app-lv_data 40G lvm xfs /srv/app
sdb 100G disk
Linux terminal showing lsblk and LVM physical volume, volume group, and logical volume mappings before expansion

Figure 1: Map the new disk to the existing LVM stack before extending it.


02

Initialize the New Physical Volume

LVM Capacity

Only after verifying /dev/sdb is the intended empty device, create its physical volume and add it to vg_app. Recheck the free capacity and member list before growing the logical volume.

Terminal window
sudo pvcreate /dev/sdb
sudo vgextend vg_app /dev/sdb
sudo pvs
sudo vgs
❯ View Expected Console Output
VG #PV #LV #SN Attr VSize VFree
vg_app 2 1 0 wz--n- 159.99g 119.99g

03

Grow the Target Logical Volume

Filesystem Growth

Use LVM’s --resizefs option to grow the filesystem along with the logical volume. The example assigns all free extents; choose a fixed size if the group must retain capacity for other volumes.

Terminal window
sudo lvextend --resizefs --extents +100%FREE /dev/vg_app/lv_data
❯ View Expected Console Output
Logical volume vg_app/lv_data changed from 40.00 GiB to 159.99 GiB.
Filesystem on /dev/vg_app/lv_data is now 159.99 GiB.

04

Confirm Capacity and the LVM Mapping

Verification

Confirm the mount, filesystem type, usable size, and logical-volume mapping. Check application health and storage alerts before closing the change.

Terminal window
findmnt /srv/app
df -hT /srv/app
sudo lvs -o lv_name,vg_name,lv_size,devices vg_app
❯ View Expected Console Output
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/vg_app-lv_data xfs 160G 28G 132G 18% /srv/app

Comments