none
how do i reduce the size of a boot disk hyper-v vm?

    Question

  • I accidently create a virtual machine fixed disk size of 300 instead of 30 and installed everything on the machine.  The total size that is used is about 14gigs and probably wont get much above that (its a test box).  How do I reduce the size of the virtual machines primary virtual disk to 30?
    Thursday, May 14, 2009 10:06 PM

Answers

  • I'm sure everyone will offer their favorite solution, but I'd

    1)  Create a new virtual disk of the correct size
    2)  Boot the VM to an imaging disk or ISO file (like Windows PE with Ghost)
    3)  Ghost the big disk to the small one
    4)  Disconnect the big disk
    5)  Boot the VM and ensure it all works

    Shane Cribbs
    Thursday, May 14, 2009 11:49 PM

All replies

  • I'm sure everyone will offer their favorite solution, but I'd

    1)  Create a new virtual disk of the correct size
    2)  Boot the VM to an imaging disk or ISO file (like Windows PE with Ghost)
    3)  Ghost the big disk to the small one
    4)  Disconnect the big disk
    5)  Boot the VM and ensure it all works

    Shane Cribbs
    Thursday, May 14, 2009 11:49 PM
  • Shane has given the best process, use your imaging product of choice.

    There is no VHD shrinking tool, no one has ever written one over many years.

    The pricess of imaging and then applying the image has worked for many folks over the years.

    Some products:  Ghost, ImageX (from the WAIK), BartPE custom disk, Altiris, etc.

    Brian Ehlert (hopefully you have found this useful)
    Friday, May 15, 2009 2:28 AM
    Moderator
  • Man I really hoped that wouldn't be the case.  I can't believe that there isn't a way to shrink a vhd on the fly.  Ah well, thanks for the suggestions.
    Friday, May 15, 2009 5:22 AM
  • Server 2008 R2 does include an option when creating a new virtual disk to copy the contents from another one.  It would be indeal for your situation, but I assume your not running R2 RC in your environment, yet.

    Shane Cribbs
    Friday, May 15, 2009 9:17 PM
  • I can't believe that there isn't a way to shrink a vhd on the fly. 

      I can't believe that you expected one to exist. Who would have written it, an why? What real-life operation would it emulate?
    Bill
    Sunday, May 17, 2009 7:59 AM
  • The use case is very real.  However, the frequency is very infrequent.

    So when you weight frequency against the need, the very low frequency ends up winning.  Thus no-one has bothered making such a tool.

    Also - think about it this way - how does this emulate a physical system?  How frequently do you install a smaller hard disk in a computer.
    The most frequent case for reducing disk size is a "whoops" type of incident.  The only other case is some type of virtualization conversion and then only when the conversion does not give you the option of creating a new, smaller disk.

    But in the end, Bill is right.  What is the case?  And how frequent does it happen?

    Brian Ehlert (hopefully you have found this useful)
    Monday, May 18, 2009 1:40 PM
    Moderator
  • Actually all the way back to the Hyper-V v1 beta there was an option to create a VHD from a Physical Disk.
    R2 just gives to the chance to mount a virtual disk natively, thus making it appear as a physical disk.

    Beyond that, this isn't a new feature.  If you could mount a disk in a way that causes it to appear in Disk Management then you could do the same function with the v1 release.
    The problem side of this is that many VHD mounting tools don't present the VHD at this level.  They present the VHD within the user shell, thus the core system cannont interact with it, but the user can browse it through the shell.

    Brian Ehlert (hopefully you have found this useful)
    Monday, May 18, 2009 9:06 PM
    Moderator