This article explains how to extend a volume using the diskpart command on Windows Server 2012 R2, the limitations of the diskpart command, and a better method for extending partitions on Windows Server 2012/2016/2019/2022/2025.
How to extend volume with Diskpart command
Besides the GUI-based Disk Management tool, Windows Server 2012 also includes DiskPart, which allows you to create, delete, format, shrink, and extend partitions, among other tasks. DiskPart operates via the command prompt, a feature that has been integrated into Windows since XP. Compared to Disk Management, the DiskPart command is much easier and faster for extending partitions. However, both tools have limitations when extending hard drive partitions. To better demonstrate how the DiskPart Extend command works, I will open both tools at the same time.
- To open Disk Management, press the Windows key + X on your keyboard and select Disk Management from the list.
- To open Diskpart command prompt: press the Windows key + R on the keyboard, type "diskpart" and press Enter.
Steps to extend 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 individual partitions without structure. Original C: drive is 30GB, and unallocated space is not shown by Diskpart.
Step:2 Type select volume C or select volume 2 and press Enter.
Step:3 Type extend and press Enter. If you want to indicate an amount, type extend size=10240 in MB (there is only 10GB Unallocated behind C in my server)
C: drive is extended to 40GB by merging the contiguous unallocated space.
Diskpart cannot extend drive D because it is a FAT32 partition.
You'll receive error message - "The volume cannot be extended because the file system does not support it." When you right click drive D in Disk Management, Extend Volume option is grayed out.
If you right click drive E in Disk Management, Extend Volume is also disabled.
In Disk Management console, unallocated space deleted from a primary partition cannot be extended to any logical drive. Free space deleted from a logical drive cannot be extended to any primary partition.
But Diskpart can extend drive E successfully.
Restrictions when extend partition with Diskpart cmd
Although Diskpart is better than Disk Management tool while extending disk partition. It also has restrictions. In Diskpart command prompt window, type help extend and you'll see these restrictions.
To be short:
- On basic disk, there must be adjacent unallocated space on the right side of the volume that you want to extend.
- Only the partitions that are formatted as NTFS or without filesystem (RAW) can be extended.
If you try to extend a partition without adjacent unallocated space on the right, you'll receive error message - "There is not enough usable free space on specified disk(s) to extend the volume."
Whether you shrink a volume (such as D:) using the Disk Management tool or the DiskPart command, unallocated space can only be created on the right side of D. As a result, this unallocated space cannot be extended to the non-adjacent drive C or the right contiguous partition E.
This means that if you want to extend the C: drive, you must delete partition D to create adjacent unallocated space. However, in many servers, programs or Windows services are running from D, so deleting it is not an option. In other words, both the DiskPart command and Disk Management are not useful if you want to extend a partition by shrinking another one.
Better way to extend disk partition on Server 2012 R2
Compared to the DiskPart command, NIUBI Partition Editor is the better choice, because it is much more powerful.
- Both NTFS and 32 partitions can be shrunk and extended.
- Unallocated space can be create on either left or right while shrinking a partition.
- Unallocated space can be combined to either adjacent partition by 1 step.
- Unallocated space can be moved and then combined to any nonadjacent partitions.
- Drag and drop to operate, you'll see disk partition structure and other information all the time.
- You can cancel the operations if you performed by mistake.
Download NIUBI and follow the steps in the video to shrink and extend partition in Windows Server 2012:
Compared to other disk partition software, NIUBI Partition Editor is much safer and faster because of the innovative technologies:
- Virtual Mode: To prevent mistakes, all operations are listed as pending for preview. Real disk partitions are not changed until you click "Apply" to confirm.
- Cancel-at-will: If you apply incorrect operations, you can cancel ongoing tasks without worrying about partition damage.
- 1 Second Rollback: If any error is detected while resizing partitions, the software can automatically revert the server to its original state in an instant.
- Hot Clone: Clone disk partitions without interrupting the server. You can clone the system disk before making changes or as part of a regular backup routine.
- Advanced File-Moving Algorithm: Resize and move partitions 30% to 300% faster, saving significant time, especially when handling a large number of files.