You’ve likely found this page because you have a Windows virtual machine that has low space on the C: drive. You added more space to the VM using your hypervisor administration tool but when you log into the VM to try and extend the C: drive, you find yourself confronted with the problem below:
The EFI System partition is sitting between your C: drive and your free space meaning that the “Extend” option on the C: drive is greyed out. Well crap, now what?
I spent a lot of time Googling this but I never found a satisfactory answer. Most of what I did find involved dealing with the recovery partition being to the right of the C: drive and doing various things to remove it.
The problem is we can’t remove the EFI System partition as it’s required for Windows to boot. We somehow need to move the EFI system partition from the right side of the C: drive to the left. But how?
Below are the steps I’ve found that have worked for me. Of course, this information is provided as-is. Ensure you have complete backups of your drive before proceeding.
At a high level the solution is not to ‘move’ the EFI partition but rather to delete it entirely and then rebuild it on a new partition created from extra space from the recovery partition. We do this with a combination of a third party open source partitioning tool and a Windows command to rebuild the partition. Here’s how it works:
Additional Considerations (As noted by commenter Siegfried):
- The solution described here will steal space from the recovery partition reducing the total size of the recovery partition. This could potentially cause issues in the future in a Windows Update for example if Windows tries to perform an update on the recovery partition and insufficient space is available.
- This solution may not properly assign a GUID to the EFI partition that could result in unexpected issues. A better alternative may be to create the free space from the recovery partition in Gparted but then create the partition itself using the Windows command “create partition efi size=100” This has not yet been tested by me as the solution described seemed to work from me but is provided here for additional context.
- Download GParted from here: https://downloads.sourceforge.net/gparted/gparted-live-1.5.0-1-amd64.iso
- Boot the ISO in your VM. If it doesn’t boot, ensure Secure Boot is disabled in the VM and that the firmware is set to boot the DVD drive first. Press enter on all defaults until the gparted GUI application as launched
- Your screen should look like the one below with the first partition being the recovery partition, the second being your C: Drive, the 3rd being the EFI System Partition that’s preventing you from resizing your C: drive and finally the unallocated space we want to add to the C: drive
- Select the fat32 ~100MB EFI System partition and choose Delete and then Apply all Operations checkbox at the top
- Select the Recovery partition, right click and choose Resize/Move and add 100 to Free Space following (MiB) and press Resize/Move (if the button is greyed out, press tab to switch focus which should light up the button
- Your view should now look like this with a 100MB unallocated partition BEFORE the main C: drive data partition
- Right click on the 100MB unallocated partition and choose New. Set the partition name to EFI System partition and the filesystem to fat32 and press Add
- Press the Apply changes button and close gparted
- The system will not boot at this time. Insert the Windows installation media ISO. In my example I’m using a Windows Server 2019 ISO
- When you get to the Windows Setup main page press Shift-F10 to bring up a command prompt
- Type diskpart
- Type select disk 0
- Type list volume
- Make note of the the drive letters assigned to your 100MB EFI partition and your large C: drive. If no drive letter is assigned type select volume # (where # is the 100MB EFI Volume) followed by assign letter = s to mount it as the S: drive
Rebuild the EFI System partition by typing the command bcdboot c:\windows /s [drive letter of your system partition] (in the example above that is mounted as “C:”)
For example, in the example screenshot above the command would be bcdboot e:\windows /s c:. You should see the output below
Important: In the example above the C: drive is the EFI partition and the E: drive in the data partition. I realize now how confusing that is.
Type exit and reboot your computer and try to boot normally.
You should find your EFI System partition is indeed now to the left of your C: drive and you can extend your C: drive as desired: