none
Increase the size of a Virtual Machine

    Question

  • Hi All,

    Is it possible to increase the size of a VM after it is deployed and being used for the past 7 months?  My VM vhd is running short of space as Windows updates are installed.

     

    Thanks

     

    Monday, June 14, 2010 7:50 AM

Answers

  • Hi,

    SCVMM:
    Shut down the VM, choose the properties of a VM, choose Hardware, choose the disk and choose "expand" with the new size you want.

    Hyper-V Manager:
    Shutdown the VM, jump to Hyper-V Manager select "Edit disk" choose the .vhd-file and run the wizard with the option "expand".

    After this process is completed you have to extend the disk within the VM. This depends on which OS you are using. A good choice is to use diskpart or the diskmanagement-tools in the GUI. Expanding the disk is not available if you use differncing disks.


    Peter Forster, MVP Virtual Machine, Austria http://www.base-it.at
    Monday, June 14, 2010 2:29 PM
  • You can modify the size of a virtual disk.

    Here are the gotchas:

    1) if you have snapshots, you must delete / merge them so your VM is not running in a snapshotted state.

    1a.) The alternative is to Export a copy of the VM to perform the following steps with.

    (The above warning is very important)

    2) Power off the VM

    3) open the modify Virtual Disk Wizard from the Hyper-V Manager, browse to the virtual disk of the VM, select it, increase its size.

    4) Boot the VM and Extend the partition to consume the extra space (how this is accomplished depends on the OS installed in the VM).

     


    Brian Ehlert (hopefully you have found this useful)
    Monday, June 14, 2010 2:33 PM

All replies

  • Hi,

    SCVMM:
    Shut down the VM, choose the properties of a VM, choose Hardware, choose the disk and choose "expand" with the new size you want.

    Hyper-V Manager:
    Shutdown the VM, jump to Hyper-V Manager select "Edit disk" choose the .vhd-file and run the wizard with the option "expand".

    After this process is completed you have to extend the disk within the VM. This depends on which OS you are using. A good choice is to use diskpart or the diskmanagement-tools in the GUI. Expanding the disk is not available if you use differncing disks.


    Peter Forster, MVP Virtual Machine, Austria http://www.base-it.at
    Monday, June 14, 2010 2:29 PM
  • You can modify the size of a virtual disk.

    Here are the gotchas:

    1) if you have snapshots, you must delete / merge them so your VM is not running in a snapshotted state.

    1a.) The alternative is to Export a copy of the VM to perform the following steps with.

    (The above warning is very important)

    2) Power off the VM

    3) open the modify Virtual Disk Wizard from the Hyper-V Manager, browse to the virtual disk of the VM, select it, increase its size.

    4) Boot the VM and Extend the partition to consume the extra space (how this is accomplished depends on the OS installed in the VM).

     


    Brian Ehlert (hopefully you have found this useful)
    Monday, June 14, 2010 2:33 PM
  • If you want to extend the boot partition you cannot extend it while the VM
    is booted.
    So you need to extend it from the Hyper-v server itself.
     
    You should :
    - use Hyper-v MMC to extend the .vhd file
    - "attach" the VHD file to the hyper-v server .
    You can do it from the drive management or with dispart
    sintax is
    select vdisk file=X:\disk.vhd
    attach vdisk
    - extend the attached volume
    you can do it from the drive management or still from diskpart
    - detach the vhd disk from hyper-v server
    - boot the VM
     
    Tuesday, June 15, 2010 9:52 AM
  • Thanks to all you guys 'Peter Forster', 'Brian Ehlert', 'Stefano_C'

     

    I will try the instructions and let you know. My VM is running Windows Vista Business - N.

     

    Thanks

    Tuesday, June 15, 2010 10:34 AM
  • Hi Brian

    You make it seem so simple.

    I used the edit utility to increase a data drive from 50 to 100 Gb no problem.

    On starting the VM error about IDE could not load, chaining etc. but at least I had a valid backup which I am restoring now.

    At the time I only had 1 snapshot.

    After this unforseen error I googled and found a repaiir utility that fixes this issue but saving time did the restore.

    If I delete all the snapshots will this work for me?

    also how do I tell if the Vdisk is fixed or dynamic? can it be changed?

    running 2008R2

    with thanks

    Larry

    Monday, September 16, 2013 7:32 AM
  • you hit gotcha #1 that I listed in the first reply.

    you want vhdtool to fix your vhd chain.  that is the only solution to prevent data loss.


    Brian Ehlert
    http://ITProctology.blogspot.com
    Learn. Apply. Repeat.
    Disclaimer: Attempting change is of your own free will.

    Monday, September 16, 2013 12:49 PM
  • Thanks Brian

    I have deleted all snapshots but the avdh files are still there? Understood that they would be deleted when using HV console to delete the snapshots.

    Can I now safely delete them from host? wary now as my restore takes over 3 hours and users not impressed.

    have not looked at the vhdtool but was told it is quite daunting. Going to download and play on a lab VM I can easily create to play.

    thanks

    Larry

    Monday, September 16, 2013 2:38 PM
  • If you already changed the size of your root VHD (I am guessing that is what happened) then your snapshots will not delete.

    The root of the error for both issues is essentially the same.

    If you do not want to lose data, you absolutely must fix the snapshot chain.  And the only way to do that is:

    1) recover a copy of the VHD prior to changing its size (your current state is in the snapshots, so data is not lost by recovering this).  Be sure to change the ACLs on it.

    2) use the VHDtool.


    Brian Ehlert
    http://ITProctology.blogspot.com
    Learn. Apply. Repeat.
    Disclaimer: Attempting change is of your own free will.

    Monday, September 16, 2013 3:19 PM