Hyper-V Windows Server 2012 R2 has a function that allows dynamic VHDX resizing of virtual disks in Windows server 2012 r2.
As a part of our Server Management Services, we help our customers to resize virtual disks on Windows server 2012.
Today, let’s see what our Support Engineers do to resize virtual disks on Hyper-V Windows Server 2012 R2.
How to do dynamic resizing of virtual disks in Windows server 2012 r2?
Windows Server 2012 R2 uses ‘Online VHDX Resize’ which allows both to extend and to compact (shrink) a virtual disk.
Using Online VHDX Resize we can change the disk size on-wire without turning off the virtual machine. Both Windows and Linux can act as a guest OS.
We should keep in mind that only VHDXs can be dynamically resized
Steps to Extend VHDX in Windows Server 2012 R2:
Online VHDX Resize allows extending VHDX in Windows Server 2012 R2, the steps followed by our Support Engineers to do this are given below:
- Choose the virtual machine in the virtual machine manager Hyper-V
- And go to its Settings.
- Choose the virtual disk.
- Click the Edit button.
- In the appearing wizard, choose Expand.
- Specify the new size of the virtual hard disk as required.
- Then click Finish.
- Go to the console of the guest OS of the disk extended.
- Open the console of the Disk Manager, we can see unallocated space appearing in the system.
- Right-click the partition we want to extend.
- Choose Extend Volume, then specify the size of the extension.
- After completing the Extend procedure, the disk size will be increased.
[Need further assistance? We are here for you!]
Steps to Shrink VHDX in Hyper-V 2012 R2:
We can shrink the size of VHDX in Windows Server 2012 R2 few easy steps given below:
- Before shrinking the virtual disk, we should “cut a piece” from one of the volumes, thus making some space unallocated.
- To do this, open the Disk Manager of the guest OS.
- Select a volume and click Shrink Volume. (Shrink Volume becomes available only if there is some free space on the disk.)
- Specify the amount of space to shrink the partition.
- Once the partition of the guest OS has been shrunk, go to the Settings in the Hyper-V console.
- Click the Edit button again.
- Click Shrink in the wizard that appears.
- Specify the amount of space to shrink the VHDX file.
- After this step, we can see that space has shrunk.
[Need assistance to Shrink VHDX? We are here for you!]
VHDX Resizing with PowerShell (Alternative method):
We can change the size of the VHDX in PowerShell with the cmdlet Resize-VirtualDisk.
Resize-VirtualDisk -FriendlyName “ISCSIVHD1” -Size (50GB)
Earlier the cmdlet resize-vhd was used to resize the virtual disks. However, the virtual machine had to be turned off.
We can change the size of the file system in the guest OS partition using the command:
resize-partition -driveletter C -size (50GB)
In short, we’ve discussed how to do dynamic resizing of virtual disks in Windows server 2012 r2. Also, we saw the steps followed by our Support Engineers do this.