Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Shrink VirtualPC 7 disk images Apps
I use Microsoft Virtual PC 7 to run multiple versions of Windows and Linux on my G5 (for testing web applications). VPC allows the virtual hard drives grow up to 15 GB -- which can consume quite a bit of disk space when you've got a bunch of them. In addition to consuming more disk space, larger VPC drive documents actually run slower (as if it wasn't slow enough already).

VPC allows you to "reclaim unused disk space" using the Virtual Disk Assistant. However, unless the unused disk space has been zeroed, it cannot be reclaimed. In the past, I had been using a variety of Windows disk utilities to zero the unused disk space. Users of VPC know that everything takes a long time in VPC, including zeroing the free space. Today, I discovered a much quicker solution.

WARNING: Before you try this, do yourself a huge favor and back up the VPC files that you are going to work with. Don't assume that it will always work as well as it did for me.

Here's what I did:
  1. Launch the PC and defragment the drive.
  2. Shut down the PC.
  3. Control-click on a .vpc7 document and choose the Show Package Contents option.
  4. Double-click on the BaseDrive.vhdp file (this will mount the disk).
  5. Open Apple's Disk Utility program.
  6. Select "No Name" -- under BaseDrive.vhdp.
  7. Click the Erase tab.
  8. Click Erase Free Space.
  9. Select Zero Out Deleted Files and click Erase Free Space.
  10. Use VPC's Reclaim Unused Disk Space tool.
I suppose it would also be possible to defrag using an OS X utility (after the .vhdp image is mounted), but I didn't feel that adventurous. If anybody tries it, please let me know if it works.

The Results:
  • File size before normal Reclaim Unused Disk Space: 7.53 GB
  • File size after normal Reclaim Unused Disk Space: 6.17 GB
  • File size after using this hint: 4.86 GB
Total space saved: 2.67GB, or about 35% of the orginal size.
    •    
  • Currently 2.80 / 5
  You rated: 1 / 5 (5 votes cast)
 
[21,496 views]  

Shrink VirtualPC 7 disk images | 13 comments | Create New Account
Click here to return to the 'Shrink VirtualPC 7 disk images' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Shrink VirtualPC 7 disk images
Authored by: vincentvanwylick on Jun 06, '06 08:49:14AM

A less complicated procedure, perhaps, but you can also partition your drive at installation. If you set it to, let's say, 2-3 gigs, it will not exceed that limit. You can also do the same later with any partitioning program in your virtual OS.



[ Reply to This | # ]
Shrink VirtualPC 7 disk images
Authored by: arb on Jun 06, '06 09:29:13AM
Didn't quite work for me - Step 4 won't mount the image, but cause Virtual PC to display an error message. I had to do attach it from the terminal using

hdiutil attach Documents/Virtual\ PC\ List/xp.vpc7/Disk1.vhdp/BaseDrive.vhd 
and then erase the free space as described. Zeroing out the unused space did work, but is still slow.

[ Reply to This | # ]
NTFS
Authored by: rspeed on Jun 06, '06 09:58:19AM

It's worth noting that this process will not work if you're using Windows NT Filesystem (NTFS) as it is read-only in Mac OS X.



[ Reply to This | # ]
Shrink VirtualPC 7 disk images
Authored by: gteague on Jun 06, '06 03:02:05PM

vpc disk de-frag failed suggesting i run chkdsk /f which in turn tells me the disk is locked. i took up the offer to run chkdsk on restart, but that doesn't kick in either.

i've been trying off and on for nearly two years to shrink down the size of this one image. i've followed the instructions from the old connectix forum and the ms beta list exactly, but the process always fails in one step or another.

i originally gave it a 15gb container and it is 8.55gb in the mac finder. but the pc says there is approx 11gb free space which means the mac image file should be around 4gb.

/guy

---
--
Watch out where the huskies go--don't you eat that yellow snow. F. Zappa



[ Reply to This | # ]
Shrink VirtualPC 7 disk images
Authored by: gteague on Jun 11, '06 03:37:03PM

well, i persevered over the course of a week and finally got this to work. what a great tip! like i say, i've been trying off and on using various methods to shrink some of my image files. this method took me from 8.55gb down to 4.9gb.

many thanks to the author!

/guy

---
--
Watch out where the huskies go--don't you eat that yellow snow. F. Zappa



[ Reply to This | # ]
How to recover the password
Authored by: hamarkus on Jun 06, '06 03:23:55PM

Using the diskutil attach this worked great, going down from 7.4 to 5.1 GB (actually the first tip that for me ever).

However, I had to log out of Windows for this and now I cannot remember my Windows password... (its not networked and the password therefore is just a few digits, so I could simply try it out).

Is there a way to retrieve the password from the image?



[ Reply to This | # ]
How to recover the password
Authored by: wordsofwisedumb on Jun 06, '06 06:03:51PM

If it is Windows XP, the password is stored in a file with the extension .sam. There are utilities to read .sam files which run on linux you should be able to boot the virtual computer on a live linux CD and recover the password that way. DO NOT modify the .sam file, one of my past roommates did that on a real PC and ended up reformatting. I can't remember where the .sam file is stored exactly but a quick Google search should tell you.



[ Reply to This | # ]
How to recover the password
Authored by: superg on Jun 07, '06 08:45:28AM

yeah, check out http://ophcrack.sourceforge.net



[ Reply to This | # ]
Shrink VirtualPC 7 disk images
Authored by: RussellK on Jun 07, '06 06:46:18AM

This worked exactly as described for me. Thanks for the great hint!

Now, the question is, how often will I have to run this procedure to continue to keep my VPC disk image nice and small? In other words, what activities will cause the image to "dynamically expand" as I use VPC? If I pretty much just use VPC to view Windows-only CD-ROM presentations, and never install new software, will the file size stay down?



[ Reply to This | # ]
Clone it !
Authored by: metiure on Jun 07, '06 01:15:15PM

The best solution so far is to clone your VPC disk with a clone utility like Norton Ghost. You just need to do this:
1.Create a new PC image drive in VPC 7
2.Attach it to the virtual PC you will clone
3.Boot from the Ghost CD
4.Clone your previous PC hard disk to the new one.
5.Boot from the new one after detaching it.

Everything is defragmented, zeroed, faster!

Vic



[ Reply to This | # ]
Shrink VirtualPC 7 disk images
Authored by: stutemp1 on Jun 08, '06 09:13:01AM

On the subject of shrink/expand, I have a situation where my dynamic drive does not expand as needed and gives an "out of drive space" error. (trying to install Win2k sp4 and patches up from v. sp2) Service packs etc. were not a problem previously, but now there is some work I must do that requires internet access via the Windows install so security has become an issue. I am using NTFS so mounting the drive image etc. has those associated problems. Any ideas on how I can force the "dynamic" drive to actually expand as it is supposed to? I have plenty of physical HD space so thats not the problem.



[ Reply to This | # ]
Shrink VirtualPC 7 disk images
Authored by: victory on Jun 08, '06 03:48:34PM
MS makes a special tool that runs inside the Windows guest os to allow the VPC Disk Assistant to reclaim free space quicker. There are reports that it works under VPC for Mac as well, although I haven't verifed this personally (I tend to create my .vphd containers using fixed-size disks)

Anyhow, read more about precompactor here or just download it here. (Look at the bottom of the 'VirtualPC for Mac' section)

With that said, most often I use the Ghost method myself. It's surprisingly quick when dealing with virtual drives.

[ Reply to This | # ]

Shrink VirtualPC 7 disk images
Authored by: macwebmac on Jun 10, '06 07:49:03AM

Would it be posible to that with creating new blank vpc drive and then using mac cloning app directly from MacOSX?
Lets say CloneX, Tri-Backup, Disk Utility...

Well thats of course if you are not using NTFS.



[ Reply to This | # ]