How do you manage your VHD space usage?

How do you manage your VHD space usage?

  • Comments 6


A little while ago I published a number of posts discussing the process I used to move my virtual machines from using dynamically expanding virtual hard disks to using fixed-size virtual hard disks.  There were some interesting questions / discussions in the comments – so I thought I would try to sum them up here:

 

  1. Why would I use dynamically expanding VHDs?

    Dynamically expanding VHDs are easy and flexible.  They are great for quick deployment, and allow you to not worry about how much space is currently available.  When I am doing test work with Hyper-V (and definitely when I am setting up demos with Hyper-V) I almost always use dynamically VHDs. 

  2. Why would I use fixed VHDs?

    The two main advantages of using fixed-size virtual hard disk performance and not having to worry about running out of space unexpectedly.  Of course, the downside is that you have to allocate all of that disk space ahead of time, and potentially waste space if you allocate too much.

  3. When do you (Ben) use dynamically expanding VHDs and when do you use fixed-size VHDs?

    As a general rule of thumb: If I am going to be sitting at the console of the computer when virtual machines are running, I use dynamically expanding virtual hard disks – but if I expect virtual machines to run for weeks on end without me having anything to do with them, I use fixed-size virtual hard disks.

    For me – I have never had a system where disk performance was so critical that I needed to use fixed-size virtual hard disks, which means it all comes down to space management.

  4. How do you expand a fixed VHD?

    This was a question that came up a couple of times.  An obvious step to take when using fixed-size virtual hard disks is to try and make the virtual hard disks as small as possible, so you do not waste too much space.  But what do you do if a virtual machine needs more than you originally allocate to it?  Thankfully – it is not too hard to increase the size of a virtual hard disk for a virtual machine.  Here are the steps you need to follow to do this:
    1. Shut down the virtual machine
    2. Open the virtual machine settings and find the virtual hard disk that you want to expand
    3. Click the Edit button for the virtual hard disk
    4. Select Expand and click Next
    5. Enter the new size for the virtual hard disk and click Finish
      1. Note – expanding may take a while, depending on how much space you are adding to the disk.
    6. Close the virtual machine settings and boot the virtual machine
    7. Now you need to increase the partition inside the virtual machine – for Windows Server 2008 R2 / Windows 7 you need to:
      1. Login to the virtual machine with an administrative account
      2. Open the start menu, right click on Computer and select Manage
      3. Find the entry for Disk Management
      4. Locate the partition that you want to expand – right click on it and select Extend Volume…
      5. Hit Next twice and click Finish

  5. What about limiting dynamic VHDs?

    A couple of people suggested keeping with dynamically expanding virtual hard disks – but just being careful to not go crazy with maximum sizes for the disks.  One person also suggested creating large dynamically expanding virtual hard disks – but only creating small partitions inside of them (and expanding the partition while the virtual machine was running if more space was needed).  Both of these options seem reasonable – but personally I would not trust myself to calculate my expected disk usage correctly – so I will be sticking with fixed-size virtual hard disks on my production systems.

Cheers,
Ben

Leave a Comment
  • Please add 6 and 2 and type the answer here:
  • Post
  • The last time i tried to enlarge a fixed vhd (exchange database disk) i did exactly as described (shut down, expand, resize partition in guest) but afterwards the disk was empty...?

    This was anyhow a good method to test the recovery from our backup, but still more than a little annoying...

  • Mike -

    I have no idea why that would have happened.  I promise that I manually followed these steps before posting :-)

    Cheers,

    Ben

  • Don't you think fixed size VHD with Undo disks enabled would have been more appropriate for the XP Mode Base VHD than using a differencing VHD? That way users would have had an easy option to give lots more free disk space to the XP Mode VHD, great performance and the differencing VHD not expanding like crazy.

  • I use dynamic to keep BackupExec hyper-v backups small. Am I missing something or do all products transfer the entire vhd before compression?

  • Sorry for the dumb question but...

    i use several VHD on Win7, basically one for each client's setup. Where do i access the Virtual Machine settings? My VHD's are on my C:/ Drive.

    Thanks for your help

  • @XPclient, how would having undo drives allow the end user more free space (the max you can go is 127GB with VPC regardless of differening or undo drives) and instead of your diff drive expanding, your undo drive would.  Plus, how do you deal with the end-users that inadvertently discard their undo drives losing all their data? That would be a huge problem for PSS.

    @Daniel, how did you create these VMs?  The settings are in the same folder ( %userprofile%\virtual machines ) as the menu for creating a new VM.

Page 1 of 1 (6 items)