This article explains how to shrink a volume using the diskpart command on Windows Server 2012 R2, the limitations of the diskpart command, and a better method for shrinking partitions on Windows Server 2012/2016/2019/2022/2025.
How to shrink volume with Diskpart command
DiskPart is a native Windows disk partition management tool that runs via the command prompt. It can create, delete, format, convert, shrink, and extend volumes, among other tasks. To open this tool, press the Windows key + R on your keyboard, type diskpart, and press Enter. In the diskpart.exe command prompt window, type "?" to see a list of all commands. This article focuses on how to shrink a partition using the DiskPart command on Windows Server 2012.
Compared to the GUI-based Disk Management tool, DiskPart is easier and faster. However, there is a disadvantage: it only lists individual partitions without showing their structure. To better demonstrate how the DiskPart Shrink command works, I will open both tools at the same time.
Steps to shrink partition with Diskpart on Windows Server 2012 R2:
Step:1 Type list volume and press Enter in Diskpart command prompt window, then you'll see all partitions.
Step:2 Type select volume 2 and press Enter to give focus to C drive.
Step:3 Type shrink desired=10240 and press Enter. Diskpart reports successfully shrunk this volume by 10GB.
If you want to shrink drive D, repeat from Step 1.
You can't shrink drive E because it is a FAT32 partition, you'll receive error message "The volume cannot be shrunk because the file system does not support it."
Restrictions when shrinking partition with Diskpart
Typing help shrink , Diskpart lists the restriction of Shrink command including:
- It is used to create unallocated space from unused space at the end of this volume. (It cannot create unallocated space on the left side of this volume.)
- You can reduce the size of a volume only if it is formatted using the NTFS filesystem or if it does not have a filesystem.
- This command does not operate on OEM, ESP or Recovery partitions.
- If a minimum amount parameter is specified but not enough free space is available, the command will fail.
If you want to extend another partition after shrinking, neither Diskpart extend command nor Disk Management can help you. Because unallocated space can't be combined to the adjacent partition on the right or any non-adjacent partitions. Learn why can't extend volume in Server 2012 Disk Management.
Better way to shrink drive with NIUBI
It is better to shrink partition in Windows server with NIUBI Partition Editor. Compared to Diskpart shrink command, NIUBI has advantages such as:
- Both NTFS and FAT32 partitions are support.
- Disk partition will be shown with structure and other detailed information.
- Unallocated space can be create on either left or right while shrinking a partition.
- It can move "unmovable" files to shrink a volume to much smaller size.
- Dynamically change size if there is not enough free space.
Download NIUBI Partition Editor and follow the steps in the video to shrink and extend partition in Windows Server 2012: