Move EFI System Partition to another drive
My recommendation is to not bother. The performance improvement will be negligible, because the files read from the ESP are tiny and are read only when the computer boots. Furthermore, the partition itself is tiny by modern standards, so you won't recover enough space to make the effort worthwhile. Furthermore, the attempt to move the ESP runs a risk of creating boot problems that will take far more time to fix than any time you could possibly save in improved boot time from the move.
If you want to go ahead and do this as a learning experience despite my recommendation, you'll need to look into:
- Creating an ESP with whatever partitioning software you like. I'm not sure how you'd do this with the standard Windows tools. With
gdisk
, you'd create a partition of type EF00, but you'd then need to create a FAT filesystem on it, sincegdisk
is a partitioning-only tool (it doesn't handle filesystems). - Mounting both ESPs simultaneously to copy files (or in sequence using temporary storage). I'm not sure how to do this in Windows, although it would be easy in Linux or from an EFI shell. (It would be automatic in an EFI shell, in fact.)
- Registering the boot loader on its new home. (Using the fallback filename of
EFI\BOOT\bootx64.efi
would likely be a simpler alternative, but is the less preferred method of loading the boot loader.) The Windowsbcdedit
command and the EFI shell'sbcfg
tool can both register boot loaders; however,bcdedit
is inflexible because Windows supports just one ESP, which creates problems when copying the ESP.
For people like me coming from Google: Yes, it is possible to do this with Windows, without any third-party tools. Tested with Windows 10 Pro x64. I used this procedure to move both the EFI System Partition and the System Reserved partition. It should work on Windows 8 as well.
If your primary drive lacks space, first you'll need to shrink your C: partition (or equivalent). I'm using 260 MB in this example as that's what newer drives require, but older drives with smaller sectors only require 100 MB. If you don't need to make space, take note of the comments that indicate which steps you should skip.
While you're at it, you probably want to move your System Reserved partition. These are typically 1000 MB and store useful Windows metadata. You may find that some Windows features don't work without a System Reserved partition. I've included the steps for creating such a partition on your primary drive and marked those steps with comments. It should be easy to exclude those steps if you'd rather skip them, but you'll need to alter the numbers when shrinking (e.g., 260 MB instead of 1260 MB).
Comments are prefixed with REM
(for "remark"), as these are supported both by cmd.exe and diskpart.exe.
From cmd.exe running as an administrator:
diskpart
list disk
REM Choose the appropriate disk number from the list. If you're unsure, you can open diskmgmt.msc; the numbers will be the same.
sel disk 0
list part
REM Perform the following only if you need to shrink a partition to make space for the EFI partition.
REM Choose the appropriate partition from the list. I used my C: partition.
sel part 2
shrink desired=260
REM End of shrinking operation.
REM Create a new EFI partition:
create part efi size=260
format quick fs=fat32
list vol
REM Find your newly created volume in the list. If it's not already selected (marked with an asterisk), select it now with "sel vol #".
REM You'll need to give the volume a drive letter for later:
assign
list vol
REM Note the drive letter that the volume has been given. Mine was F:, so I'll use that in the example.
REM Done creating new EFI partition.
REM Optionally create a new System Reserved partition:
create part msr size=1000
REM Done creating new System Reserved partition.
REM We're done with diskpart.exe:
exit
REM You should no longer see the DISKPART> prompt.
REM Note that you may need to change these drive letters, particularly F:. F: should match the volume you created previously.
bcdboot C:\Windows /s F: /f UEFI
REM We no longer need a drive letter for the EFI partition, so we should remove it:
diskpart
list disk
REM Change disk number appropriately.
sel disk 0
list vol
REM Change volume number appropriately.
sel vol 2
REM Remove drive letter assignment:
remove
REM Exit diskpart.exe:
exit
REM Exit cmd.exe:
exit
It's time to reboot to make sure that everything works. You may need to update your BIOS boot order settings to match the changes. In my case, the BIOS settings were already correct, so I was stuck in a reboot loop; each time I wanted to boot my computer, I had to manually select the old drive with the misplaced EFI partition.
If everything worked as expected, you'll be able to delete the old EFI partition. If it didn't work, or your BIOS is still configured to boot from the old partition, Windows won't let you delete it, even if you use the override flag in diskpart.exe. Since you probably want to get rid of that old partition anyway, deleting it is a great way to make sure you're booting from the new partition.
diskpart
list disk
REM Change disk number appropriately.
sel disk 2
list part
REM You can repeat this next group of steps to delete as many "special" partitions as you like. I had 4 reserved partitions from an old OEM installation. Just make sure you don't delete your data! The "override" flag is only necessary for partitions that can't normally be deleted.
REM Change partition number appropriately.
sel part 1
del part override
REM When you're done, exit diskpart.exe:
exit
REM Exit cmd.exe:
exit
I know this is an old post, but I think a good answer is still wanted by many.
This is applicable for Windows 7, 8, 10. And is also valid for Event id: 12290 if the ESP partition is situated on a disk other then the one that is the active OS and is to be backed up.
First disconnect any other drive containing ESP partitions, so you don't accidentally change that one.
Then you have to create a new partition at 100 - 300 MB on the disk you want the ESP partition to reside on. If the drive is full, first you have to shrink one of the existing partitions.
Boot, in my case, Xubuntu 13 (Ubuntu above 12.1 I think) from a USB stick, live. Don't install it.
Open Gparted and create the partition and format it to FAT32. Flag the drive as "boot" and unflag any other partition flagged as "boot". Also assign the new partition a drive letter if possible. If not, you can do it with diskpart later on.
Restart and now boot up with Windows (RE) Recovery from the Windows installation DVD. Go to the command prompt. Start diskpart and assign the new partition a drive letter if that was not possible in Gparted. Exit diskpart but stay in the command prompt.
Now you are going to copy the necessary files into the new partition.
bcdboot <source> /S <ESP drive letter>: /f UEFI
NOTE the spaces!
Example: bcdboot c:\Windows /s x: /f UEFI
This command will as well give the partition ESP status.
Rebuild the BCD using the following command:
bootrec /RebuildBcd
Now when you are asked what OS you'd like to add to the ESP partition, you say Yes to the ones you want to include and No to the ones you don't want to be able to boot into. As in my case I recently upgraded to Windows 10, and as you might know, Windows will store your old Windows 7/8 for a while if you haven't deleted it yourself. This copy of your old OS is not something you normally like to be able to boot into. It normally resides in Windows.old
.
So don't chose the All alternative.
I don't know, but I think that this command only searches for Windows installations. If you got a Linux OS for example on the same computer. Then you have to use something like bcdedit afterwards to get the on the boot meny aswell.
There is a last command, which I didn't use.
bootrec /fixboot
I have tried to learn more absout the command and I think it just set the boot flag on the ESP partition and makes it bootable. This should be the same as when I flagged the ESP partition as boot in Gparted.
If there was another ESP partition you no longer want, the easiest way is to boot into Linux/Gparted again and delete it from there.
I created a fresh installation on a new SSD disc by using genuine W10 installation ISO (DVD). The installation went to MBR type instead of GPT. I needed Secure boot so I had to convert this new installation (without data loss) from MBR to GPT.
Then I created free space (260 MB) by shrinking last NTFS partiton at the end of the disc (I booted Linux from SystemRecueCD from USB stick and used gparted, but Disc manager from Windows 10 could be used too).
Then I formated this new small partition to FAT32 (it could be done in Windows or in Linux too). I copied files from the original EFI to this new partition (I did it in Linux because Windows do not like two discs with drive letter named C:).
Then I changed MBR to GPT by gdisk in Linux. I used gdisk and then this small partition has to be changed to type ef00 (EFI) and marked as bootable (should be only one, so the bootable flag should be removed from the original bootable drive C:).
Then I changed booting type in the SETUP of the notebook to UEFI-only just to be sure that it really boots by EFI. Windows did not boot as there was some file missing (with 'efi' in its name).
Then I booted from Windows 10 installation DVD, picked "Rescue system" and then something like "Fix boot problems". Then Win10 booted with no problem. No manual intevention needed by bcdboot.
The EFI configuration could be checked by efibootmgr utility in Linux.