How To Expand VHD Disk Size in Hyper-V?

VHD disk files can be of fixed size or dynamically grown. We can specify the size of the VHD file at the time of creation. It can be done in both cases whether you are creating a virtual hard drive on a virtual PC or you are using a virtual server. The size of the file can also be changed after the creation. If you also want to expand VHD disk size then this article can help you out.

By increasing the VHD  disk size you can store more applications and data on the virtual hard disk. You can resize the storage size of the VHD File by using these methods.

Expand VHD Disk File Using Command Prompt

There could be a situation when you realize that the size of the VHD file is not enough or more than the storage needed as it is specified. The solution for this could be the dynamic VHD file but you set a limitation as maximum size at the time of the VHD creation. So, to remove this issue you can use the diskpart command.

Step 1. Press Win+R and open Run tab.

Step 2. Type diskpart and enter.

Step 3.  UAC will ask you for permission. Hit the Yes button.

Step 4. Select the virtual disk using the following command:

                     select vdisk file=”C:\path\to\vdisk.vhd”

Step 5. Now, expand the virtual hard disk using the following command:

                     expand vdisk maximum=15000

  These commands will help you to expand VHD disk. But, the problem is the partition will remain the same. 

Resize VHD Disk Partition:

you can use the following commands to resize the partition of the VHD file:

  1. select vdisk file=”C:\path\to\vdisk.vhd”
  2. attach vdisk
  3. list volume
  4. select volume=<No of volume>

At the place “No of volume”, enter the number of the volume (After watching the output of the “list volume” command).

  1. extend size=200
  2. Now, detach the file by the following command:

                    detach vdisk

In the above example, the partition will get extended by 200 MB. So, you can define it as you want to enlarge the partition size. 

If still, you are not able to resize your virtual hard drive then there could be corruption in your VHD file. You can remove the corruption using the VHD Repair Utility and then you can easily resize virtual hard drive.

Sum-Up

The above-mentioned method makes it easy to expand VHD disk and make it suitable for your needs. You can easily install more applications, store more files or can shrink the file size to make it compact. I hope, it helped you out.

If you want to shrink the VHD disk size then read here: How to compact or shrink hyper-v vhd disk