TekOnline

How to Expand Ubuntu Disk After Hyper-V Virtual Disk Expansion

When you expand a Hyper-V virtual disk, Ubuntu doesn’t automatically use the new space. Here’s how to make Ubuntu recognize and use the additional storage.

Quick Overview

After expanding your Hyper-V virtual disk, you need to:

  1. Extend the partition
  2. Resize the LVM physical volume
  3. Extend the logical volume
  4. Resize the filesystem

Step-by-Step Process

1. Check Current Status

# Check current disk usage
df -h

# View partition layout
lsblk

2. Extend the Partition

# Use growpart to extend partition 3 (typically the main partition)
sudo growpart /dev/sda 3

3. Resize LVM Components

# Extend the physical volume
sudo pvresize /dev/sda3

# Extend the logical volume to use all free space
sudo lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv

# Resize the filesystem
sudo resize2fs /dev/ubuntu-vg/ubuntu-lv

4. Verify Success

# Check the new disk usage
df -h

What Each Command Does

  • growpart: Expands the partition to use all available disk space
  • pvresize: Makes LVM aware of the expanded partition
  • lvextend: Extends the logical volume to use available space
  • resize2fs: Expands the ext4 filesystem to fill the logical volume

Important Notes

  • All operations can be performed online (no reboot required)
  • This process works with Ubuntu’s default LVM setup
  • The filesystem expansion happens instantly with no data loss
  • Always backup important data before disk operations

Result

Your Ubuntu system will now have access to all the additional storage space you allocated in Hyper-V, with the filesystem automatically expanded to use the new capacity.


Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *