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:
- Login to the virtual machine using an administrative account
- Open Server Manager and select the Disk Management node under the Storage node.
- Right click on the partition that you want to shrink and select Shrink
- Select how much you want to shrink the partition by
- Once this is complete, shutdown the virtual machine.
- Open the virtual machine settings under Hyper-V and select the virtual hard disk that you want to shrink.
- Click on the Edit button.
- This will open the Edit Virtual Hard Disk Wizard where you can now select to Shrink the virtual hard disk:
- 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.