Shrinking a virtual hard disk in Windows 8

Shrinking a virtual hard disk in Windows 8

Rate This
  • Comments 7


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

Leave a Comment
  • Please add 4 and 6 and type the answer here:
  • Post
  • Nice! :) Is this only in Server or client too?

  • It is in client too

  • Hello Ben,

    Finally i see the shrink option.

    If a VHD is 300 GB , with shrink , can we make 40 GB?

    Means i made a P2V operation and i can make smaller vhd after P2V?

    If yes , you are 5 star person :)For 2 years i am waiting for this.

    Murat Demirkiran

  • Murat - Yes, this is correct :)

  • Assuming I'm not doing it incorrectly it only works with vhdx disks. This would make sense - it's just worth pointing out :)

    It seems it will work doing the partition shrink when running on a vhd, then shut down the vm, convert vhd->vhdx and then do the shrink in the Hyper-V console. (And remember to change the vm properties to use the new vhdx file.)

  • Hi, I have done it with Powershell vniklas.djungeln.se/.../shrink-hyperv-virtual-hard-disk-win8-win2012-with-powershell

    regards Niklas

  • Hi Ben,

    Thanks for this new feature!  Any chance SHRINK will be added to Hyper-V 2008 R2?  Or at least a separate tool that's supported from MS?

    Josh

Page 1 of 1 (7 items)