Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.

Windows 7: How do I shrink a VHD file?

27 Feb 2009   #1

Windows 7
How do I shrink a VHD file?

How should i shrink the size of vdisk file? I installed Win7 into a vhd file and can boot from it. I tried to shrink it and by going thru computer->manage, i can shrink the partition inside the vhd file and got some empty space at the tail of vhd file. However the vhd file is the same size as before. How can i squeeze the vhd file to the size of its new (smaller) partition and get a small vhd file?
thanks in advance

My System SpecsSystem Spec
27 Feb 2009   #2

Vista Ult 64 bit Seven Ult RTM x64

Hello ygl,

Welcome to the Seven Forums.

Sorry, but I don't know of any way to make the file size smaller. Your only recourse may be to delete the vhd and recreate a smaller vhd and reinstalling 7.

Maybe someone else has a better idea???

My System SpecsSystem Spec
27 Feb 2009   #3

Windows 7 RC 7100 32bit/64bit

My System SpecsSystem Spec

26 Oct 2009   #4

Windows 7 Enterprise
Windows 7 and Disk2VHD

limneos... the VHD Resizer was what I needed as the final piece to a bigger puzzle. Slightly different situation than the post above. Maybe this will help others as a key to upgrading to Windows 7 while still holding onto your current Windows XP PC as a Virtual PC during the transition:

On your XP desktop run Disk2VHD to create a virtual hard drive of your current PC. Disk2vhd.
Microsoft notes one caveat that the VHD cannot be sourced from a disk larger than 127GB. We found that you can use it with a larger disk with a bit of tweaking and with one further caveat. You cannot have more than 100GB used of a larger disk. In my case, the disk was 232GB but was only using 55GB. So I ran the Disk2VHD process on my disk and shuttled it off my PC to an external drive.

I then formatted my PC and installed Windows 7 64bit.
I then followed the process here to install XP Mode for Windows 7. Please note prerequisites and versions of Windows 7 that support XP Mode.
Download Windows XP Mode
One thing that Disk2VHD doesn't tell you... if you want to launch this VHD as a Virtual PC, you have to manually replace the hal.dll and halacpi.dll from your source Windows XP installation. Please use the ones from the correct service pack.
To do this, go to Disk Management and attach VHD.
You can then modify the contents of the VHD by placing these files in the system root (c:\Windows\System32 by default). Before you Dettach, you should use Disk Manager to Shrink the partition as much as possible. Remember to Dettach and resave the VHD file before attempting to mount the Virtual PC.
I then ran VHDResizer on this shrunken partition to create a smaller VHD from my bigger disk. I was then able to create a Virtual PC with this VHD of my old Windows XP image.

One last Caveat: To get your device drivers fixed, you will need to run the Integration Services.

If only Virtual PC had a tool as easy as P2V from VMWare to work through this...
My System SpecsSystem Spec
05 Nov 2009   #5

Windows 7

I followed all the steps suggested by biggamejames. And succeeded in shrinking my 320GB HD to a size that Virtual PC 7 accepted. But when I try to boot a VM with it attached, it stops about 5 seconds into it. I did replace the hal.dll and the other file from the original drive service pack files in the VHD as suggested. Is there anything else I might need to do to make it boot?
My System SpecsSystem Spec

 How do I shrink a VHD file?

Thread Tools

Similar help and support threads
Thread Forum
Shrink OS Volume
I want to shrink the OS partition on my internal drive. I'm getting tired of my Acronis backups taking two hours to complete. The size of the drive is 1TB, formatted NTFS. The first partition on the C Drive is labeled OEM (39MB) and I have no idea what it contains. The second partition is labeled...
General Discussion
+ 85GBs on my VHD file... Can't Shrink it
OK so I am running out of space on my 128GB SSD and the culprit is my Windows XP Mode.vhd file that is humongously huge in size... it is a whooping + 85GBs I swear, I have read google up and down, left and right and all of them end up using a third party software but I never get to finish or end...
Shrink drive
Im going shrink drive C in my PC But Windows does not allow me to select the desired volume. plz help me
General Discussion
How to shrink animated gif file
Hey guys :) I have a gif file that is animated and moves but sadly the resolution is too big. How do i shrink the resolution of the gif to like 200px by 200px Keep in mind that this gif is not a single picture and moves just like some of the smilies on this forum do ;) All...
Music, Pictures & Video
DVD shrink question.
My old XP machine died. I was using DVD Shrink + Nero 6 to back up my dvd collection. Now that is gone. I undersand dvd shink will work with windows 7 but I dont think Nero 6 will. So do I need a different burning software to work with DVD shrink or does windows 7 have it all ready? Thanks.
Music, Pictures & Video

Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 17:27.
Twitter Facebook Google+