After extending the hard disk of the VM in ESXi or any other hypervisor, reboot the VM and boot using a bootable GPARTED iso image.
![](https://devindersingh.ca/wp-content/uploads/2023/08/Screenshot-2023-08-29-175906.png)
Once the GPARTED gui comes up, confirm that the free space is showing up and then select the partition which needs to be extended and use the slider to extend it my moving it towards right side. Then click on SAVE to write the changes. We are done here so we can now reboot the machine to claim the newly added space in the OS. If the disk is 100% used then the OS will not let you make/save any partition chanes to the disk which is counter intutive but that is how it is designed so when the OS is rebooted, press escape button on keyboard and then select advanced ubuntu startup options and drop to root shell. Once here, run apt-get clear && apt-get autoremove this will remove enough space to enable you to write changes to the disk.
![](https://devindersingh.ca/wp-content/uploads/2023/08/Screenshot-2023-08-29-173436-1024x703.png)
![](https://devindersingh.ca/wp-content/uploads/2023/08/Screenshot-2023-08-29-173514-1024x706.png)
After the reboot, run these commands in this sequence to extend the volume.
![](https://devindersingh.ca/wp-content/uploads/2023/08/Screenshot-2023-08-29-173727-1024x771.png)
![](https://devindersingh.ca/wp-content/uploads/2023/08/Screenshot-2023-08-29-174115-1024x27.png)
![](https://devindersingh.ca/wp-content/uploads/2023/08/Screenshot-2023-08-29-173931-1024x893.png)
![](https://devindersingh.ca/wp-content/uploads/2023/08/Screenshot-2023-08-29-174008-1024x311.png)
![](https://devindersingh.ca/wp-content/uploads/2023/08/Screenshot-2023-08-29-174020-1024x264.png)
![](https://devindersingh.ca/wp-content/uploads/2023/08/Screenshot-2023-08-29-174030-1024x250.png)
![](https://devindersingh.ca/wp-content/uploads/2023/08/Screenshot-2023-08-29-174040-1024x230.png)
![](https://devindersingh.ca/wp-content/uploads/2023/08/Screenshot-2023-08-29-174054-1024x249.png)
![](https://devindersingh.ca/wp-content/uploads/2023/08/Screenshot-2023-08-29-174516-1024x68.png)
![](https://devindersingh.ca/wp-content/uploads/2023/08/Screenshot-2023-08-29-174529-1024x240.png)
![](https://devindersingh.ca/wp-content/uploads/2023/08/Screenshot-2023-08-29-174549-1-1024x350.png)
######## ANOTHER METHOD #########
sudo parted
print free space
(This will show the partitions with numbers and the free space, we will use the partition number and free space next)resizepart <NUMBER> <RESULTING SIZE AFTER THE EXPANSION (under the column 'End' i.e. 85.9GB>
write
quit
- sudo lsblk (Note down the name of the partition and volume)
- sudo pvresize /dev/sda3 (it was /dev/sda3 in this case as shown in output of lsblk, make sure it is correct)
- sudo lvextend -l +100%FREE /dev/mapper/ubuntu–vg-ubuntu–lv (the name is from the df -h output)
- sudo resize2fs /dev/mapper/ubuntu–vg-ubuntu–lv
- df -h (to check the resizing)