The same with all previous versions, system C drive is running out of space in Windows 2019 server. When it happens, you'd better expand C drive before it becomes full. Otherwise, you'll encounter many problem such as server stuck and reboot unexpectedly. To extend partition in Windows Server 2019/2022, there's a native tool - diskpart. Unlike Disk Management, it runs via command prompt. This article introduces how to extend C drive with diskpart in Windows Server 2019/2022 and the shortages to extend volume with diskpart command in in Server 2019/2022.
How to extend C drive with diskpart in Windows Server 2019/2022
To extend volume with diskpart in Windows Server 2019/2022 and other versions, your disk partition must meet all requirements below:
- The partition that you want to extend must be formatted with NTFS file system. (It is not an issue to system partition C.)
- There must be another partition (such as D:) contiguous and on the right of C drive.
- You must delete the right contiguous partition before expanding C drive. (Don't do this if you installed programs in this volume.)
Steps to extend C drive with diskpart in Windows Server 2019/2022:
- Press Windows and R together on your keyboard, type diskpart and press Enter.
- Type list volume in diskpart.exe command prompt and press Enter.
- Type select volume D and press Enter.
- Type delete volume and press Enter.
- Type select volume C and press Enter.
- Type extend and press Enter.
Immediately, diskpart reports successfully extended the volume. Run list volume again, C drive is extended from 40GB to 110GB.
- Steps 2 is not required, but it displays the initial partition size and other information, so it's helpful.
- Before you delete, shrink or extend a partition, you must select it to give focus.
- If you want to extend part of Unallocated space to C drive, type extend size=XX (XX is an amount without MB) in Step 6.
Shortages to extend partition in Server 2019/2022 with diskpart command
1. Unallocated space must be contiguous and on the right side
Type help extend in diskpart command prompt window, you'll see the syntax and limitation of extend command.
As you see, the free (Unallocated) space must be on the same disk and immediately follow the volume or partition with focus. If you shrink D to expand C drive with diskpart, you'll receive error "The size of the extend is less than the minimum". In fact, this error message is not accurate, maybe it's easier to understand if change the error message to "There's no contiguous free space".
After you shrink D drive with Diskpart shrink command, Unallocated space is generated on the right of D drive, so it is non-adjacent to C drive. Shrink command cannot make Unallocated space on the left side. This is the reason why you should delete the right contiguous drive (D:) before extending C drive with diskpart in Windows Server 2019.
2. Only NTFS partitions can be extended
As the screenshot shows above, diskpart extend command only supports NTFS partition, FAT32 and any other types of partitions can't be extended.
3. Lack of significant information
Diskpart command prompt only show you all partitions in a list with little information. If you open another inbuilt Disk Management tool, you'll see all disks with partition structure and other information such as used and free space of each partition. So you'll see clearly which partitions are on the same disk and how much free space can be shrunk from and extended to other volume. If you changed the partitions by mistake, they can't be undone.
Better way to extend partition in Windows Server 2019/2022
Comparing with diskpart command and Disk Management, server partition software such as NIUBI Partition Editor is much more powerful. It is able to shrink partition to make unallocated space on either left or right. It can move and merge unallocated space to other partition on the same disk.
Download NIUBI Partition Editor and follow the steps to shrink and extend partition in Windows Server 2019/2022:
Better than other disk partition software, NIUBI Partition Editor is much safer and faster because of the advanced technologies:
- Virtual Mode - all operations are listed as pending for preview, real disk partitions won't be changed until you click "Apply" to confirm.
- Cancel-at-will - if you applied wrong operations, you can cancel the ongoing operations at any progress before finish.
- 1-Second Rollback - if any known error is detected while resizing partition, it automatically reverts server to original status in a flash.
- Hot Clone - clone disk without server interruption, you can clone system disk regularly as backup and boot from the clone disk immediately when system disk is down.
Besides shrinking and extending partitions, this tool helps do many other operations such as move, merge, convert, copy, defrag, hide, wipe, scan bad sectors.