Modify a virtual hard disk

Applies To: Windows 7

Windows Virtual PC provides you with a way to make certain types of changes to virtual hard disks. This topic explains the changes you can make by using the Modify Virtual Hard Disk Wizard and provides instructions.

You can make the following types of changes to a virtual hard disk:

  • Compact. This reduces the size of the .vhd file used by the dynamically expanding virtual hard disk or differencing disk as much as possible. Typically you would compact a virtual hard disk after you install the guest operating system (which uses many temporary files) and after you delete large amounts of data. For dynamic disks only, you must run the Precompactor tool before you compact the virtual hard disk to remove unused space from the disk. Otherwise, compacting the disk will not reduce the size of the .vhd file. For instructions, see the “To prepare a dynamic disk for compacting” procedure in the following section.

  • Convert. You can convert fixed virtual hard disks to dynamically expanding virtual hard disks, and can convert dynamically expanding virtual hard disks to fixed virtual hard disks. A common reason for converting to a dynamically expanding disk is to prepare for compacting a disk.

Note

Before you try to convert a dynamically expanding virtual hard disk to a fixed virtual hard disk, make sure that you have enough physical storage space for the virtual hard disk (.vhd) file. The conversion process creates a fixed-size virtual hard disk that is the same size as the maximum size that was originally specified for the dynamically expanding virtual hard disk. As a result, the fixed-size virtual hard disk file may be significantly larger than the dynamically expanding virtual hard disk file.

  • Merge. You can distribute the contents that are stored in a differencing disk by merging the differencing disk. You can merge the changes to either the parent disk or a new virtual hard disk. Merging to the parent disk modifies the parent disk with all the changes stored in the differencing disk, and then deletes the differencing disk. Merging to a new virtual hard disk retains both the parent disk and the differencing disk in their current state, and creates a new virtual hard disk that is a combination of the parent disk contents and the differencing disk contents.

Note

If the Undo Disks feature is configured for a virtual machine, you also can modify a virtual hard disk by applying the changes stored in an undo disk file. For more information, see Use Undo Disks.

To prepare a dynamic disk for compacting

  1. From the guest operating system, run Disk Defragmenter.

Important

Do not use the Precompactor tool on a differencing disk. This tool is intended for use only on dynamic disks.

  1. Insert the Precompactor tool into the DVD drive of the virtual machine:

    1. From the virtual machine window, click the Tools menu, and then click Settings.

    2. In the left pane, click DVD Drive.

    3. In the right pane, choose Open an ISO image. Type %systemdrive% in the text box and click Browse.

    4. Navigate to Program Files (86)\Windows Virtual PC\Integration Components\Precompact.iso, click Open, and then click OK.

  2. Switch back to the guest operating system. If Auto run does not start the tool automatically, navigate to the DVD drive.

  3. The dynamic disk is now ready to be compacted.

To compact a virtual hard disk

  1. Open the settings for the virtual machine. Do one of the following:

    • In the Virtual Machines folder, right-click the name of the virtual machine, and then click Settings.

    • From the virtual machine window, click the Tools menu, and then click Settings.

  2. In the left pane of the Windows Virtual PC Settings page, click the name of the disk setting where the virtual hard disk is attached, such as Hard Disk 1, Hard Disk 2, or Hard Disk 3.

  3. Click Modify. The Modify Virtual Hard Disk Wizard opens.

  4. Click Compact virtual hard disk. The Compact virtual hard disk page opens and lists the properties of the disk. Click Compact.

Note

Elevated privileges are required to compact a differencing disk. Depending on how User Account Control settings are configured, you may be prompted to decide whether to allow Windows Virtual PC to compact the disk.

  1. The wizard compacts the disk and reports the results. Click Close.

  2. Click OK to close the Windows Virtual PC Settings page.

To convert a virtual hard disk

  1. Open the settings for the virtual machine. Do one of the following:

    • In the Virtual Machines folder, right-click the name of the virtual machine, and then click Settings.

    • From the virtual machine window, click the Tools menu, and then click Settings.

  2. In the left pane of the Windows Virtual PC Settings page, click the name of the disk setting where the virtual hard disk is attached, such as Hard Disk 1, Hard Disk 2 or Hard Disk 3.

  3. Click Modify. The Modify Virtual Hard Disk Wizard opens.

  4. Click Convert to <new> disk type. The Convert virtual hard disk type page opens and lists the properties of the disk. Click Convert.

  5. The wizard converts the disk and reports the results. Click Close.

  6. Click OK to close the Windows Virtual PC Settings page.

To merge a differencing disk

  1. Open the settings for the virtual machine. Do one of the following:

    • In the Virtual Machines folder, right-click the name of the virtual machine, and then click Settings.

    • From the virtual machine window, click the Tools menu, and then click Settings.

  2. In the left pane of the Windows Virtual PC Settings page, click the name of the disk setting where the differencing virtual hard disk is attached, such as Hard Disk 1, Hard Disk 2, or Hard Disk 3.

  3. Click Modify. The Merge the differencing disk with parent disk data page opens.

  4. Choose one of the following:

    • To create a new virtual hard disk, click New file. Use this option if you want to leave the parent disk intact.

    • To modify the parent disk by updating it with the changes stored in the differencing disk, click Parent file.

  5. Click Merge. When the merge is finished, the parent disk or the new disk is attached to the virtual machine at the hard disk setting where the differencing disk was attached before you merged the disk.

  6. Click OK to close the settings for the virtual machine.

See Also

Concepts

About virtual hard disks
Use Undo Disks
Windows Virtual PC Help