Most Sharepoint developers use Virtual PC for their development tasks. The VPC images has a tendency to grow very large, and the size of the VHD file is not reduced when you delete files.
Here are a few tips on how to reduce the image size by compacting the VHD file. To save space and reduce the size of a VPC image (several gigs depending on the setup) you can perform the following tasks:
Note! If you do this you might not be able to install additional services for windows that require the service pack files. Also, you will not be able to uninstall service packs and patches that have been installed.
- Make a backup of the VHD you want to compact
- Enable “Show hidden files and folders” in Windows Explorer
- Delete all patch/service pack installation files from the c:\windows folder. This is the files beginning with $NtServicePack.. and $NtUninstall.. Do not delete $hf_mig
- Delete folder c:\windows\ServicePackFiles
- Delete files and folders inside C:\WINDOWS\SoftwareDistribution\Download
- Delete any other unwanted files like the IE cache, temp files etc.
- Reduce SQL logs
- Delete unwanted SQL databases
- Defragment the disk by using the Defrag tool
- Start the VPC and Capture the following ISO-image to add the PreCompact tool: C:\Program Files\Microsoft Virtual PC\Virtual Machine Additions\Virtual Disk Precompactor.iso
- Run the tool in the CD image. This can take anywhere from 5 mins to several hours. Typicall around 10 min for a 5 gig image.
- Shut down the VPC
- Run the Virtual Disk Wizard from the VPC console
- Select “Edit an existing disk”
- Locate the VHD file you want to compact
- Select “Compact it”
- Wait for several minutes until the process is finished
- The vhd size is now reduced. Start the VPC.