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
ygl

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
garysgold

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???

Gary
My System SpecsSystem Spec
27 Feb 2009   #3
limneos

Windows 7 RC 7100 32bit/64bit
 
 

My System SpecsSystem Spec
.


26 Oct 2009   #4
biggamejames

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
pixelwiz

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
Reply

 How do I shrink a VHD file?




Thread Tools





Similar help and support threads
Thread Forum
+ 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...
Virtualization
does DVD Shrink work in W7 64-bit?
I use DVD Shrink on my XP computer. I'm building a W7 64-bit (home premium) computer now. Will DVD shrink work on W7 64-bit. I've seen people here talk about DVD Shrink working, but not seeing a mention of it works on 64-bit or 32-bit.
Software
Why does my screen shrink?
I am innocently typing while my browser in firefox is open, and all of a sudden my screen shrinks. Then it enlarges, then it shrinks, then it permanently shrinks so that every time I open the page, it is so tiny! How do I correct?
Browsers & Mail
How to Shrink Windows 7 iso
Hello, Does anyone know how to shrink Windows 7 iso, like remove the other editions. I made a windows 7 AiO disc, which has all the editions, 32bit and 64bit but I want make a special iso, that only has 32bit and 64bit of Ultimate, can anyone help me please?
Installation & Setup
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
Can't shrink partition
I have the Windows 7 build 7000 on my C:\ Drive, which is a 19.0 GB NTFS Primary partition. I have 2 other partitions, a Data D:\ Logical drive, which is 140.0 GB NTFS partition, and a Downloads E:\ Logical drive, which is 73.88 GB NTFS. I want to shrink the D:, because I think the 19.00 GB isn't...
Installation & Setup

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 14:22.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App