How To Expand Ubuntu 20.04 LTS Filesystem Volume on Hyper-V
I tried existing solutions on 18.04 and found it doesn't work with a 'nothing to do' output. Some further searching had similar-but-slightly-different steps and needing to merge a few different bits-and-pieces from other solutions on the web to make work.
Setup: Hyper-V; VHDX file as hard disk; Ubuntu-18.04
Steps:
Expand the VDHX file via Hyper-V as mentioned in existing solutions and then inside the VM:
fdisk -l
See which partition is the current Ubuntu setup - should be obvious based on size (in my case was sda3)
growpart /dev/sda 3
Note the space as mentioned.
pvresize /dev/sda3
This is the step which isn't mentioned in a lot of places; its the intemediate step that allows the logical volume extension step work.
lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv
The
/dev/
part can seen in the fdisk output from step 1.resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv
After the prep above, this step now works. Takes a couple of moments and afterwards can verify with
df -h
that the partition is expanded.
src = https://superuser.com/questions/1716141/how-to-expand-ubuntu-20-04-lts-filesystem-volume-on-hyper-v