This page introduces how to shrink volume with Diskpart command in Windows Server 2012 R2, and the method if diskpart cmd cannot shrink partition.
How to shrink volume with Diskpart command
DiskPart is a Windows native disk partition management tool that running via command prompt. It is able to create, delete, format, convert, shrink and extend volume, etc.
To open this tool: press Windows and R on the keyboard, type diskpart and press Enter. In the diskpart.exe command prompt window, type "?" and you'll see all commands. In this article, I just talk about how to shrink partition with Diskpart cmd on Windows 2012 Server.
Comparing with GUI Disk Management tool, Diskpart is easier and faster. However, there is a disadvantage: it only lists all single partitions without structure. To better show you how Diskpart Shrink command works, I open both tools at the same time.
Steps to shrink partition with Diskpart cmd in Windows Server 2012:
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 that "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 make Unallocated space from unused space at the end of this volume. (It cannot make 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 file system or if it does not have a file system.
- 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 other partition after shrink, neither Diskpart Extend command nor Disk Management can help you. Because Unallocated space can't be combined to the right contiguous or any nonadjacent 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 2012 Server with NIUBI Partition Editor. Comparing with 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 made on either side while shrinking a partition.
- It can move "unmovable" files, so it can shrink a volume to minium size if you want.
- Dynamically change size if there is not enough free space.