Running out of space on a Windows Server C: drive is a critical issue that can cause applications to crash and the operating system to halt. In modern virtualized environments (like VMware, Hyper-V, or AWS EC2), adding physical storage to a virtual disk is easily done from the hypervisor console. However, Windows Server will not automatically use this new space; you must instruct the OS to expand the existing volume into the unallocated space. While this can be done via the Disk Management GUI, PowerShell offers a much faster method, particularly useful for Server Core installations.
Step 1: Rescan the Disks
After you have expanded the virtual disk at the hypervisor level, you need to tell Windows to rescan the storage bus so it recognizes the newly added unallocated space.
Open an elevated PowerShell prompt and run:
Update-HostStorageCache
Note: If you are using an older version of Windows Server, you may need to use diskpart to trigger a rescan by typing diskpart, then rescan, then exit.
Step 2: Identify the Partition to Expand
Next, identify the specific partition you want to resize. Usually, the C: drive is Partition 2 or 3 on Disk 0. Run the following command to list your partitions and their current sizes:
Get-Partition | Select-Object DiskNumber, PartitionNumber, DriveLetter, Size, Type
Locate the row where the DriveLetter is C. Note the DiskNumber and PartitionNumber.
Step 3: Find the Maximum Supported Size
Before expanding, you should check how much unallocated space is actually available for that specific partition to consume.
Get-PartitionSupportedSize -DriveLetter C
This command returns two values: SizeMin and SizeMax. The SizeMax value represents the absolute maximum size the partition can be expanded to (which includes the newly added unallocated space).
Step 4: Resize the Partition
Finally, use the Resize-Partition cmdlet to expand the C: drive to its maximum available size. You can pass the SizeMax value from the previous command directly into the resize command to ensure you consume all available space.
$MaxSize = (Get-PartitionSupportedSize -DriveLetter C).SizeMax
Resize-Partition -DriveLetter C -Size $MaxSize
The operation completes almost instantly. You can verify the new size by running Get-Volume -DriveLetter C. The server does not require a reboot, and the new storage space is immediately available for the operating system to use.