From Windows Server 2012 R2, it is possible to re-size a Virtual Hard Disk for a running Virtual Machine on Hyper-V.  It was not possible to do before for an  Virtual Machine running state on Windows Server 2012 and earlier Hyper-V versions.

Advantages: The re-sizing feature allows expanding or shrinking a Virtual Machine hard disk while the Virtual Machine is running. Users can still access Virtual Machine and its volumes. This feature reduces the downtime of critical Virtual Machines.

Requirements: You must be using a VHDX format and this must be connected to a SCSI controller  before you can expand or shrink a Virtual Hard Disk. However, Disk type can be fixed, differencing or dynamic.

Limitations:

  • Does not work on virtual hard disks using VHD format.
  • The re-sizing feature does not work on Virtual Hard Disks which are attached to IDE Controllers.
  • Does not work for Virtual Hard Disks which have snapshots/checkpoints associated.
  • Expanding and Shrinking process is not visible to the Virtual Machine Operating System. 
  • Once the virtual hard disk has been expanded, Then you must make the extra space available to Virtual Machine by using the “Extend Volume Wizard” within the Disk Manager of the Guest Virtual Machine.
  • Shrinking reduces the storage capacity of the Virtual Hard Disk. If you want to shrink the size, you must use the “Disk Manager” in Operating System of the Virtual Machine. Finally, use the “Edit Virtual Hard Disk” wizard to reduce the size of the virtual hard disk.

Note:  Shrinking might be data loss, so better take backup before shrinking (decreasing the disk size)

Step by Step Procedures:

Right Click VM and select Settings.

img1

Select the Hard Drive and Click Edit.

img2

Click Next.

img3

Select the options as below,

  • Compact – compacts the file size of the virtual hard disk and storage capacity of the virtual hard disk remains the same.
  • Covert – Converts a virtual hard disk by copying the contencts to a new virtual hard disk. The new virtual hard disk can use a different type and format than the original virtual hard disk.
  • Expand – Expands the capacity of the virtual hard disk.

img4

Enter the New Size and click next.

Note: For expanding it should be greater than the existing size.

img5

Review the summary and Click Finish.

img6

Note: After expanding here, you need to extend the volume/partition in the Guest VM.

How to Extend Volume in Windows Server 2012