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.
By the way, the whole process to expand the disk and VHD doesn’t take very long to complete.
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…
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.
Select Expand and then click Next.
Change the size to increase the space and then click Next. In my case, I will increase the size by a factor of 10.
Click Finish to complete the VHD expansion process.
Click OK to close the Settings window and then start the VM.
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.
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…
Click OK to accept the conversion of Disk 1 to a dynamic disk.
Read the warning message and then click on Yes.
Ensure that Disk 1 is selected and then right-click on the volume and select Extend Volume…
Accept the defaults to use the new size and click Next.
Click Finish to complete the extension of the disk within the operating system.
Within Computer Management, you can now see that Disk 1 is using the full drive space available to it.
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.