Tuesday, March 3, 2015

How to effectively shrink dynamic disks in a Hyper-V

The ever growing disk consumption of Virtual Machines is a problem if you don't have a lot of disk space. So the question is: how can we tame this disk space eating monster?

You have to follow these steps in Hyper-V but for ESX it works the same way:
  1. Defragment the disk of your Virtual Machine. I use Defraggler (https://www.piriform.com/defraggler) which does a pretty good job but because it is sequential - disk by disk - it takes pretty long. 
  2. Go to Windows Disk Management, right click on the disk in question and chose Shrink Volume the disk in the menu.
  3. Select the smallest size possible and let Windows do its work.
  4. When finished shut down your Virtual Machine and go to Edit disk and select Shrink (it appears only when you have unallocated disk space due to the shrink). 
  5. After the Shrink is finished choose Compact in the Edit disk menu of Hyper V
  6. When that is finished choose Expand and reset the disk to its old value
  7. Start the VM and as soon as you're in there reset the disk to its previous size in Disk Management. 
 That should do the job.

No comments:

Post a Comment