If your Ubuntu VM disk is too small after using Hyper-V Quick Create, follow these steps to expand it properly.
Step 1: Expand the Virtual Disk in Hyper-V
- Turn off the VM.
- Open Hyper-V Manager, go to Settings → Hard Drive → Edit, and increase the disk size.
- If “Edit” is disabled, delete any Checkpoints in the Checkpoint section.
Step 2: Resize the Partition in Ubuntu
Start the VM.
Install required tools
sudo apt install cloud-guest-utils
Set locale to English (if using a different language)
LC_ALL=C
Expand the partition to use the free space
sudo growpart /dev/sda 1
Note: The space between sda
and 1
is necessary because growpart
takes them as separate arguments.
Resize the filesystem to match the new partition size
sudo resize2fs /dev/sda1
This step ensures that the filesystem (ext4 in most Ubuntu setups) expands to fill the newly resized partition. Unlike growpart
, resize2fs
refers to /dev/sda1
as a single entity, so there is no space.
Step 3: Verify the Changes
Check updated disk space
df -h
Your Ubuntu VM now has more disk space! 🚀
Source: Anton Karl Ingason
Leave a Reply