Often you need to expand virtual machine disk when system drive runs out of free space. For example, you have increased the disk size in VMware or Hyper-V virtual machine settings, and now you need to increase the volume inside the guest operating system (Windows).
Extend Volume option is grayed out in Windows Disk Management console
Open the Disk Management console (diskmgmt.msc
) and right-click on the partition you want to extend (in my example, it’s a logical volume assigned the drive letter C:\). as you can see, turn up the volume The option is grayed out. The fact is that you can extend a volume in Windows only if there is no unallocated space on it. Right its.
In my case, the recovery partition is between volume C: and Unallocated space. You cannot extend the C: partition because there is a recovery (Windows RE) partition on the right side of it. that’s why “Extend Volume
The option is inactive (greyed out).
You will not be able to extend a disk volume in Windows (Windows Server) if:
- To the right of the partition you want to extend is another partition;
- The partition is formatted with a file system that does not support extensions (FAT32, exFAT). Only NTFS/ReFS volumes can be extended;
- You cannot create partitions larger than 2 TB on a disk with an MBR partition table. For large drives (over 2 TB) use a GPT partition table. You can convert MBR to GPT without data loss using the built-in Mbr2gpt.exe tool. You can check the current partition table type on the Volumes tab of a disk in Device Manager. In this example, my Windows 10 is installed in EFI mode on a VM disk with a GPT partition.
In this article, we will see how to properly extend partition (system drive C:) in Windows if Extend Volume option is not available (greyed out) in Disk Management console. If this prevents (blocks) your volume from mounting then you need to move or delete the recovery partition.
It is strongly recommended to back up (or create a snapshot of) your drive before making changes to the partition table.
Cannot extend volume due to Windows recovery partition
In the simplest case, you can just move the recovery environment files from the WinRE partition to system drive C: and delete the 541MB recovery partition entirely.
First, assign a drive letter to the recovery partition. Open command prompt as administrator and run:
diskpart
List available local disks:
list disk
Select your disc:
select disk 0
Display a list of partitions.
list part
Select the recovery partition (in your case it may be a different partition number):
select partition 4
Assign it a drive letter R:
assign letter r:
exit
Disable Windows Recovery Environment (WinRE):
reagentc /disable
Now you need to extract the recovery partition with a size of 541 (in our example, it is partition 4).
If you try to delete the Windows recovery partition from the Disk Management GUI by clicking delete volume (Sometimes the disk properties are not available at all), the following error will appear:
Virtual Disk Manager Cannot delete a protected partition without the force protected parameter set.
You can delete such protected partition simply by using diskpart tool. Open elevated command prompt and run diskpart command. Select the partition you want to delete (note the results of your commands, as the number of disks and partitions may vary).
DISKPART> rescan
DISKPART> list disk
DISKPART> select disk 0
DISKPART> list part
DISKPART> select part 4
DISKPART> delete partition override
DiskPart successfully deleted the selected partition.
defy The parameter allows Diskpart to delete any partition regardless of its type (be it an active, system or boot partition).
DISKPART> Rescan
Please wait while DiskPart scans your configuration... DiskPart has finished scanning your configuration.
DISKPART> exit
Enable WinRE and update the ReAgent.xml configuration file with the command:
reagentc /enable
Run the following command to verify that the recovery environment WIM file has been rebuilt on drive C:
bcdedit /enum all | find "osdevice"
ramdisk=[C:]\Recovery\WindowsRE\Winre.wim,{e668f79e-60da-11ed-b27a-ea3359f08732}
Check your current WinRE configuration:
reagentc.exe /info
Windows Recovery Environment (Windows RE) and system reset configuration Information: Windows RE status: Enabled Windows RE location: \\?\GLOBALROOT\device\harddisk0\partition3\Recovery\WindowsRE Boot Configuration Data (BCD) identifier: e668f79d-60da-11ed-b27a-ea3359f08732 Recovery image location: Recovery image index: 0 Custom image location: Custom image index: 0 REAGENTC.EXE: Operation Successful.
In this example, we’re completely deleting a separate 540MB partition for WinRE. winre.wim
The recovery environment file is now located on the system partition where Windows is installed.
Now you can expand your system partition (drive C:):
- open the
diskmgmt.msc
to console; - Right-click on the partition you want to extend and select turn up the volume,
- Specify the amount of space in MB that you want to extend your partition. In my case, I’ll be increasing the C: drive by 5 GB. Click Next -> Finish;
- The system partition has been successfully extended.
Windows locates the recovery partition by a special label: GUID — de94bba4-06d1-4d40-a16a-bfd50179d6ac
and GPT attribute 0x8000000000000001
,
Move Windows Recovery Partition to End of Disk with GParted LiveCD
If you are afraid of deleting an existing partition on the disk, you can move that partition using third-party tools that prevent it from extending to the end of the disk. you can use free GParted ,gnome partition editor) boot image to manage partition offline. It is a live CD based on Linux Debian with a graphical frontend for the parted tool (a console-based utility for managing disk partitions in Linux). download iso image gparted-live-1.4.0-6-amd64.iso Here (about 490MB).
Boot your virtual machine from the gparted-live ISO image (if you want to extend the partition on the physical computer, you can move the ISO image to a USB flash drive) Rufus utility).
Select Continuously:
- don’t touch the keymap
- Default English language (33)
- Mode 0 – Keep starting X to use GParted automatically
The graphical partition editor GParted will start automatically.
Find the partition you want to move to the right. Note that GParted uses Linux partition naming. The easiest way to find your Windows recovery partition is by its size. in our case, it is /dev/vvme0n1p4 Partition with a size of 541MB. Right-click on a partition and select resize move,
specify the value of 0 in Free Space Following (MiB) Field to move the partition to the end of the disk.
press resize move button. To start moving partitions, click Edit -> apply all operations in the top menu. In my case, a small partition of 500MB was transferred in a few seconds.
Reboot the VM and start Windows. Open the Disk Management console. As you can see, the recovery partition has been moved to the end of the disk. The unallocated area is now on the right side of the volume with the drive letter C:\.
turn up the volume The option is now available and you can extend the system partition on your drive. The Windows Recovery Environment will not be affected.
Leave a Comment