Removing and recreating EFI partition

7,129

EFI partition is simple vfat. Make sure it's formatted as such.

Windows should write to it as long as the partition type is correct (use GPT with EF00 as the type code. If you have a hybrid MBR/GPT it's easier to remove the MBR and only keep the GPT if it's incorrect.)

If Windows was booting before, you should still have the bootstubs in your EFI partition. unless they've been wiped out somehow (say by a format of said partition or similar.) Are they there by chance?

It's interesting that you suddenly can't boot too; every distro has pretty much gotten coexistence down flat these days, and EFI made that much cleaner, so I'm interested in the above to try to find out what happened to get you into this state as it will surely help your recovery to know ;)

Care to share your current GPT + MBR part tables and such?

It would also help to know your EFI boot manager entries. If you can get into Linux, an easy way to see this is efibootmgr -v.

Most likely, your old EFI boot entry still exists for the Windows boot, but is just set as a later priority. Linux installs tend to install some intermediary bootloader, such as grub/systemd-boot. You can typically access these and manage them from your EFI "setup" screen (on macs it's a different story, but that's an explanation for another day).

FYI, you can boot Linux kernels directly nowadays as well, as they contain an efi bootstub at the beginning of them since quite some time ago.

I'm guessing you had Windows installed and booting already, then installed Linux over top, yes?

Share:
7,129

Related videos on Youtube

Kryštof Šádek
Author by

Kryštof Šádek

Updated on September 18, 2022

Comments

  • Kryštof Šádek
    Kryštof Šádek almost 2 years

    I've wanted dualboot Win 10 and CentOS, but TL;DR I ended up with non-booting notebook. bootrec /scanOs can't find Windows installation (it is still there though).

    Auto repair doesn't work, neither bcdboot or bootrec /fixboot/fixmbr/rebuildbcd.

    So my question: is removing EFI partition completely (diskpart) and recreating it from the scratch (bcdboot) worth a try?

    If it helps: Lenovo Thinkpad X260, SSD, GPT partition style, Win 10 Pro

    (I would try to recreate the situation in VirtualBox, but available PC isn't capable of such thing.)

    EDIT #1: I've removed the CentOS partition later on (tried to install Windows 10 there hoping for repaired boot manager but with no luck). So it's unformatted 30 GB space now

    EDT #2: This is output from diskpart:

    DISKPART> list disk
    
      Disk ###  Status       Size     Free     Dyn  Gpt
      --------  -----------  -------  -------  ---  ---
      Disk 0    Online        238 GB  1024 KB        *
    
    DISKPART> list partition
    
      Partition ###  Type               Size     Offset
      -------------  -----------------  -------  -------
      Partition 1    System              260 MB  1024 KB
      Partition 2    Reserved             16 MB   201 MB
      Partition 3    Unknown            1024 KB   277 MB
      Partition 4    Primary             206 GB   279 MB
      Partition 5    Primary              30 GB   206 GB
      Partition 6    Recovery           1000 MB   237 GB
    
    DISKPART> list vol
    
      Volume ###  Ltr  Label        Fs     Type        Size     Status     Info
      ----------  ---  -----------  -----  ----------  -------  ---------  --------
      Volume 0     C   DISK         NTFS   Partition    206 GB  Healthy
      Volume 1                      RAW    Partition     30 GB  Healthy
      Volume 2     E   SYSTEM       FAT32  Partition    260 MB  Healthy    Hidden
      Volume 3     D   WinRE_DRV    NTFS   Partition   1000 MB  Healthy    Hidden
    

    EFI should be partition 1 / volume 2

    EDIT #3: diskpart detail partition 1:

    Type    : c12a7328-f81f-11d2-ba4b-00a0c93ec93b
    Hidden  : Yes
    Required: Yes
    Attrib  : 0x0000000000000001
    Offset in bytes: 1048576
    

    EDIT #4: Boot menu:

    #1 Windows boot manager (does nothing; black screen and takes me back here)
    #2 ATA HDD0: SanDisk SD8...001 (same as #1)
    #3 USB (my windows install media)
    #4 PCI LAN

    UPDATE #1 The boot menu allows me to show Diagnostic splash screen where I noticed that System BIOS shadowed Video BIOS shadowed.

    • Pavlus
      Pavlus almost 7 years
      Check that you have single EFI volume and check partition flags, it must be flagged as EFI partition.
    • Biswapriyo
      Biswapriyo almost 7 years
      If and only if you don't need any data from that HDD, you may go from scratch and full format HDD to install Windows.
    • Rod Smith
      Rod Smith over 6 years
      Deleting and re-creating the EFI System Partition (ESP) is likely to make matters worse, not better; the ESP holds boot loaders, so deleting it will cause any boot loaders that are there, but that aren't being launched, to be lost. It's unclear what your "EDIT #4" boot menu is -- the EFI's built-in boot menu, a GRUB menu, or something else. A screen shot (digital photo) would help. My rEFInd boot manager on USB flash drive might help, at least as a temporary/emergency tool. Windows and CentOS recovery procedures will each be unique.
  • Kryštof Šádek
    Kryštof Šádek almost 7 years
    I probably should have mentioned that linux is no longer present (formated). So my current set of tools is Windows installation, so cmd.
  • Kryštof Šádek
    Kryštof Šádek almost 7 years
    And it isn't hybrid GPT+MBR, just GPT.
  • trevorj
    trevorj almost 7 years
    What do you mean by formatted? Care to elaborate there? A listing of your partition table(s), verification of the filesystem on your EF00 type'd partition, as well as a listing there would help.
  • Kryštof Šádek
    Kryštof Šádek almost 7 years
    I mean I have deleted the partition with Linux.
  • trevorj
    trevorj almost 7 years
    I meant what partitions did you delete? Was one of them the EFI partition?
  • trevorj
    trevorj almost 7 years
    Can you get a GPT listing that includes partition types in the output?
  • Kryštof Šádek
    Kryštof Šádek almost 7 years
    Nono just with Linux. Although it has it's own /boot partition. But the original from before (created by Windows) it's still presented. I've edited my question and added output from diskpart tool
  • trevorj
    trevorj almost 7 years
    Yeah, thanks for that. I'd still want to see the partition listing with partition table type codes to verify that volume 2 is set to EF00.
  • trevorj
    trevorj almost 7 years
    Also, getting your efi boot entries would also greatly help, it's likely related.
  • Kryštof Šádek
    Kryštof Šádek almost 7 years
    May I ask how can I do that?
  • Kryštof Šádek
    Kryštof Šádek almost 7 years
    Yep I had windows and installed linux afterwards. But then I ended up with non working boot. No grub neither windows boot manager showed up. BIOS boot menu is showing Windows boot manager in the first place but it doesnt work. Then is listed SSD doing the same thing and afterwards USB, network..