How do I shrink a VHD file with hyper-v?
My sharepoint site has a 220gb disk assigned but only using 40gb of it. But the VHD is 200gb so I cannot export/back it up easily.
Whats the solution?
How do I shrink a VHD file with hyper-v?
My sharepoint site has a 220gb disk assigned but only using 40gb of it. But the VHD is 200gb so I cannot export/back it up easily.
Whats the solution?
As usual a little more googling found the answer.
http://sqlsolace.blogspot.com/2008/0...mages-vhd.html
Its quite hard to find these solutions sometimes as Hyper-V has progressed from a couple of years ago when you needed 3rd party tools to do this.
Now it seems its inbuilt into the hyper-v management console.

Is it dynamicly allocated or preallocated. There is a tool in the hyper-V manager where you specify the VHD that allows you to scan, shrink or resize VHDs. Its a button or series of buttons just below the VHD path.
Edit: looks like you found it while I was writing my answer.
Thanks synack, have you done it before?
Any problems?
I'm a little worried about doing it on my production Sharepoint server
Personaly I would shrink the partition size of your VM (while inside the VM its self) and then do a disk to VHD (aka physical to virtual) conversion using System Centre Virtual Machine manager or any other tool.


Havn't done it before but as was said above you should shrink the partition size in the VM and then do the shrink of the VHD. Taking a copy of it beforehand is also a good plan.
Thanks.
Edited the Disk in settings then compacted it. Took about 20mins but go the size down to 38gb.
Exported the disk and restarted the server. All backed up now and feeling much happier
I love virtualization sometimes!
There are currently 2 users browsing this thread. (0 members and 2 guests)