Resizing root virtual disk on the CentOS

Hello,

Can someone suggest me what I missing, I re-sized a root virtual disk to 30GB on the CentOS VM. After re-sizing the disk, I booted the OS and ran fdisk -list command I was able view the size of the disk as 30GB.

Paritions in the vm before I resize are:

/boot - Primary parition
/ and swap are logical volumes filesystem.

but when I ran pvdisplay command I see the same output, but not sure how to scan the additional size that I added to virtual disk and bring it under lvm.

Thanks,

I think fdisk will show you that the size of the disk has changed, but the size of the partition being used as the pv for LVM hasn't changed. The space you added is just now shown as free space on the disk. I'd use fdisk to create another partition using the space you added. Then pvcreate on the new partition (probably /dev/sda3), add it to the volume group with vgextend, extend the logical volume with lvextend and then resize the filesystem with resize2fs.

Something like this (after creating the new partition with fdisk and assuming you added 10GB):

 
# pvcreate /dev/sda3
# vgextend rootvg /dev/sda3
# lvextend -L +10G /dev/rootvg/rootlv
# resize2fs -p /dev/rootvg/rootlv

Adjust the size added and the name of the vg and lv to fit your situation...

BTW, we'd usually just add another virtual disk to the guest, pvcreate it, vgextend the volume group onto it, lvextend the lv and resize2fs the filesystem. That way, you're not trying to resize or repartition a live disk.

Also, if you add another virtual disk and are going to use the whole thing as a pv, you don't need to have a partition table or to create a partition - just use the name of the whole disk.

 
pvcreate /dev/sdb
vgextend rootvg /dev/sdb
... and so on

Cheers!