Ubuntu 22.04 LTS Filesystem Volume on Hyper-V
Ubuntu 22.04 LTS Filesystem Volume on Hyper-V
Expand the VHDX file via Hyper-V
To expand the VHDX file via Hyper-V, follow these steps:
1. Ensure there are no Checkpoints
Before proceeding, make sure your virtual machine has no checkpoints.
2. Navigate to Settings
Go to Virtual Machine > Settings... > SCSI Controller > Hard Drive
.
3. Edit the Virtual Hard Disk
Press Edit
under Media > Virtual hard disk
.
4. Configure the New Size
In the pop-up dialog, configure the new size for your virtual hard disk.
Expand /dev/sda size
To expand the /dev/sda
size, follow these steps:
1. Install Required Package
Install the cloud-guest-utils
package.
sudo apt install cloud-guest-utils
2. Find the Virtual Disk Name
Use fdisk
to find the name of the virtual disk.
sudo fdisk -l
In the output, you should find the device table:
Device Start End Sectors Size Type
/dev/sda1 227328 52428766 52201439 24,9G Linux filesystem
/dev/sda14 2048 10239 8192 4M BIOS boot
/dev/sda15 10240 227327 217088 106M EFI System
Here you can identify the device name. In this example, it is /dev/sda1
.
3. Expand the Partition
Expand the partition into the free space.
sudo growpart /dev/sda 1
4. Resize the Filesystem
Resize the filesystem to use the new partition size.
sudo resize2fs /dev/sda1
5. Result
Check the new partition size with the df
command.
df -h