< Blog

How to Expand a Disk within a VM That Is Using a VHD File

By Garth Jones

Oh no! This screenshot is telling me that there is a BIG problem. My VM only has 9.06 MB of space free!! Yikes!!! How did I let this happen? I need to fix this fast!

How to Expand a Disk within a VM That Is Using a VHD File-Problem 

In this blog post I will show you how to expand a VHD to give it more space. By the way, the whole process to expand the disk and VHD doesn’t take very long to complete.

How to Expand a Disk within a VM That Is Using a VHD File-Step 1 

To fix this problem, first begin by shutting down the VM. Next, in Hyper-V Manager, highlight your VM and then right-click on it in order to bring up the menu options. Select Settings…

How to Expand a Disk within a VM That Is Using a VHD File-Step 2

In the Settings window, select the VHD that needs to be expanded (in my case it is the second VHD) and then click on the Edit button.

How to Expand a Disk within a VM That Is Using a VHD File-Step 3

Click Next.

How to Expand a Disk within a VM That Is Using a VHD File-Step 4

Select Expand and then click Next.

How to Expand a Disk within a VM That Is Using a VHD File-Step 5

Change the size to increase the space and then click Next. In my case, I will increase the size by a factor of 10.

How to Expand a Disk within a VM That Is Using a VHD File-Step 6

Click Finish to complete the VHD expansion process.

How to Expand a Disk within a VM That Is Using a VHD File-Step 7

Click OK to close the Settings window and then start the VM.

How to Expand a Disk within a VM That Is Using a VHD File-Step 8 

Next, the drive within the operating system (OS) itself needs to be expanded. Logon to the VM and open Computer Management and then expand the Disk Management node.

How to Expand a Disk within a VM That Is Using a VHD File-Step 9 

Before extending the volume, I will convert the drive to Dynamic Disk first. To do this select the disk and click Convert to Dynamic Disk…

How to Expand a Disk within a VM That Is Using a VHD File-Step 10

Click OK to accept the conversion of Disk 1 to a dynamic disk.

How to Expand a Disk within a VM That Is Using a VHD File-Step 11 

Click Convert.

How to Expand a Disk within a VM That Is Using a VHD File-Step 12 

Read the warning message and then click on Yes.

How to Expand a Disk within a VM That Is Using a VHD File-Step 13 

Ensure that Disk 1 is selected and then right-click on the volume and select Extend Volume

How to Expand a Disk within a VM That Is Using a VHD File-Step 14

Click Next.

How to Expand a Disk within a VM That Is Using a VHD File-Step 15

Accept the defaults to use the new size and click Next.

How to Expand a Disk within a VM That Is Using a VHD File-Step 16

Click Finish to complete the extension of the disk within the operating system.

How to Expand a Disk within a VM That Is Using a VHD File-Step 17

Within Computer Management, you can now see that Disk 1 is using the full drive space available to it.

How to Expand a Disk within a VM That Is Using a VHD File-Free Space

You can also see in the above screenshot that there is lots of free space on the E:\ drive!

Now it’s time for me to solve the problem of WHY the VHD filled-up in the first place. Turns out the culprit was SQL Server SSRS database transaction logs, but that’s a story for a different blog post!

If you have any questions, please feel free to contact me, @GarthMJ.