Shrinking a virtual hard disk in Windows 8

Late last year I posted about the process that I followed to reduce the disk size of my virtual machines, prior to converting them to using a fixed size virtual hard disk.  The process I used was quite complicated.

If only I had waited for the beta availability of Windows Server 2012 – things could have been a lot simpler.  You see, one of the new features in Windows Server 2012 is the ability to shrink a virtual hard disk.  You need to free up space inside the virtual hard disk first – but then you can shrink the drive using a simple wizard.  This means that the process of shrinking an existing virtual machine now looks like this:

 

  1. Login to the virtual machine using an administrative account
  2. Open Server Manager and select the Disk Management node under the Storage node.
  3. Right click on the partition that you want to shrink and select Shrink
  4. Select how much you want to shrink the partition by
    1. In my case I want to shrink a 250GB partition to 70GB:
      Server Manager inside a virtual machine
  5. Once this is complete, shutdown the virtual machine.
  6. Open the virtual machine settings under Hyper-V and select the virtual hard disk that you want to shrink.
  7. Click on the Edit button.
  8. This will open the Edit Virtual Hard Disk Wizard where you can now select to Shrink the virtual hard disk:
    Edit Virtual Hard disk Wizard 
  9. Now hit Finish

Hyper-V will automatically shrink the virtual hard disk to remove any free space from the end of the disk – so there is no need to enter how much you want to shrink the disk by.  Once this process is complete your can boot the virtual machine and start using the smaller virtual hard disks.

Cheers,
Ben