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

by | Mar 22, 2017 | How-To, Tips

Last updated on August 1st, 2022 at 03:17 pm

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! This blog post will show you step-by-step how to expand a disk within a VM that’s using a VHD file.

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

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.

Step 11 - Convert 

Click Convert.

Step 12 - Warning Message

Read the warning message and then click on Yes.

Step 13 - Extend Volume 

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.

Step 16 - Click Finish

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.

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 about how to expand a disk within a VM that’s using a VHD file, please feel free to contact me, @GarthMJ.