Expanding a disk in a Hyper-V environment

table of contents
My name is Ito and I am an infrastructure engineer.
When it comes to virtual environments for Windows, there's Hyper-V.
The convenient thing about virtual environments is that you can change the specs later.
However, the procedure for adding disks is a little more complicated than for CPUs and memory.
So, here are the steps for adding disks to Hyper-V!
The procedure can be broadly divided into two steps
- On the Hyper-V side
- Working in a virtual OS
Procedure on Hyper-V side
First, on the Hyper-V side, increase the capacity of the virtual HDD used for the virtual OS
*To expand the virtual HDD, you must shut down the virtual OS.*
The following steps will be taken after shutdown
Locate the VHD file
Check the location of the HDD you are using for the virtual OS
Check the settings of the target virtual OS.
The boxed area is the location of the VHD file.

Expanding a VHD file
Once you have confirmed the location of the VHD file, you can actually expand it
From the Hyper-V management screen, click "Edit Disk."

Select the location of the VHD file you found earlier

"Extend"

Determine the size of the VHD file after expansion

The VHD file has now been expanded.
However, although the VHD file has been expanded, it has not yet been expanded on the virtual OS side.
It is recognized by Windows, but no partitions have been allocated.
So you need to expand the partition in the OS
Working in a virtual OS
We will start up the virtual OS that was shut down and expand it
From "Server Manager", go to "Storage" - "Disk Management".
(For client OS, it is "Computer Management".)
Since you are expanding the disk capacity, you will probably have some "unallocated" space

Right-click the drive you want to expand and select "Extend Volume."

The Extend Volume Wizard will appear.
If you want to extend the entire volume, just click "Next" to complete the wizard.
Done!!!

Points to note
Generally, you can only a drive that has unallocated space to its right
your partitions are set up as "C drive, D drive, unallocated" and
you want to expand the C drive, you will first need to delete the D drive.
Be careful as it's quite a hassle
21