Extending a logical volume in a virtual machine – ESXi

Power off the virtual machine.

Edit the virtual machine settings and extend the virtual disk size.

Screen Shot 2022-01-12 at 2.38.16 PM.png

Power on the virtual machine.

root@static01:~# fdisk -l

Screen Shot 2022-01-12 at 2.25.22 PM.png

root@static01:~# fdisk /dev/sdab

Screen Shot 2022-01-12 at 2.26.12 PM.png

Command (m for help): p

Screen Shot 2022-01-12 at 2.26.35 PM.png

Select (default p): p

Screen Shot 2022-01-12 at 2.28.32 PM.png

Command (m for help): n

Screen Shot 2022-01-12 at 2.27.01 PM.png

Partition number (1-4, default 1): 3

Screen Shot 2022-01-12 at 2.27.33 PM.png

Command (m for help): t

Screen Shot 2022-01-12 at 2.29.19 PM.png

Command (m for help): w

Screen Shot 2022-01-12 at 2.29.46 PM.png

root@static01:~# fdisk -l

Screen Shot 2022-01-12 at 2.30.09 PM.png

root@static01:~# vgdisplay

Screen Shot 2022-01-12 at 2.30.29 PM.png

root@static01:~# pvcreate /dev/sdb3

Screen Shot 2022-01-12 at 2.31.08 PM.png

vgextend kayals-vg /dev/sdb3

Screen Shot 2022-01-12 at 2.32.52 PM.png

root@static01:~# lvdisplay

Screen Shot 2022-01-12 at 2.33.34 PM.png

root@static01:~#  lvextend -l +100%FREE /dev/mapper/kayals–vg-root

Screen Shot 2022-01-12 at 2.33.54 PM.png

root@static01:~# df -kh

Screen Shot 2022-01-12 at 2.34.16 PM.png

root@static01:~# resize2fs -p /dev/mapper/kayals–vg-root

Screen Shot 2022-01-12 at 2.34.37 PM.png

root@static01:~# df -kh

Screen Shot 2022-01-12 at 2.34.49 PM.png