Search This Blog

Monday, July 5, 2010

Shrink VHD size

Well, we all know that Hyper V Manager snap in provide us a tool to expand VHD size when require.

Now, How about shrink a VHD size? You may come to a situation when your existing VHD is Fixed Disk which you accidentally create to large size which not even 10% utilize. In order to shrink the size of the VHD, you need to

* Backup original VHD first *
a) Perform defragmention of the guest VM (optional)
b) First, shrink partition size
c) Then ,shrink VHD size by using VHDResizer.

You can use VHDResizer tool . To get this tool, go to http://vmtoolkit.com/files/folders/converters/entry87.aspx but on Windows Server 2003, there is no option to shrink volume. The VHDResizer cannot shrink the VHD if the partition is still intact with original size.

Without wasting any more time. let me show you how i shrink a Windows Server 2003 -Fixed Disk.

1. Attach Win2k3 VHD by using Parent host (Hyper V), go to Start > Administrative Tool > Computer Management > Storage > Disk Management > Right click Attach VHD

2. Right click the partition (Disk 4) and select Shrink Volume.











3. Enter the amount of space to shrink.
















4. Once you have shrink the partition, right click the VHD Disk and select Detach VHD.










5. Open VHDResizer, enter destination VHD and specify the new size.
Original size is 50GB
Resize to : 31 GB





















6. Wait until the process complete. Below is the snapshot of result.
















7. Use Hyper V manager snap in to use the new disk (TestExpand2.vhd).

Cool right !...
p/s:- No guarantee provided. Use it at your own risk.
If working on your side, just leave a comment so other can review it.

Thank you , Stay Tuned.