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 Windows 7 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 for2: How do I shrink a VHD file?
Thread Forum
does DVD Shrink work in W7 64-bit? Software
Shrink Volume General Discussion
Solved Hi i can not shrink my C: Drive General Discussion
Trying to shrink partition General Discussion
How to shrink animated gif file Music, Pictures & Video
HOW to shrink disk ? Installation & Setup
Can't shrink volume. Hardware & Devices

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 01:17 PM.
Twitter Facebook Google+

Windows 7 Forums

Seven Forums Android App Seven Forums IOS App

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33