15

I had a Windows 8 installation on an HDD, using UEFI as boot. The HDD has the following GPT table:

DISKPART> list partition

Partizione ###   Tipo              Dim.     Offset
---------------  ----------------  -------  -------
Partizione 1     Ripristino         300 Mb  1024 Kb
Partizione 2     Sistema            100 Mb   301 Mb
Partizione 3     Riservato          128 Mb   401 Mb
Partizione 4     Primario           390 Gb   529 Mb
Partizione 5     Primario           540 Gb   390 Gb

(I apologize it's in Italian, but the translation is quite straightforward).

I recently bought an SSD drive, connected it and installed a fresh Windows 8. Now I have a working dual boot, but the UEFI partition is on the HDD instead of the SSD. Here's the SDD partition list:

Partizione ###   Tipo              Dim.     Offset
---------------  ----------------  -------  -------
Partizione 1     Riservato          128 Mb  1024 Kb
Partizione 2     Primario           221 Gb   129 Mb

I think that the best solution would be to have it on the SSD for two reasons:

the first is performance (I guess it would be a little be faster on the SSD due to the spin up time for an HDD, but I may be wrong about that)

second reason is consistency. As I plan to use only the Windows 8 installation that is located on the SSD and I'm probably going to erase the system partition on the HDD to use it as a data storage device, I think that the boot partition should be on the same drive as the OS.

So the question is how do I move the EFI System Partition to the SSD?

4

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, since gdisk 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 Windows bcdedit command and the EFI shell's bcfg tool can both register boot loaders; however, bcdedit is inflexible because Windows supports just one ESP, which creates problems when copying the ESP.
  • Thank you for your answer. Well I actually prefer to have the ESP in the SSD because I might decide to remove the HDD. So I think that the ESP should be on the OS drive. Anyway, how is the latest point done? – Pincopallino Oct 28 '13 at 17:37
  • Never mind, I managed to move the partition to the SSD and Windows boots regularly. Thank you very much! – Pincopallino Oct 29 '13 at 7:34
  • Some interesting info here that would likely be VERY valuable in explaining what's happening in a generalized HOWTO, but not really answering, "So the question is how do I move the EFI System Partition to the SSD?" I've spent days of my life trying to recover from a bad decision a couple years ago and it still haunts me and in short, it comes down to relocating my EFI partition so I'd love to see a good answer. – rainabba Sep 23 '15 at 22:02
  • Of note, having two EFI partitions sometimes causes Windows update to fail in extremely obscure ways, so delete the old one after moving. – Jack Wasey Jan 16 '18 at 18:17
11

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
  • 1
    A very detailed and well explained answer, which works! Thanks! – kumarharsh Jan 20 '18 at 23:39
2

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 EFI-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 EFI-partitions, so you don't accidently change that one.

Then you have to create a new partition at 100-300MB on the disk you want the EFI-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 flaged 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 promt. Start diskpart and assign the new partition a driveletter if that was not possible in Gparted. Exit diskpart but stay in the command promt.

Now you are going to copy the nessesary files inte the new partition.

{bcdboot /S : /f UEFI} NOTE the spaces!

Example: {bcdboot c:\Windows /s : /f UEFI}

This command will as well give the partition EFI-status.

Rebuild the BCD using the following command:

{bootrec /RebuildBcd}

Now when you are asked what OS you'd like to add to the EFI-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 youre old Windows 7/8 for a while if you haven't deleted it yourself. This copy of youre old OS is not something you normaly like to be able to boot into. It normaly recides 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, witch 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 efi-partition and makes it bootable. This should be the same as when I flagged the efi-partition as boot in Gparted.

If there was another efi-partition you no longer want, the easiest way is to boot into linux/gparted again and delete it from there.

  • For me, everything happens perfectly until it comes to bootrec /fixboot which just throws the same file not found error every time. – kumarharsh Aug 22 '16 at 23:05
  • It seems Windows doesn't automatically mount the Windows partition when it's on another drive, causing boot to always fail. – Jeroen Bollen Mar 29 '17 at 7:26
1

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.

0

Well, let's add yet another solution. My aim was not only copying EFI partition, but even to take into account the other hidden ones. I'm not sure if the order matters (I personally had a different one than that described on msdn) but w/e.

Anyway, I used GParted Live for the feat. Once you got it booting, reduce the Windows main partition (what should be C:) of the same quantity of MiB of the partitions you are missing on the new disk and move it to the end. This will take some time.

Then, I proceeded to make a new 16MiB partition just below the newly resized one where to dd the Microsoft reserved partition (for reasons it seems like parted is unable to handle unformatted FS). As always, when using dd, be extremely careful with commands.

Once done I went back to GParted GUI and manually set the right flags and name for the new MSR partition, then deleted the original one. Last but not least, I finally copied the Recovery and EFI partition from the original HDD to the SSD (and repeated the names/flag operation) and run sgdisk -s to fix partition order.

Reboot, and profit! No need to tinker with efibootmgr or bcdboot, at least on my laptop it automatically found the new ESP.

EDIT: if when extending the first disk, for some reason Windows Disk Manager converts it to a dynamic volume.. Check this workaround.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.