Restoring Windows 10 EFI files without messing up existing partitions

6,239

Solution 1

I managed to create a copy of Windows EFI.

First, I mounted EFI partition with diskpart:

> diskpart      # start diskpart tool
list volumes    # prints all disks I have: C:, D:, etc
sel vol 8       # on my list EFI partition was unmounted and next to a number 8
assign letter=Z # since I marked EFI partition as selected I can now assign it a letter so that I could use it later on
exit            # I am leaving the tool

Earlier on it failed - when I tried to use assign mount=z I saw error like "cannot mount system EFI partition" even though help command suggested it.

With EFI mounted I could

bcdboot C:\Windows /s Z:

It puts Windows EFI files into EFI partition without affecting existing grub files. As a result grub didn't broke but I now have files required to boot windows in UEFI setup.

After that os-probe was able to find Windows, so update-grub added missing entry to the list.


I guess if someone would find himself in the same situation as I did they must be prepare that:

  • windows will create several new partitions, and EFI will be one of them
  • since that partition will have about 100 MB and I think it is suggested that it should be bigger we can replace it with one provided by us (plenty of good resources on how to do that, both on Arch wiki and on Microsoft docs depending on which tool we'll use)
  • before that we can make a copy of files with windows EFI partition - they are hidden if you cannot see them - or remove it as I did and then go though all the procedure above. You would need Windows installation CD for that.

Solution 2

It's hard for me to create a good mental model of your computer's current state, since you've made so many changes and it's not always clear what the result of any given step you took might be. (This isn't really a criticism of your question; it's just hard to understand what the computer itself does when making some of these changes.) Thus, I recommend that you back up your important user files, delete all the partitions on the disk, and start over. Begin by installing Windows, then install Linux on top of that. You can then restore your user files.

If starting from scratch isn't an option, please run the Boot Repair utility and select the "Create BootInfo Summary" option. (DO NOT click "Recommended Repair," at least not yet!) When asked whether to upload the report, click "Yes," and then post the URL provided here. This will provide the sort of detailed information about your computer's current state that's needed to diagnose the problem.

To help you understand the EFI boot process and carry off the dual-boot configuration, I strongly recommend that you read at least some of the following pages:

If you read just one of those, make it my page on installing Linux on EFI systems; it's the most practical guide of those four pages. Adam Williamson's blog entry is second in priority, or the Superuser post if you're in a rush; these pages will provide necessary background information. My EFI boot loaders page is likely to be helpful if you don't want to use whatever boot loader or boot manager your distribution uses by default.

Share:
6,239

Related videos on Youtube

Mateusz Kubuszok
Author by

Mateusz Kubuszok

I graduated from the Wrocław University of Technology at Faculty of Fundamental Problems of Technology, subject Computer Science. Last 5 years I've been working as Scala Backend developer.

Updated on September 18, 2022

Comments

  • Mateusz Kubuszok
    Mateusz Kubuszok over 1 year

    tl;dr: GPT, EFI, dual-boot Antergos-Windows 10, Windows' EFI partition is deleted so I am only able to boot into Antergos and want to fix it.

    I had a Debian-Windows-10 dual boot setup using MBR for kicking off grub2. Recently I switched Debian to Antergos and used that opportunity to migrate to GPT partition format with EFI bootloading.

    I had a partition list like this:

    1. Windows System Reserved
    2. Windows 10
    3. Debian
    4. Swap

    After reinstall it changed into:

    1. Windows System Reserved
    2. Windows 10
    3. Antergos
    4. Swap
    5. EFI partition

    After that os-probe didn't find Windows, so I tried to add it to grub manually, but apparently that setup was intended for MBR installation. I attempted then to reinstall Windows using UEFI setup. I ended up with such configuration in the end:

    1. Windows System Recovery
    2. Windows EFI Partition
    3. Windows System Reserved
    4. Windows 10
    5. Windows System Reserved
    6. Antergos
    7. Swap
    8. Angergos EFI

    (I have no idea why, when given long chunk of empty space, Windows installed decided to create 5 separate partitions...)

    Obviously, Antergos stopped to boot since I've got 2 EFI partitions. I thought that only 1 is needed and Windows EFI contains only bootloader that can be replaced by grub so I've deleted the 2nd partition.

    Only after that I was able to actually restore grub to work. Apparently though some files from that partition are needed to run Windows. So I treid to recover that partition using Windows installation disk and both automatic repair and creating EFI partition and restoring it with bcdboot. However I only received error failure when attempting to copy boot files.

    Currently - depending on what option I try, I see errors such as:

    • ntldr is missing
    • EFI is missing some configuration

    I am currently unsure what should I'll be trying as applying random solutions from internet already took me whole weekend and is not very effective way of figuring out what to do. So my question is: what would be away to restore Windows 10 without reinstalling everything from scratch?

    I have access to Windows partition, Windows installation disk, Antergos Live cd for chrooting. I can provide all logs and listing that might help.

    • tvdo
      tvdo over 6 years
      With bcdboot you really want to triple-check you're pointing to the right EFI System Partition - the letter assignments can get jumbled up. Check with diskpart that it has the correct guid.
    • Mateusz Kubuszok
      Mateusz Kubuszok over 6 years
      You think I could try sth like mount and bcdboot into the EFI partition I already have?
    • Biswapriyo
      Biswapriyo over 6 years
      Do you want to remove the Antergos? Or get dual boot system with Windows 10?
    • Mateusz Kubuszok
      Mateusz Kubuszok over 6 years
      I would like to dual boot. :) Possibly without whole remove->restore-from-backup procedure ;)
  • Mateusz Kubuszok
    Mateusz Kubuszok over 6 years
    Thanks! So far my workaround is still working, but if if I ever need to change anything about it I will surely read through these pages.