Extend Existing Logical Volumes

General Information

Expanding existing logical volumes non-destructively.

Create single partition on a new disk

fdisk /dev/sdb
n (new partition)
(use defaults)
t (change type)
8e (Linux LVM)
w (write changes and quit)

Create physical volume

pvcreate /dev/sdb1

Create volume group

vgcreate vglocal /dev/sdb1

Create logical volume

lvcreate -n lvstorage -L 20G vglocal

Create XFS Filesystem

mkfs -t xfs /dev/vglocal/lvstorage

Mount the volume

mkdir -p /mnt/mystorage
mount /dev/vglocal/lvstorage /mnt/mystorage

Create a partition on a new disk

gdisk /dev/sdc
(same defaults + lvm type change as basic setup)

Create physical volume from created partition

pvcreate /dev/sdc1

Extend the “vglocal” volume group and verify

vgextend vglocal /dev/sdc1

Extend volume to be 30G in size(from 20G original)

lvextend -L 30G --resizefs /dev/vglocal/lvstorage
lvextend -L +10G --resizefs /dev/vglocal/lvstorage
  • df -h shows that filesystem still needs to be resized to fill the LV container (if you did not use “–resizefs”)

Resize the filesystem - if you did NOT use the “–resizefs” option above

xfs_growfs /dev/vglocal/lvstorage
  • If EXT filesystem, use: resize2fs /dev/vglocal/lvstorage

  • linux_wiki/extend_existing_logical_volumes.txt
  • Last modified: 2019/05/25 23:50
  • (external edit)