When using Virtual PC 2007 or Windows Virtual PC, VHD (Virtual Hard Disk) is an essential part of the Virtual Machine and also the parent of the Virtual machine. vhd files can be divided into four types: dynamic expansion (Dynamically Expanding), Fixed Size (Fixed Size), differential (Differencing), and Linked to a Hard Disk. In Windows 7, we can directly use the disk management tool to create two types of VHD files: dynamic expansion or fixed size, windows Virtual PC and Virtual Server support dynamic expansion, fixed-size and differential types.
After using a virtual machine for a period of time, if the VHD is a dynamic expansion type, as the number of software installed on the Virtual Machine increases, the "weight" of the VHD will inevitably increase day by day, this article will introduce how to "slim down" VHD files, which means to Compact VHD files ). Note that compression only applies to dynamic extended VHD instances. If your VHD is Fixed, you need to convert it to dynamic first. How do I determine what type my VHD is? How to convert to dynamic? See1Part of the content. If your VHD file is already dynamic, you can directly refer2Part and later content.
1. VHD format conversion
Open Windows Virtual PC and find the corresponding Virtual machine file. Click Settings. In the Setting column on the left of the window, findHard Disk 1To obtain the current Virtual Machine VHD file type:
Click the Modify button to convert the format of. vhd. The conversion process may take a long time, depending on the VHD file size:
2. VHD pre-compression
Before you compress VHD, you must perform the pre-compression operation to clear unused space on the virtual disk. Otherwise, subsequent compression operations will not work. In this case, we need to use the Precompact tool that comes with Windows Virtual PC for pre-compression. This tool is under the Windows Virtual PC installation directory.C: \ Program Files \ Windows Virtual PC \ Integration Components \ Precompact. iso. Similarly, we enter the VM setting interface, select "DVD Drive", put Precompact. iso in it, and start the VM:
After entering the Virtual Drive, open the optical drive and executePrecompact.exeStart the pre-compression operation:
Pre-compression in progress, please wait... ...
After a long wait, pre-compression is completed:
3. VHD Compression
After the pre-compression is completed, we will start the actual compression operation. In the setting window, findHard Disk 1, ClickModify:
Select"Compressing a Virtual Disk"(Compact virtual hard disk ):
Continue the long compression wait... ...
After compression, check how much VHD is reduced. Because I have no virtual device, the effect may not be obvious:
References
1. Compacting dynamically expanding virtual hard disks
Http://technet.microsoft.com/en-us/library/cc708394 (WS.10). aspx
2. Modify a virtual hard disk
Http://technet.microsoft.com/en-us/library/ee449414 (WS.10). aspx
3. Virtual Hard Disk Image Format Specification
Http://technet.microsoft.com/en-us/virtualserver/bb676673.aspx