linux_wiki:extend_existing_logical_volumes

This is an old revision of the document!


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
pvdisplay

Create volume group

vgcreate vglocal /dev/sdb1
vgdisplay

Create logical volume

lvcreate -n lvstorage -L 20G vglocal
lvdisplay

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
vgdisplay

Move physical extents off /dev/sdb1

pvmove /dev/sdb1
OR
pvmove /dev/sdb1 /dev/sdc1

Remove /dev/sdb1 from volume group

vgreduce vglocal /dev/sdb1

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

lvextend -L 30G /dev/vglocal/lvstorage
OR
lvextend -L +10G /dev/vglocal/lvstorage
  • df -h shows that filesystem still needs to be resized to fill the LV container

Resize the filesystem

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

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