It’s inevitable that any Hyper-V virtual machine that stores data will likely eventually need more storage space than what it was initially provisioned with. Thankfully, Microsoft’s Edit Virtual Hard Disk Wizard makes the process of expanding a virtual hard disk simple. Even so, there are several things that you will need to consider before expanding a virtual hard disk.
1. Figure out how much disk space is actually available
In some cases, you might not have to worry about physical disk space. Maybe you’ve got a large storage pool with a vast amount of free space available, and you only need to add a relatively small amount of space to the virtual hard disk in question. Sometimes that happens. If you’re going to perform a virtual hard disk expansion that consumes a significant amount of the available storage space, you will need to consider how much space you actually have available to work with. This is going to work a little bit different in every organization, but let me show you an example from my own environment.
I have a virtual machine named Mirage. This virtual machine contains four virtual disks, all of which are stored on a physical volume named F:. In the interest of keeping things simple, let’s assume that Mirage is the only VM that is using the F: volume.
If you look at the next image, you can see that the F: volume has 18.8TB of free disk space available. Even though I need to add a lot of disk space to one of the virtual hard disks, I can’t claim all 18.8TB. The reason for this is that by default, Hyper-V creates dynamically expanding virtual hard disk files. This means that unless I specifically chose to create fixed-length virtual hard disks, the virtual hard disk files will continue to grow as data is added.
In all fairness, nothing stops me from claiming all 18.8TB of available disk space. If I did that, however, I risk over-provisioning the system and having virtual hard disks run out of disk space even though Hyper-V has the illusion that there is plenty of space available.
The best way to avoid this problem is to examine each virtual hard disk to determine its maximum size. The easiest way to do this is to open File Explorer inside the virtual machine and check each volume’s size (assuming that the virtual machine is not storing multiple volumes on a single virtual hard disk). In the next image, you can see that I have a 126GB, a 7TB, a 4TB, and a 9.76TB virtual hard disk present. By comparing the space used to the space available, it is possible to determine how much physical disk you can get away with using before you have to worry about over-provisioning the disk space.
2. Expanding the Hyper-V virtual hard disk is easy
The actual virtual hard disk expansion process couldn’t be easier. Right-click on the virtual machine within Hyper-V Manager, and then select Settings from the shortcut menu. When the Settings page appears, click on the virtual hard disk you want to expand and click the Edit button. This will launch the Edit Virtual Hard Disk Wizard.
When prompted by the wizard, choose the Expand option and then specify the new size for the virtual hard disk. Click Next, followed by Finish to complete the process.
3. Storage replication can limit your ability to expand a Hyper-V virtual hard disk
Another important thing to consider is that although it is easy to think of a virtual machine as being a self-contained entity, there are situations in which you may have to perform some additional disk space utilization checks beyond what you have already done. In fact, the Mirage virtual machine is a perfect example of this.
The Hyper-V host on which the virtual machine resides is configured to replicate the virtual machine to another host. That way, there is a second copy of the virtual machine available if the primary host suffers a catastrophic failure. Hyper-V replication creates full copies of the virtual hard disks, as opposed to using shared storage the way that failover clustering does. This means that the storage array attached to the replica host will also need to be able to accommodate the storage space added to the virtual hard disk.
4. Consider your backups
One aspect of virtual hard disk expansion that is often overlooked is that any time you expand a virtual hard disk, there is the chance that doing so could adversely affect your backups. In my case, I use a Continuous Data Protection solution, but I also make weekly backups to removable hard disks. Expanding the virtual hard disk means that has the virtual hard disk file grows in size. It will eventually exceed the capacity of the removable hard disks that I use for backups. As such, those backup hard disks will need to be replaced with disks of a larger capacity. Granted, this is unique to my environment, but it underscores the point that major changes to virtual machine storage warrant considering how the changes might impact your backup architecture.
5. Your virtual machine may not be able to use the available space
If you are enlarging a virtual hard disk that will be used by a virtual machine’s data volume, then there is a good chance that you’ll be able to enlarge the virtual hard disk without any issues. But what if you are attempting to enlarge a boot volume? You may find that although you can expand the virtual hard disk at the Hyper-V level, the Windows Disk Management Console (which runs inside of the virtual machine) might not be able to expand the volume to take advantage of the available space. As such, you’ll want to consider any limitations within the virtual machine’s operating system that might prevent the virtual disk expansion from being successful.
Incidentally, you can launch the Disk Management Console by logging into the virtual machine and entering the DiskMgmt.msc command at the Run prompt. When the Disk Management Console loads, you should see the existing volume along with the free space that is now available. Right-click on the volume and choose the Extend Volume command from the shortcut menu, as shown below. Now follow the prompts to expand the volume to take advantage of the newly added space.
You will need to use the Disk Management Console to add space to the virtual machine’s volume.
As you can see, adding space to a Hyper-V virtual hard disk is a simple process. Even so, there are often a number of additional factors that must be considered before moving forward with a storage expansion.
Featured image: Shutterstock