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.
For advanced administrators, the DiskPart command-line tool might be more direct and faster compared to the GUI-based Disk Management tool. However, there is a disadvantage: it only lists individual partitions without showing their structure. To better demonstrate how the DiskPart Shrink command works, the steps below show both tools opened at the same time.
Steps to shrink partition with Diskpart on Windows Server 2012 R2:
Step 1: Type list volume and press Enter in the Diskpart command prompt window; then, you will see all partitions.

Step 2: Type select volume 2 and press Enter to give focus to the C drive.
Step 3: Type shrink desired=10240 and press Enter. Diskpart will report that it successfully shrunk this volume by 10GB.

If you want to shrink drive D, repeat from Step 1.

You cannot shrink the E drive because it is a FAT32 partition; you will receive the error message: "The volume cannot be shrunk because the file system does not support it."

Restrictions When Shrinking Partition with Diskpart
By typing help shrink, Diskpart lists the restrictions of the Shrink command, including:
- It is used to generate unallocated space from unused space at the end of this volume. (It cannot generate 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 the Diskpart extend command nor Disk Management can help you. This is because unallocated space cannot be combined into the adjacent partition on the right or any non-adjacent partitions. Learn why you cannot extend a volume in Server 2012 Disk Management.
Better Way to Shrink Drive with NIUBI
It is better to shrink partitions in Windows Server with NIUBI Partition Editor. Compared to Diskpart shrink command, NIUBI has advantages such as:
- Both NTFS and FAT32 partitions are supported.
- Disk partitions will be shown with their structure and other detailed information.
- Unallocated space can be generated on either the left or right side while shrinking a partition.
- It can move "unmovable" files to shrink a volume to much smaller size.
- It can dynamically change the 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:
Compared to other disk partition tools for Windows Server, NIUBI Partition Editor is much safer and faster because of its powerful technologies:
- Hot Clone - Clone disk partitions in Windows for backup, migration, and fast disk swapping.
- Virtual Mode - All operations are listed as pending for preview, and real disk partitions won't be modified until you click "Apply" to confirm.
- Cancel-at-Will - If you applied incorrect operations, you can safely cancel the ongoing operations at any stage before completion.
- 1 Second Rollback - If any error is detected while resizing partitions, it can immediately and automatically revert the disk partitions to their previous state.
- Advanced File-Moving Algorithm: Resize and move partitions 30% to 300% faster, saving significant time, especially when handling a large number of files.

