Nowadays, many people use virtual machines such as Hyper-V and VMware. Comparing with physical computers, virtual machines have advantages such as creating snapshot or checkpoint, easily add, remove and edit simulated hardware. In addition, you can expand storage capacity fast and easily.
The size of a physical hard disk is fixed, so when it is getting full, you have to clone or back up and restore to another larger disk. It costs such a long time especially when this disk is very large. But to virtual hard disk in Hyper-V or VMware virtual machine, you can increase size of the virtual disk without losing data in several minutes.
After expanding a virtual disk, additional space will be shown as unallocated at the end of this disk. If you want to increase disk space of the left contiguous partition with the additional unallocated space, Windows has inbuilt Disk Management to help you. But if you want to add this unallocated space to any nonadjacent volume, third party software is required to move unallocated space.
This article only shows how to increase size of virtual hard disk and partition in Hyper-V.
Common questions regarding expanding Hyper-V disk
Q1: Any difference when increasing disk size of VHD and VHDX?
A: The method to expand either type of virtual disk is the same, but you can't expand VHD disk online, SCSI controller VHDX disks can be increased online.
Q2: Any difference with Hyper-V Generation 1 and 2?
A: No, it doesn't matter if you use Hyper-V Generation 1 or 2, there is no difference while resizing and expanding virtual disk.
Q3: Should I connect virtual disk to virtual machine before expanding?
A: No, it doesn't matter if the virtual disk is connected or not, but you should make sure whether this VHD/VHDX virtual disk is located.
Q4: Can I expand system virtual disk in Hyper-V online (without turning off virtual machine)?
A: Whether Hyper-V virtual disk can be expanded is not depending on Operating System. VHD disk with either IDE or SCSI controller can't be expanded online. VHDX with IDE controller can't be increased online. VHDX with SCSI controller can be expanded online no matter it is system disk or not.
How to check the type and controller of your virtual disk:
How to expand virtual disk size in Hyper-V
There are two common ways to expand Hyper-V virtual hard disk with PowerShell and Hyper-V Manager.
No matter which way, firstly, you should check if the virtual machine is saved or has checkpoints. If yes, none of its disks can be expanded. In that case, delete Saved State and Checkpoint before expanding any types of Hyper-V virtual disk.
Secondly, if the virtual disk that you want to grow capacity is VHD (both IDE and SCSI controller) or VHDX with IDE controller, you should turn off the virtual machine before expanding.
Way 1: How to increase Hyper-V virtual disk size with PowerShell
It is the easiest and fastest way, however, you should locate the position of VHD/VHDX and use absolute path with ''".
Steps to expand VHD/VHDX virtual disk space with PowerShell:
- Open PowerShell from Quick Launch bar or Start menu according to your own Operating System.
- Type Resize-VHD -Path 'E:\yourown.vhdx' -SizeBytes 200gb
200gb here means the final size after expanding, not adding 200GB.
Way 2: How to expand virtual disk size with Hyper-V Manager
Hyper-V Manager has the option to edit disk no matter the VHD/VHDX disk is connected to this virtual machine or not.
Steps to increase size of Hyper-V virtual disk in Windows 10/11 or Server 2008/2012/2016/2019:
1. Open Hyper-V Manager, click the host in left panel, then click "Edit Disk" in "Actions" panel on the right.
In a short while, the system disk in my Hyper-V virtual Server 2012 is increased from 120GB to 160GB, additional 40GB disk space is shown as unallocated at the end.
How to increase disk space of virtual partition
If you want to extend the left contiguous partition (here is D:) with the additional unallocated space, you can achieve with Windows native Disk Management tool. However, there are 2 preconditions:
- This partition must be formatted with NTFS file system.
- This partition is primary. (You'll see the partition type in Disk Management and NIUBI)
Follow the steps to expand virtual partition D in Disk Management if your partition meets the requirements:
- Right this partition in Disk Management and select Extend Volume.
- Simply click Next till Finish in the pop-up Extend Volume Wizard window.
If you want to increase disk space of the non-contiguous system partition C, you need third party software to move unallocated space next to C drive.
Download NIUBI Partition Editor and follow the steps below:
- Right click drive D: and select "Resize/Move Volume", drag the middle of D towards right in the pop-up window.
- Right click system C: drive and select "Resize/Move Volume" again, drag right border towards right to combine the unallocated space.
Follow the steps in the video to increase system partition size after expanding Hyper-V virtual disk:
If partition D is logical or formatted with FAT32, Disk Management can't help you. In that case, simply follow step 2 to merge unallocated space with NIUBI Partition Editor.
The methods above to increase size of Hyper-V virtual disk partition are valid to Windows 11/10/8/7, Windows Server 2008, Windows Server 2012, Windows Server 2016, Windows Server 2019 and Windows Server 2022.