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.
Identify the Filesystem and Candidate Device
Pre-change CheckTrace 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.
findmnt /srv/appdf -hT /srv/applsblk -o NAME,SIZE,TYPE,FSTYPE,MOUNTPOINTS,SERIALpvsvgslvs -a -o +devices❯ View Expected Console Output
NAME SIZE TYPE FSTYPE MOUNTPOINTSsda 80G disk└─sda2 60G part LVM2_member └─vg_app-lv_data 40G lvm xfs /srv/appsdb 100G disk
Figure 1: Map the new disk to the existing LVM stack before extending it.
Initialize the New Physical Volume
LVM CapacityOnly 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.
sudo pvcreate /dev/sdbsudo vgextend vg_app /dev/sdbsudo pvssudo vgs❯ View Expected Console Output
VG #PV #LV #SN Attr VSize VFreevg_app 2 1 0 wz--n- 159.99g 119.99gGrow the Target Logical Volume
Filesystem GrowthUse 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.
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.Confirm Capacity and the LVM Mapping
VerificationConfirm the mount, filesystem type, usable size, and logical-volume mapping. Check application health and storage alerts before closing the change.
findmnt /srv/appdf -hT /srv/appsudo 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