Resizing VHDX – Online

HyperV now supports online resizing of VHDX. A VHDX disk which is used by a VM can be resized and without restarting the VM, This is really an important feature which will allow flexibility on expending or shrinking VHDX on the fly as per the requirement.

Prerequisites

VHDX – the ability to expand and shrink virtual hard disks is exclusive to virtual hard disks that are using the .vhdx file format. Online resizing is supported for VHDX disk types, including fixed, differencing, and dynamic disks. Virtual hard disks that use the .vhd file format are not supported for resizing operations.

SCSI controller – the ability to expand or shrink the capacity of a virtual hard disk is exclusive to .vhdx files that are attached to a SCSI controller. VHDX files that are attached to an IDE controller are not supported.

Irrespective of the Generations – Gen1 or Gen2, Online Resizing will work fine if the prerequisites are met.

Lets try this on a Gen1 VM with a SCSI Disk.

G1 VM - BeforeResize

 

The DISK1 in the above screen shot is a SCISI Disk


 

Get-VM VMName |Get-VMHardDiskDrive -ControllerType SCSI |Resize-VHD -SizeBytes 500GB


 

Resize-VHD

Resize-VHD

 

Now the VHDX is expanded. As the GUST OS on this VM is Windows 2008 R2, To get this change reflected on the VM, From DISK Management , Initiate a RESCAN. With Windows Server 2012, This change will get reflected immediately without a rescan.

Resize-VHD

After Resize – 500 GB

AS

If its a GEN2 VM, Its more easy as the default DISK which is getting created is a SCSI Disk. So even a System Drive can be expanded.

 

Resize-VHD

Gen2 VM – Before VHD Resize

 


 

Get-VM VMName |Get-VMHardDiskDrive -ControllerType SCSI |Resize-VHD -SizeBytes 1TB


 

Resize-VHD

Resize-VHD G2 VM

 

If its a Windows Server 2012 VM, the change will get reflected immediately and don’t need a rescan.

 

Resize-VHD

G2 VM – After Resize

 

The current C drive which is 100 GB can now expanded  to start using the added space.

From Disk Management -> Right Click on the volume which needs to be extended

Select Extend Volume

Extend Volume

Extend Volume

 

The maximum available space will be set by default , how ever this could be reduced as per the requirement.

DISK Management - Extend-Volume -  Configure Size

DISK Management - Extend-Volume -  Summary

DISK Management – Extend-Volume – Summary

And now the C Drive is 1 TB.

DISK Management - After extending volume

DISK Management – After extending volume

 

Explorer View

Cheers !

 

Comments

comments