Windows 2012 R2 and Windows 8.1 Partition Resize

Unlike on their predecessors, on Windows Server 2012 R2 and Windows 8.1 (and later), you can resize the system partition online without having to shut the OS down.

And since I've got a thing for Powershell, I'll suggest a couple of cmdlets that will get the job done.

First of all, you have to make sure that there is unpartitioned space on the disks. In most cases you'll be expanding a virtual machine's partition so you'll have to resize the virtual disk first.

The cmdlet we're going to use is Resize-Partition and you can find the definition here. Before we start resizing we have to identify the disk number of the disk and the partition number. The Get-Disk cmdlet will help you with the disk numbers and the Get-Partition with the partition number.

When you have the partition and disk number, you have to decide the new partition size and you're ready to resize.

If you want the partition to take up all the free space left on the disk, you can use the Get-PartitionSupportedSize cmdlet. Store the output of this cmdlet for your disk and partition numbers on a variable and use the SizeMax property to get the maximum supported partition size.

Just an example of extending a partition to it's maximum size:

$size = (Get-PartitionSupportedSize –DiskNumber 0 –PartitionNumber 2)
Resize-Partition -DiskNumber 0 –PartitionNumber 2 -Size $size.SizeMax

Popular posts from this blog

Domain Controller Machine Password Reset

Configuring a Certificate on Exchange Receive Connector

Running Multiple NGINX Ingress Controllers in AKS