Just short note about it, as from time to time I need to increase volume size.
Part 1 - In host system
Get list of VMs
Get-VM
Turn off the VM.
$vmName = "YourVirtualMachineName" Stop-VM -Name "$vmName"
Expand the disk
Get-VHD -VMName $vmName Resize-VHD -Path "VHD_PATH" -SizeBytes 100GB
Check the changes
Get-VHD -VMName $vmName
Start the VM & connect to VM
Start-VM -Name "$vmName" Connect-VM -VMName "$vmName"
Part 2 - Inside VM
Install guest tools for VM (if it wasn’t done before)
sudo apt install cloud-guest-utils
Work with virtual disk
lsblk # to find the correct disk name and partition sudo growpart /dev/sda 1 # choose the partition of hard drive to increase, in this example sda and 1 partition sudo resize2fs /dev/sda1 # resize filesystem in the partition, in this example sda and 1 partition
Check the changes
df -h
That’s all.