In the event a VM requires more space we can expand the allotment of storage. First thing to check is the amount of free space available to the VM. 40G was provisioned in ESXi but Ubuntu shows 19G allotted and 7.2 used. It is common a VM isn’t reflecting the allotted space at creation. The next two images show that situation. In the case where expansion is needed at the virtual host level, increase the provision in ESXi prior to continuing. Make sure to have a good backup of the VM with no snapshots.
df -h
vgdisplay can show the space Ubuntu has available that is “free”. Observe VG Size, Alloc PE and Free PE / Size in the below image.
sudo vgdisplay
Utilize lvextend to expand into the unused space. Note the LV Path from the output of lvdisplay. In this case it’s /dev/ubuntu-vg/ubuntu-lv
sudo lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv
resize2fs will perform the last step. Note the path from df -h
sudo resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv
The output from vgdisplay and lvdisplay will confirm the expansion.
sudo vgdisplay
sudo lvdisplay