Expanding Virtual Hard Disks with Hyper-V

Expanding Virtual Hard Disks with Hyper-V

  • Comments 11

Hyper-V adds the ability to increase the maximum size of a dynamically expanding or fixed-size virtual hard disk.  To do this you need to open the Edit Virtual Hard Disk Wizard (by selecting Edit Disk... from the Hyper-V manager), select the virtual hard disk you want to expand, select Expand on the Choose Action page and then enter the new size of the virtual hard disk that you want.

Three things to note:

  • You can't do this to a virtual hard disk that is associated with a running or saved stated virtual machine.
  • You shouldn't do this to a virtual hard disk that is associated with a virtual machine that has snapshots (as you will invalidate the snapshots).
  • After expanding the virtual hard disk there will be an empty space at the end of the virtual hard disk.  You will either need to create a new partition to use the new space, or expand an existing partition into the new space.

Cheers,
Ben

Leave a Comment
  • Please add 4 and 4 and type the answer here:
  • Post
  • Sorry to go OT from the post, but I can't find an answer to this anywhere.

    Can Virtual PC run on Windows Server 2008?  I know I could use Hyper-V, but I want to run a 32-bit OS on my desktop, and Hyper-V is 64-bit only at the moment.

  • Can you reduce the VHD size the same way ?

    without using the Precompact and Compact tools ?

  • "You can't do this to a virtual hard disk that is associated with a running or saved stated virtual machine."

    Hmm, now I need to find time for an experiment.  On a real machine, hibernate Windows XP, dd the entire drive to the front of a larger drive, swap drives, and try to resume Windows XP  ^_^

    If you swap other devices while XP is hibernating then usually it handles them with no problem after resuming.  So actually I've wondered why Virtual PC requires guests to be fully shut down before making the same kinds of virtual changes.

  • It seems a VM can’t be moved from one host to another, as easy as Virtual Server. I have a small VM environment, one Windows file server, store all VM images; three VM host machine, run ~5 VM on each host, all VMs run directly from file server.

    From time to time, I need to switch VM to host B from Host A. In Virtual Server 2005R1 (it is a little bit slow but great and easy to use), all I need to do is unregister VM from Host A, then register it on Host B. No VM and VHD file copy is needed as every file stored on file server.

    However, on Hyper-V, I have to re-create VM machine on Host B, move all VHD files to this VM machine and run it. It takes time and easy to make mistake. Is there any way “register” VM to Host B without doing lengthy import/export?

    I don't use SCVMM, it is overkill for my simple environment.

  • I made a mistake of doing the 2nd item on your three things to note:

    "You shouldn't do this to a virtual hard disk that is associated with a virtual machine that has snapshots (as you will invalidate the snapshots)."

    Is there a way to salvage the VHD and the snapshots and all the VM data? Can I revert the VHD size back to the original size?

  • Good morning.

    I essentially have the same problem with Windows Server 2003 - My question is Where do I go in the Disk Manager to expand the volume?

    Thank you much,

    Bahram Saghari

  • I am using diskpart.exe to extend C: and it complains that it cannot be extended.

  • We are running out of space on our Hyper V VHD, it is configured as a fixed VHD; I want to expand the VHD now but unable to do it as I have snapshots on my VHD (as per Note#2) and the edit button is not enabled. Is there any way using which I can expand the VHD; with out loss of data

  • This is a great post, and Guy your information is most helpful.  I have to say in the same breath that this is one of the most assinine requirements yet out of Redmond.  Your hard drive is running out of space, so you stop your production machine, and expand your disk from 30 gig to 100 gig.  Walk away thinking about how great and proactive an administrator you are, only to have your machine sieze up the next night, the accounting system offline and corrupts the database because there was no WARNING that you must go into disk manager on the virtual machine and expand the drive.... WAIT I already effing expanded it once.  Why do you have to get bit in the *** every time by Microsoft a hundred different times with every new MS product?  How about a little MAC thinking around here and make the products intuitive?

  • Thank you, I almost expanded a disk when it was in use. But then I read your blog.

  • Not being able to expand drives for 2008 guest OS? VMware can do it, so I'll just consider this an issue that MS doesn't want to fix.

Page 1 of 1 (11 items)