Shrink and extend partition with powershell in Windows Server 2016

Published on: November 16, 2019

This article introduces how to resize partition with powershell in Windows Server 2016, step by step to shrink and extend Server 2016 volume with powershell.

Many administrators want to resize disk partitions after running the server for a period of time. Some people want to shrink a large volume to create new, some people want to extend C drive when it is running out of space. To repartition hard drive, powershell is one of the choices. This article introduces how to shrink and extend partition with powershell in Windows 2016 server, the shortages and better way to resize partition with 3rd-party tool.

How to shrink partition with powershell in Windows Server 2016

  1. Press Windows and R together on the keyboard to open Run, type powershell and press Enter.
  2. Type diskpart and press Enter in pop-up Windows PowerShell window.
  3. Type list volume and press Enter, then you'll see all single partitions with some parameters.
  4. Type select volume D and press Enter. (D is driver letter or number of the partition that you want to shrink.)
  5. Type shrink desired=20480 and press Enter. (20480 is the amount of free space to shrink in MBR, maximum amount will be used if you did not specify a value.)

In a short time, PowerShell reports that Diskpart successfully shrunk the volume by 20GB. Type list volume again, my D: drive is shrunk from 70GB to 50GB.

PowerShell shrink

Shrunk done

How to extend Server 2016 partition with PowerShell

Before extending volume with PowerShell, you must delete its contiguous partition on the right. If there's no right adjacent volume or you cannot delete it, you cannot extend partition with powershell in Windows Server 2016.

You cannot extend a partition by shrinking any other one. If you extend C: drive with powershell after shrinking D, you'll receive Virtual Disk Service error: The size of the extend is less than the minimum.

Steps to extend partition (C:) with powershell in Windows Server 2016:

  1. Transfer all files in the right contiguous partition D: (in some server is E:) to other place.
  2. Type diskpart and press Enter in PowerShell window.
  3. (optional) Type list volume and press Enter.
  4. Type select volume D and press Enter.
  5. Type delete volume and press Enter.
  6. Type select volume C and press Enter.
  7. Type extend and press Enter.

In a short time, my system C drive is increased from 40GB to 110GB. (There's 20GB Unallocated space behind D drive, this type of space won't be listed.)

Powershell extend

Extend complete

Better way to resize partition in Windows Server 2016

There are many shortages while resizing partition with powershell in Windows 2016 server, for example:

  1. Only NTFS partitions can be shrunk and extended, FAT32 and any other types are not supported.
  2. Unallocated space can only be generated on the right side while shrinking partition.
  3. If there are some "unmovable" files in a partition, powershell can only shrink little free space although there's large amount.
  4. Unallocated space can only be used to create new volume, it cannot be moved or extended to any other partition.
  5. Any operations will be executed immediately.

With NIUBI Partition Editor, there are no such limitations. You just need to drag and drop on the disk map. Unallocated space can be made on either side and extended to any contiguous or non-adjacent partition volume on the same disk.

Download NIUBI Partition Editor and follow the steps in the video to shrink and extend volume in Windows 2016 server.

How to extend C: drive by shrinking other volume:

Video guide

How to extend D: drive by shrinking other volume:

Video guide

  • If you want to shrink partition and extend another non-adjacent volume, there's an additional step to move Unallocated space.
  • Steps are the same no matter you run physical server with SSD, HDD, RAID or virtual server in VMware/Hyper-V.
  • If there's no available free space in a disk, you can copy entire system disk or single data volume to another disk, and extend partition(s) with additional space.

Better than other software, NIUBI Partition Editor has innovative technologies to protect system and data.

Besides shrinking, extending, moving and copying disk partitions, it helps merge, convert, defrag, wipe, hide partition, scan bad sectors and much more.

DOWNLOAD