Online Resizing Of Hyper-V Virtual Disks Is Possible in Windows 2012 R2

Windows Server 2012 R2 brought us the ability to resize virtual disks on line. This was a long sought after feature for many of us. It can be done via the GUI or with PowerShell. I do note however that quite often people have some problems when first using this capability. So we’ll go over the rules & prerequisites here.

Listed below are the important factors to keep in mind

  1. It has to be a VHDX
  2. Works for both generation 1 and generation 2 virtual machines
  3. It needs to be attached to a vSCSI controller. Remember this when dealing with with generation 1 virtual machines. In particular note that this means you cannot live resize the system disk as that IDE only (can’t boot from SCSI in generation 1).
  4. The virtual disk cannot be a shared VDHX (it’s on my feature request list for vNext)
  5. You can extend a virtual disk
  6. You can shrink a virtual disk
  7. This feature can leverage ODX for speed when available. The speed of this is quite addictive.

Some notes where people seem to make some other mistakes

You’ll note that you cannot shrink a virtual disk that has no unallocated disk space on the disk inside the virtual machine. When you see this picture inside of the virtual machines you can shrink your VHDX if all the above factors are in order.image

image

If there is no unallocated disk space the option to shrink the VHDX won’t even show up in the GUI.

image

This means you’ll first need to shrink the volume inside the virtual machine if all disk space has already been allocated.

image

(Like wise don’t forget to expand the volume inside the VM to be able to use the added space you see show up as unallocated space on the disk.)

The below image is a great summary of the above

image

Legacy OS in the VM?

It’s also important to note that an OS inside a VM (Windows Server 2003 comes to mind) that does not allow the expansion or shrinking of volumes means you will need a 3rd party tool to do the same. I use GParted, a free partition editor for these scenarios.

One thought on “Online Resizing Of Hyper-V Virtual Disks Is Possible in Windows 2012 R2

  1. Pingback: You cannot shrink a VHDX file because you cannot shrink the volume on the virtual disk - Working Hard In IT

Leave a Reply, get the discussion going, share and learn with your peers.

This site uses Akismet to reduce spam. Learn how your comment data is processed.