By using this website, you agree to the use of cookies as described in our Privacy Policy.

Restore the Windows Boot Manager deleted due a Linux dual-boot installation

During a dual-boot Linux installation with Windows, you may accidentally format the EFI system partition containing the Windows Boot Manager files that is automatically generated during the first Windows installation.

In this How-to article, I will explain the procedure to solve the problem by restoring the Windows Boot manager files in order to obtain the dual boot menu with both Linux and Windows.

Once you are logged into Linux, open the terminal and type

sudo fdisk-l

This is an example of the output you should get:

Device Start End Sectors Size Type
/dev/nvme0n1p1 2048 690175 690175 336M EFI System
/dev/nvme0n1p2 676048896 762165247 86116352 101,1G Linux filesystem
/dev/nvme0n1p3 690176 676046847 675356672 364.3G Microsoft basic data

In the example above, the Linux filesystem is located in /dev/nvme0n1p2.

Then we have the Windows filesystem in located in /dev/nvme0n1p3 and the EFI system partition on which we need to intervene in /dev/nvme0n1p1.

In the next steps we will restore the Windows Boot manager files in that particular location.

Let's start by creating an installation media for Windows 10/11, I recommend to use Windows Media Creation Tool.

https://www.microsoft.com/software-download/

When the installation media is complete, reboot the device by choosing to boot from the newly created media by changing the UEFI boot order in the BIOS.

As soon as the Windows installation screen appears, press SHIFT + F10 to open the command line interpreter.

Start the disk management tool:

diskpart

To get the list of existing disks:

DISKPART> list disk

Disk ### Status Size Free Dyn Gpt
----------- ------------- ------- ------- --- ---
Disk 0 Online 465 GB 1024 KB *

Select the disk containing the EFI system partition, for example, if the partition is on disk 0:

DISKPART> select disk 0

Disk 0 is now the selected disk.

To get the list of partitions on this disk:

DISKPART> list volume

Volume ### Ltr Label Fs Type Size Status Info
---------------- --- ----------- ----- ---------- ------- --------- --------
Volume 0 C NTFS Partition 322 GB Healthy Boot
Volume 1 D NTFS Partition 102 GB Healthy
Volume 2 FAT32 Partition 336 MB Healthy System

Locate the volume with the existing Windows filesystem. In this case C, volume 0

To terminate:

exit

Finally, to copy the boot files from the Windows partition to the EFI partition, we run this command:

bcdboot C:\Windows

You can now reboot and reset the boot settings on the Linux Boot Loader from the BIOS.

You should find the automatically created Windows Boot Manager entry and the possibility to choose between Linux and Windowsenjoy!



References:

How to restore an accidentally deleted Windows Boot Manager with a Windows / Arch Linux dual-boot installation. (2021, June 12). Meroupatate. Retrieved September 25, 2022, from https://meroupatate.github.io/posts/bootloader/