Repair MBR bootloader and BCD in Windows 10 or 11

Here's how to repair the Windows bootloader on a computer with a disk that has an MBR partition system

windows computer laptop error boot bios uefi

The Boot Manager in modern versions of Windows uses the BCD (Boot Configuration Data) to boot the operating system installed on the computer's hard drive. This file contains information about the installed operating system and boot parameters.

Windows cannot boot normally if the BCD file is deleted or corrupted. Also, you will not be able to boot your Windows if the Master Boot Record (MBR) on the hard drive is corrupted. MBR is a disk partitioning system, that is, it is a protocol that takes care of the structure of the partitions, but also of the data inside it.

In this article, we will show how to properly rebuild Windows Boot Manager, BCD configuration file and fix MBR in Windows 10 and 11. Everything will be done with Windows Command Prompt commands, and no third-party application will be used .

MBR or GRP? Determine partition layout

Our guide is aimed at those who have configured MBR as the partitioning system of their hard drive containing Windows.

This automatically means that their computer: either old and has the old classic BIOS, or new and has UEFI but works in legacy mode, i.e. old-style mode.

Very important: We reiterate that all instructions given below are suitable for standard BIOS computers (or in UEFI with legacy mode – UEFI legacy mode) with partitioning system on the MBR disk.

On computers with UEFI firmware, you must use different drivers to repair EFI bootloader in Windows 10 or to restore deleted EFI partition.

How to tell if you have a computer with BIOS or UEFI? The easiest way is to check the partition table of the disk Windows is installed on, and see if it's GPT or MBR.

The difference between these two systems is mentioned in the table below:

iGuRu list MBR GPT
Maximum capacity of a partition 2TB 9,4ZB (1 ZB is 1 billion TB)
Maximum number of partitions 4 primary partitions (or 3 primary partitions + infinite logical partitions) 128 primary partitions
Firmware support BIOS UEFI
Operating system support Windows 7 and earlier (such as Win 95/98, XP 32-bit, 2000, 2003 32-bit) New systems (such as Win 10 32-bit, Win 8/8.1/10/11 64-bit)

To see what you have, open a command prompt with administrator rights and run the command:
diskpart

Then see the available discs:
list disk

If the disk containing Windows has an asterisk (*) in the Gpt column, then the partitioning system is GPT. This means that you have a computer with UEFI and to restore the Windows bootloader, you need to use some other driver.

If there is no asterisk in the column Gpt, then you have the MBR partitioning system on the disk and you can continue with this guide.

diskpart list disk mbr

 

Boot Configuration Data (BCD) is missing in Windows 10 or 11

If the BCD file is missing or corrupted, if you have removed/formatted a separate disk partition labeled System Reserved (and 500 MB in size) or a dedicated OEM Recovery partition, then you are likely to see the following when trying to start Windows:

Your PC needs to be repaired The Boot Configuration Data file is missing some required information File: \Boot\BCD Error code: 0xc0000034

boot configuration data bcd file is missing

Also, the error might look like this:

The Boot Configuration Data for your PC is missing or contains errors. File: \boot\bcd Error Code: 0xc000000f

If the MBR is corrupted, you may see the error “An operating system wasn't found”.

win10 boot bcd error 0xc000000f

If the error text refers to the winload.efi file, go to the article Repair the UEFI-GPT bootloader in Windows 10 or 11.

How to Repair Windows Bootloader Automatically

If you get this error from BCD, first of all, try to fix the problem with booting the operating system using Startup Repair mode that can be started from the Windows Recovery Environment (Windows RE) .

If automatic repair using Startup Repair does not help, start your computer from the startup disk/of Windows or from the WinRE environment

Start a command prompt, try to create a new BCD file and update it MBR from scratch. (Repair your computer > Troubleshoot > Advanced options > Command Prompt).

mbr,boot,bios,winloader,winre,bcd,Windows,manager

In this example, we will use the Windows 10 installation disc. In the BIOS settings, change the first boot device to a DVD drive or USB flash drive (depending on the device you want to boot the computer from).

Boot your computer from the Windows installation image and press Shift + F10 at the language selection screen. You will see a command prompt.

Try to repair the BCD file automatically using this command:
bootrec /RebuildBCD

Restart your computer and check if Windows starts (don't forget to change the boot device priority in the BIOS settings). If Windows does not boot, boot from the installation media again and open a command prompt.

Identifying drive letters

In order to continue in the next case of failure you will need to know the letters of the English alphabet assigned to your disks.

To do this, run the command on the command line:
diskpart

Then see the available discs:
list disk

diskpart list disk mbr

Next, you need to identify the local drives and Volumes on your computer (most likely the drive letters assigned to them will be different than what you see when working in Windows). It's easier to do it using diskpart. Run these command:
list vol

diskpart list volume

You will see a list of partitions, their assigned drive letters, and their sizes. In our case, there are four hard drives on the computer and one of them has two partitions:

  • Hidden partition with size 785 MB without drive letter.
  • NTFS partition with a size of 232 GB and the assigned letter C:. This partition contains installed Windows, programs and user data.
  • Other 3 disks for data storage, various jobs and backup

Important: Remember the assigned drive letters as they will be used later in the commands.

Repair Master Boot Record (MBR) in Windows 10/11

You can use the bootrec.exe tool to overwrite data in the MBR and boot sector and add the necessary path to the Windows Boot Manager.

Try replacing the Master Boot Record (MBR) of the system partition for Windows boot loader compatibility (if the existing partition table has not been replaced).
bootrec.exe /fixmbr

Add the master boot code to the boot sectors of the disk to load the bootmgr (Windows Boot Manager) file:
bootsect.exe /nt60 all /force

If the bootsect.exe command is not found, try specifying the full path to it:
X:\boot\bootsect.exe /nt60 all /force

Before proceeding, try to automatically rebuild the BCD bootloader configuration with the following commands (this is the easiest way for beginners):

  • bootrec / FixBoot – this command creates a new boot sector in the system partition and overwrites the boot record of the PBR partition.
  • bootrec / scanos – scan all drives and look for installed copies of Windows that are not in the Boot Configuration store.
    If the scan is successful, you will be prompted to add entries about the Windows instances found in the BCD configuration:
    Scanning all disks for Windows installations. Please wait, since this may take a while... Successfully scanned Windows installations. Total identified Windows installations: 1 [1] C:\Windows Add installation to boot list? Yes/No/All:
  • bootrec / RebuildBcd – rebuild the bootloader configuration space, add copies of Windows located on the computer to the bootloader BCD.

After that, restart your computer and check if Windows starts properly. If the operating system does not boot, follow the instructions below.

How to rebuild a Boot Configuration Data (BCD) from scratch

Then use the BCDedit command to create a new Boot Configuration Data file (assuming you don't have the BCD file backup).

Your next steps depend on whether the disk has a separate System Reserved partition or not. Run the commands:
diskpart
list vol

Check if partition exists System Reserved on the hard drive. It can be identified by the volume label or more precisely by its size (500 MB for Windows 10+, 350 MB for Windows 8.1 and 100 MB for Windows 7).

  • If there is no system reserved partition (perhaps you accidentally deleted it), you can store the Boot Manager files on the system drive where the Windows directory is located (we're assuming it's C:).
    To create the bootloader configuration files bootmgr and  BCD  on the specified drive, run the command:
    bcdboot C:\Windows /S C:A message should appear:
    Boot files successfully created.
  • If a System Reserved partition exists, delete the old (corrupted) BCD file in the boot folder of your C: drive to create a new one:
    del c:\boot\bcd

If the System Reserved partition is not assigned a drive letter (by default), you can assign it yourself using diskpart. Run at the command line:
diskpart (if you are not already in diskpart)

Select your local disk (in our case it is 0):
select disk 0

See in which partition it is System Reserved, If we say that this partition is called Voloume 1 . Select it:
select volume 2

Assign a drive letter of your choice that does not naturally exist on another partition, say the letter R:
assign letter R:

Exit diskpart:
exit

diskpart assign letter mbr

Create an empty temporary file bcd.tmp in c:/boot:
bcdedit /createstore c:\boot\bcd.tmp

Create an entry for Windows Boot Manager (bootmgr):
bcdedit.exe /store c:\boot\bcd.tmp /create {bootmgr} /d "Windows Boot Manager"

Import settings from bcd.tmp into your BCD:
bcdedit.exe /import c:\boot\bcd.tmp

If the bcdedit command shows an error while accessing the BCD ( access denied, the store import operation has failed, the required system device cannot be found, the volume does not contain a recognized file system. please make sure that all required file system drivers are loaded and that the volume is not corrupted and other nice things), try removing file attributes so they are not hidden, read only etc:
attrib C:\Boot\BCD -s -h -r

Specify that the Windows Boot Manager is located in the System Reserved partition (assigned to this drive letter R: ):
bcdedit.exe /set {bootmgr} device partition=R:

Configure the timeout to select an operating system:
bcdedit.exe /timeout 10 (10 = time in seconds, put as many as you want)

Remove the temporary file from c:/boot:
del c:\boot\bcd.tmp

By now, you've created an empty BCD file with your bootloader settings. Now you need to add entries about the Windows installed on your computer.

Create a new entry in the BCD configuration for Windows 10:
bcdedit.exe /create /d "Windows 10" /application osloader (instead of Windows 10 you can put any phrase you want)

The command will return the unique identifier (GUID) of this bootloader entry. E.g:
The entry {8a7f03d0-5338-11e7-b495-c7fffbb9ccfs} was successfully created.

Specify in BCD that bootmgr should use this entry by default (after the 10 sec timeout you set above, this entry will be used to boot Windows):
bcdedit /default {8a7f03d0-5338-11e7-b495-c7fffbb9ccfs}

Now you need to specify in the new bootloader entry the path to the installed copy of Windows 10. You have seen in our example that the drive letter C: is assigned to the Windows partition. Use this drive letter in the following commands:
bcdedit.exe /set {default} device partition=c:
bcdedit.exe /set {default} osdevice partition=c:
bcdedit.exe /set {default} path \Windows\system32\winload.exe
bcdedit.exe /set {default} systemroot \Windows

Make this BCD boot entry visible, as it is hidden by default:
bcdedit.exe /displayorder {default} /addlast

bcdedit exe displayorder default addlast

So you have completely rebuilt the Windows 10 bootloader (bootmgr) and BCD file and replaced the MBR boot sector.

Now you need to activate the partition where the bootmgr and BCD file are located by configuring the Windows bootloader (the BIOS transfers control to the OS bootloader on the active MBR partition).

In our example, the following volumes are available on your computer

  • Volume 0 – DVD drive (which we then used with an ISO image from which we booted the computer).
  • Volume 1 – partition with Windows system folders (%Windir%, Program Files, Users, etc.).
  • Volume 2 – System reserved partition (size 735 MB) with Windows bootmgr file and BCD later renamed to R
  • Other Volumes than the rest of the discs we have

diskpart list volume

In this example, you need to make Volume 2 the active partition (in your case, you need to know your partition number).

You can make a partition active using diskpart:
diskpart
list disk
sel disk 0
list vol
select volume 2
active
exit

Check that Volume 2 is now active:
select vol 2
detail partition

(Active: Yes)

Now you can restart your computer and make sure Windows starts normally.

Much of the above can be done in one click with the free Easy BCD program, but the hard way is for some users the most pleasant way.

iGuRu.gr The Best Technology Site in Greecefgns

every publication, directly to your inbox

Join the 2.100 registrants.
mbr,boot,bios,winloader,winre,bcd,Windows,manager

Written by Dimitris

Dimitris hates on Mondays .....

Leave a reply

Your email address is not published. Required fields are mentioned with *

Your message will not be published if:
1. Contains insulting, defamatory, racist, offensive or inappropriate comments.
2. Causes harm to minors.
3. It interferes with the privacy and individual and social rights of other users.
4. Advertises products or services or websites.
5. Contains personal information (address, phone, etc.).