Extend a logical volume to increase size of CentOS LVM and Ubuntu LVM

By | August 7, 2018

I am using CentOS 7.5 VM, but this steps is the same for Ubuntu just final step is for ext FS.

LVM Storage short:

Physical Volumes (PV) : /dev/sda
Volume Groups (VG) : /dev/sda + /dev/sdb
Logical Volumes (LV) :

How to grow an ext filesystem with pvcreate, vgextend, lvextend and resize2fs commands (Ubuntu)
How to grow an XFS filesystem with pvcreate, vgextend, lvextend and xfs_growfs commands (CentOS)

to display physical volumes (pv)
sudo pvs or sudo pvdisplay

display volume Groups (vg)
sudo vgs or sudo vgdisplay

display logical volume (lv)
sudo lvs or sudo lvdisplay

information for new drive:
sudo lvmdiskscan or fdisk -l

Lets start: pvcreate, vgextend, lvextend

Create physical volume
sudo pvcreate /dev/sdb

Extend volume with new drive:
sudo vgextend centos_sparrow /dev/sdb

to verify: sudo lvmdiskscan -l

Extend the logical volume and resize underlying filesystem together:
sudo lvm lvextend -l 100%FREE /dev/centos_sparror/root

final step:

sudo xfs_growfs /dev/mapper/centos_sparrow-root

final check: sudo df -h

or for Ubuntu final step:

sudo resize2fs -p /dev/mapper/…