Share via


New tool for precompacting virtual hard disks

Compacting your dynamically expanding virtual hard disks (VHDs) reduces the amount of disk space they use. Preparing a disk and compacting it is covered in the Virtual Server 2005 Administrator’s Guide, so I won’t go into it here. What’s new is this: you used to have to use a third-party tool to zero out available blank space on the VHD before compacting it. Now you can use a tool that's included with Virtual PC 2004 SP1 -- the Virtual Disk Precompactor.

If you have Virtual PC 2004, you can simply install SP1 to get this utility.* Otherwise, you’ll need to download the trial version of Virtual PC 2004, and then install SP1. (If you try to install it on your Windows Server 2003 machine, you'll get a warning that it isn't a supported OS. You can ignore the warning.)

To use Virtual Disk Precompactor, you must first capture Virtual Disk Precompactor.iso, which is installed with Virtual PC 2004 SP1. For instructions on capturing media, see "Add or remove a CD or DVD drive" in the Virtual Server 2005 Administrator's Guide. Virtual Disk Precompactor.iso is located in %ProgramFiles%\Microsoft Virtual PC\Virtual Machine Additions\.

After you capture Virtual Disk Precompactor.iso, you can run Virtual Disk Precompactor from the command line by navigating to the CD drive of the virtual machine and typing Precompact. The available parameters are:

  -Help - Displays help for the precompactor.

  -Silent - Runs the precompactor in unattended mode.

  -SetDisks - Specifies the disks to be precompacted. If this parameter isn't specified, then all virtual hard disks for this virtual machine are compacted.

Example: Precompact -Silent -SetDisks:CDE

Note that you can only compact dynamically expanding virtual hard disks. To compact fixed-size VHDs, you can convert them to dynamically expanding VHDs, compact them, and then convert them back to fixed size.

* As announced in my posting of January 12, 2005 (https://blogs.msdn.com/megand/archive/2005/01/12/351756.aspx), this tool also will be available in Virtual Server 2005 Service Pack 1.

Comments

  • Anonymous
    January 01, 2003
    Q: Lach writes with this question: "I have 2 virtual machines installed, and had them set up as dynamic...

  • Anonymous
    January 01, 2003
    Q: Lach writes with this question: "I have 2 virtual machines installed, and had them set up as dynamic...

  • Anonymous
    January 01, 2003
    PingBack from http://ilenextlheidi.stmhost.com/2008/02/09/dealing-with-a-vhd-that-grew-too-large/

  • Anonymous
    January 01, 2003
    <p>&lt;ul&gt;&lt;li&gt;Nehéz és hosszú szülés után... ami főleg időhiánynak köszönhető... kérjük azokat, akik szívesen olvasnak (=azt a keveset), hogyha talál vmi érdekeset, akár el is küldheti :)&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;ht

  • Anonymous
    December 25, 2004
    I know I'm a little late here, but it hit me today while I was replying to a Virtual Server newsgroup post: Will we see the "pre-compactor" released for Virtual Server as well (or better yet, just as a download at Microsoft.com)? I know that the VS Administrator's guide gives info on compacting (and I quote, "Use a non-Microsoft disk utility program to "zero out" deleted data, which overwrites the data with zeros.",) but the same way that having the ability to zero and compact is a very welcome addition to Virtual PC, it would also be welcomed for Virtual Server.

    Thanks!

    Jonathan

  • Anonymous
    December 28, 2004
    I'll keep you (and other readers) posted about broader availability of the pre-compactor, Jonathan.

  • Anonymous
    December 28, 2004
    Thanks Megan, I'll be looking forward to it.

    Jonathan