How to extend LVM in Linux
Extending a Logical Volume Manager (LVM) in Linux involves adding more space to an existing logical volume. Follow these steps to extend your LVM:
Extend the Volume Group (VG)
If you use virtual disk, you can resize disk and create new partition use to extend existing volume group by using fdisk or you can add more disk to extend VG too.
You can check your VG list by using sudo vgs and extend by:
1
2
sudo vgextend vg_name /dev/<partition>
sudo vgs
Extend the Logical Volume (LV)
After extend VG you need to allocate free space to current logical volume:
1
sudo lvextend -l +100%FREE /dev/vg_name/lv_name
Please note you can list your lv by using sudo lvs
Resize the filesystem
Extend space for filesystem without restarting by:
1
sudo resize2fs /dev/vg_name/lv_name
(Optional) Add new disk to VG
If you attached a brand-new disk, add it to your VG as a new Physical Volume (PV):
Identify the new disk
1
lsblk -o NAME,SIZE,TYPE,MOUNTPOINT
(Recommended) Create an LVM partition on the disk
- Using fdisk (MBR/GPT): create a new partition and set type to LVM (
8e)
1
2
3
4
5
sudo fdisk /dev/sdb
# n (new) -> accept defaults
# t (type) -> 8e (Linux LVM)
# w (write)
sudo partprobe /dev/sdb # reload partition table
- Or using parted (GPT):
1
2
3
4
sudo parted /dev/sdb --script mklabel gpt \
mkpart primary 0% 100% \
set 1 lvm on
sudo partprobe /dev/sdb
Note: You can also use the whole disk directly as a PV (skip partitioning) if that suits your policy.
Update existing PV or create a new PV
- If you expanded the same underlying device (existing PV grew):
1
2
3
4
# find your PV device path
pvs
# then resize the existing PV to claim the new space
sudo pvresize /dev/<pv_device> # e.g. /dev/sda3 or /dev/nvme0n1p3
- If you added a brand‑new disk/partition:
1
sudo pvcreate /dev/sdb1 # or /dev/sdb if using whole disk