Hyper-V Windows Server 2012 R2 is great in allowing dynamic VHDX resizing of virtual disks in Windows server 2012 r2.
Here at Ibmi Media, as part of our Server Management Services, we regularly help our Customers to to resize virtual disks on Windows server 2012.
In this context, you shall learn how to 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 Experts to do this are given below:
i. Choose the virtual machine in the virtual machine manager Hyper-V
ii. Then, go to its Settings.
iii. Choose the virtual disk.
iv. Click the Edit button.
v. In the appearing wizard, choose Expand.
vi. Specify the new size of the virtual hard disk as required.
vii. Then click Finish.
viii. Go to the console of the guest OS of the disk extended.
ix. Open the console of the Disk Manager, we can see unallocated space appearing in the system.
x. Right-click the partition we want to extend.
xi. Choose Extend Volume, then specify the size of the extension.
After completing the Extend procedure, the disk size will be increased.
[Need additional support in fixing Windows issues ? We are available to help you today !]
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:
1. Before shrinking the virtual disk, we should “cut a piece” from one of the volumes, thus making some space unallocated.
2. To do this, open the Disk Manager of the guest OS.
3. Select a volume and click Shrink Volume. (Shrink Volume becomes available only if there is some free space on the disk.)
4. Specify the amount of space to shrink the partition.
5. Once the partition of the guest OS has been shrunk, go to the Settings in the Hyper-V console.
6. Click the Edit button again.
7. Click Shrink in the wizard that appears.
8. Specify the amount of space to shrink the VHDX file.
After this step, we can see that space has shrunk.
[Need urgent support 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)