Windows OS Hub
  • Windows Server
    • Windows Server 2016
    • Windows Server 2012 R2
    • Windows Server 2012
    • Windows Server 2008 R2
    • SCCM
  • Active Directory
    • Group Policies
  • Windows Clients
    • Windows 10
    • Windows 8
    • Windows 7
    • MS Office
    • Outlook
  • Virtualization
    • VMWare
    • Hyper-V
  • PowerShell
  • Exchange
  • Home
  • About

Windows OS Hub

  • Windows Server
    • Windows Server 2016
    • Windows Server 2012 R2
    • Windows Server 2012
    • Windows Server 2008 R2
    • SCCM
  • Active Directory
    • Group Policies
  • Windows Clients
    • Windows 10
    • Windows 8
    • Windows 7
    • MS Office
    • Outlook
  • Virtualization
    • VMWare
    • Hyper-V
  • PowerShell
  • Exchange

 Windows OS Hub / Hyper-V / Dynamic Resizing of Virtual Disks in Windows Server 2012 R2

January 28, 2014 Hyper-VWindows Server 2012 R2

Dynamic Resizing of Virtual Disks in Windows Server 2012 R2

Hyper-V WindowsServer 2012 R2 came up with a new function Online VHDX Resize that allows dynamic VHDX resizing of the working virtual machine (i.e. online).  Online VHDX Resize allows both to extend and to compact a virtual disk. In this article we’ll deal with the features of this technology and its limitations.
[accordion]
[tab title=”Contents of this article”]

Contents:
  • Common Features of Online VHDX Resize
  • Requirements and Limitations of OnlineVHDXResize Function
  • How to Extend VHDX in Windows Server 2012 R2
  • How to Shrink VHDX in Hyper-V 2012 R2
  • VHDX Resizing with Powershell

[/tab]
[/accordion]

Common Features of Online VHDX Resize

  • It is possible to change the disk size (including the system disk of the guest OS) on-wire with no need to turn off the virtual machine.
  • Online VHDX Resize works both on the first and the second generation of virtual machines Hyper-V.
  • Both Windows and Linux can act as a guest OS.
  • Both extension and shrinking of virtual disks are supported.

Requirements and Limitations of OnlineVHDXResize Function

First of all, we’ll consider the requirements to be observed to successfully resize the virtual disk on-the-fly.

  • Only VHDXs can be dynamically resized. VHDs are not supported and have to be converted into the VHDX format (How to convert VHD into VHDX in Windows Server 2012)
  • VHDX to be resized should be mounted to the virtual SCSI controller (not the IDE)
  • Resizing of shared VHDX files used in the cluster is not supported
  • Snapshots of the virtual machine do not allow VHDX resizing

How to Extend VHDX in Windows Server 2012 R2

Let’s describe the procedure of VHDX extension in detail.

  1. Choose the virtual machine in the virtual machine manager Hyper-V and go to its settings (Settings).
  2. Choose the virtual disk and click the Edit button.hyper-v  2012 r2 edit disk size
  3. In the appearing wizard choose Expandexpand disk hyper-v 2012 r2
  4. Specify the new size of the virtual hard disk (in our example we’ll expand the disk size to 170 GB).new vhdx size
  5. Then click Finish.
  6. Go to the console of the guest OS, which disk was extended. Open the console of the Disk Manager. As you can see, extra 42 GB of unallocated space appeared in the system.unallocated space on virtual disk inside virtual machine
  7. Right-click the partition you want to extend and choose Extend Volume, then specify the size of its extension due to the unallocated space.windows server - extend volume
  8. After completing the Extend procedure, the disk size will be increased.

How to Shrink VHDX in Hyper-V 2012 R2

Let’s move on to the description of the VHDX shrinking.

  1. Before shrinking the virtual disk, you should «cut a piece» from one of the volumes, thus making some space unallocated. To do it, open the Disk Manager of the guest OS, select a  volume and click Shrink Volume.how shrink volume in windows
    Note.  Shrink Volume becomes available only if there is some free space on the disk.
  2. Specify the amount of space to shrink the partition by (in our example we specified 50GB).Shrink partition in guest windows os
  3. After the partition of the guest OS has been shrunk, go to the settings in the Hyper-V console and click the Edit button again.
  4. Click Shrink in the wizard and specify the amount of space to shrink the VHDX file.Online VHDX Resize windows server 2012 r2
  5. Done.

VHDX Resizing with Powershell

You can also change the size of the VHDX in Powershell with the cmdlet Resize-VirtualDisk. It looks as follows:

1
Resize-VirtualDisk -FriendlyName "ISCSIVHD1" -Size (30GB)

Resize-VirtualDisk -FriendlyName "ISCSIVHD1" -Size (30GB)

Note. Earlier the cmdlet resize-vhd was used to resize the virtual disks. However, the virtual machine had to be turned off.

You can change the size of the file system in the guest OS partition using the command:

1
resize-partition -driveletter C -size (30GB)

resize-partition -driveletter C -size (30GB)

1 comment
0
Facebook Twitter Google + Pinterest
next post
Activation of Data Deduplication in Windows 8.1

Related Reading

Installing a Let’s Encrypt Free SSL Certificate on...

April 19, 2018

Installing KMS Server on Windows Server 2012 R2

April 11, 2018

How to Clear Pagefile.sys at Shutdown in Windows...

April 10, 2018

SMB 1.0 Support in Windows Server 2012 R2...

April 2, 2018

How to Install .NET Framework 3.5 on Windows...

February 20, 2018

1 comment

DANILO March 18, 2016 - 12:26 pm

How to shrink  vhdx with IDE controller ?

Reply

Leave a Comment Cancel Reply

Categories

  • Active Directory
  • Group Policies
  • Exchange
  • Windows 10
  • Windows 8
  • Windows 7
  • Windows Server 2016
  • Windows Server 2012 R2
  • Windows Server 2008 R2
  • PowerShell
  • VMWare
  • MS Office

Recent Posts

  • Installing a Let’s Encrypt Free SSL Certificate on IIS in Windows Server 2012 R2

    April 19, 2018
  • How to Disable “Open File Security Warnings” in Windows 10, 8 and 7

    April 18, 2018
  • Outlook 2016: Manual Setup Exchange Account

    April 16, 2018
  • Cannot Access SMB Network Shares after Windows 10 1709 Upgrade

    April 12, 2018
  • Installing KMS Server on Windows Server 2012 R2

    April 11, 2018
  • How to Clear Pagefile.sys at Shutdown in Windows 10 / 8 / 7

    April 10, 2018
  • Searching AD Groups and Users using Wildcards

    April 5, 2018
  • How to access VMFS Datastore from Linux, Windows and ESXi

    April 3, 2018
  • SMB 1.0 Support in Windows Server 2012 R2 / Windows Server 2016

    April 2, 2018
  • Securing Administrative (Priveleged) Accounts in Active Directory

    March 27, 2018
woshub.com

Follow us

  • Facebook
  • Twitter
  • RSS
Popular Posts
  • How to Connect a USB Drive Directly to a Hyper-V VM
  • How to Convert VHD into VHDX
Footer Logo

@2014 - 2018 - Windows OS Hub. All about operating systems for sysadmins


Back To Top