arrow_back Blog Extending LVM

Extending LVM

Check current virtual groups, physical and logical disks:

vgs
pvs
lvdisplay

Find disks and compare with output from pvs to find out which one was just added (which one is not used):

fdisk -l

Knowing that, create a partition:

fdisk /dev/sdf   # replace /dev/sdf with the new one
n                # new partition
p                # primary
### Then those are defaults to use the whole drive ###
t                # set partition type...
8e               # ...to Linux LVM
p                # show changes
w                # write changes

Create physical drive:

pvcreate /dev/sdf1

Add to the vg0 group:

vgextend vg0 /dev/sdf1

Extend the group:

lvm lvextend -l +100%FREE /dev/vg0/lv-0

Resize filesystem:

resize2fs -p /dev/mapper/vg0-lv--0

Confirm changes:

df -h