There is a risk of data loss doing this!!!
First add the additional disk space using your virtualisation admin software (i.e. ESXi / Proxmox / etc)
Rescan the bus
echo 1 > /sys/class/block/sda/device/rescan
Next start fdisk
sudo fdisk /dev/sda
Press p to print the current partition list. Copy the start block for both sda2 and sda5. Now we need to delete the partitions.
Press d to delete the partion accept the default of ‘2’
Press d again and accept the default of ‘5’
Now press n for a new partition
Create an extended partition, make sure the start block is that of your “old” sda2 partition.
Accept the other defaults to use all available space.
Now press n again
This time accept the defaults. The start block will be wrong, but this is ok and a slight anomaly with this method.
This bit is super, world ending, important.
Once you are back to the fdisk prompt press x (to enter expert mode)
Press b and make sure sda5 is selected.
Enter the start value that you copied earlier for sda5.
Once you are back at the expert command prompt, press r (to return to the main menu) and then w (to write the changes and exit.
We’ve now finished with fdisk.
Now sync the changes with the running OS.
partprobe
Extending LVM
Run
pvresize /dev/sda5 lvextend -l +100%FREE /dev/VGNAME/LVNAME resize2fs /dev/VGNAME/LVNAME
If you don’t know your VGNAME or LVNAME run
lvdisplay
That’s all there is to it!