Repair Windows BCD

来源:互联网 发布:java 异或 php 编辑:程序博客网 时间:2024/06/03 21:54

Repair Windows BCD

 

http://www.boyans.net/RepairWindows/RepairWindowsBCD.html


Quick facts:

  • The system BCD resides on active (and primary) partition on first disk
    (on UEFI/GPT based installations the system BCD is on EFI system partition)
  • BCD can be accessed only with elevated administrative rights
  • Windows utility bcdboot.exe can repair the system BCD

Important:

Aways have A Windows installation/repair CD/DVD/USB ready before attempting any repairs of boot related files !

Aways make a backup of BCD !

(use Visual BCD Editor or Dual-boot Repair tool to export/backup BCD or use "bcdedit /export backup-file-name" on elevated command prompt)

See how to create or obtain a Windows 7/8/10 installation/repair CD/DVD/USB.

 

In Windows Vista, Windows 7 and Windows 8/10 the System Boot Configuration Data (BCD) is stored in a file in folder "\Boot".

The full path to this file is "[active partition]\Boot\BCD".

(On UEFI/GPT the full path is "[EFI system partition]\EFI\Microsoft\Boot\BCD")

Windows NT6 (Vista, Windows 7/8) BIOS/MBR boot process depends on the presence of an active partition on first hard disk.

(On UEFI/GPT boot process depends on the presence of EFI System Partition(ESP) on hard disk)

BIOS/MBR boot process from hard disk goes like this:

  1. BIOS firmware initialization and self test (Power On Self Test - POST)
  2. load and execution of MBR (Master Boot Record) on first disk
  3. load and execution of partition boot record (PBR) on active partition
  4. load and execution of boot manager ("\bootmgr") from active partition and then display of boot menu (skipped if only one boot entry)
  5. load and execution of Windows NT6 loader - file "winload.exe" from \Windows\System32 folder
  6. load and execution of kernel and drivers

The active partition (also a primary partition) can be mapped to a drive letter like c:, d: or be the unmapped "System Reserved" partition. You can use Disk Management or diskpart.exe to view and set the active partition.

If BCD resides on an unmapped active partition the full path is "\Device\HarddiskVolumeN\Boot\BCD" where N is a number starting from 1. If active partition is mapped to c: drive then the full path to system BCD is "c:\Boot\BCD".

UEFI/GPT boot process from hard disk goes like this:

  1. UEFI firmware initialization and self test (Power On Self Test - POST)
  2. load and execution of first boot candidate from disk (first entry in NVRAM boot order - usually Windows firmware boot manager(\EFI\Microsoft\Boot\bootmgfw.efi)) - no master(MBR) and partition boot record(PBR) code!
  3. load and execution of Windows boot manager ("\EFI\Microsoft\Boot\bootmgr.efi") from EFI System partition and then display of Windows boot menu (skipped if only one boot entry)
  4. load and execution of Windows NT6 loader - file "winload.efi" from \Windows\System32 folder
  5. load and execution of kernel and drivers

 

The BCD is a system protected file and can be accessed only with elevated administrative rights (for reading and for writing).

The tool supplied with Windows to assist repair of BCD store is "bcdboot.exe". bcdboot repairs also bootmgr, winload.exe and \Boot folder (contains also language files, memtest.exe).

The simplest call to repair BCD is: (drive_letters in example below should reflect concrete drive mapping on your system !)

  • bcdboot c:\windows - where "c:\windows" specifies the root of Windows Vista, Windows 7 or Windows 8/10.

On multi boot systems always the root of the latest Windows OS (e.g. Windows 10) should be specified !

 

If no other parameter is given the tool has as target the active partition (or EFI system partition) on first disk.

A target partition/drive can be specified as follows:

  • bcdboot c:\windows /s d: - where d: is the target drive to accept boot related files.

(d: should map to a primary and active partition (or map to a FAT/32 partition for UEFI firmware) to be bootable!)

 

You can use also Visual BCD Editor or Dual-boot Repair tool to repair Windows BCD. Both tools give access to bcdboot utility using the same form:

Repair BCD form

Parameter "Windows Folder" specifies the root of Windows OS (Vista, Windows 7, Windows 8) used as source for boot related files.

Parameter "BCD Drive" specifies the target drive for BCD ("System" denotes the active partition or EFI system partition).

 

 

Manual BCD repair steps

If there are problems/errors when executing bcdboot command (or using Visual BCD "Repair BCD" interface) then you have to remove following file:

  • \Boot\BCD

There is no need to save/backup the file as it is seriously damaged if it cannot be repaired.

Start Windows repair CD/USB and go to command prompt.

C: drive is usually mapped to active partition. You can check if "\Boot" folder is present on c: drive with "dir /ahs" command.

c:<enter>

dir /ahs<enter>

 

Following commands will re/create BCD on C: drive

  1. attrib - s -h c:\boot\bcd - remove system and hidden attributes so it can be deleted.
  2. del c:\boot\bcd - delete BCD
  3. bcdboot c:\windows - re/create BCD

Usually you should be able to boot to Windows 7/8/Vista after the BCD was fixed.

For a successful boot, at least to boot menu, following items are needed;

1. MBR (use bootsect.exe to fix Master Boot Record)

2. PBR (use bootsect.exe to fix Partition Boot Record called also VBR - Volume Boot Record)

3. \bootmgr

4. \Boot folder with BCD inside

(On UEFI MBR and PBR code is not used for booting! EFI system partition(ESP) is not map usually and you can use diskpart.exe to map ESP to drive letter for easy access. BCD path on ESP is "\EFI\Microsoft\Boot\BCD")

 

0 0
原创粉丝点击