Restore the windows 7 boot file. Use the command line to restore the MBR sector

💖 Like it? Share the link with your friends

For many years, Microsoft has improved the recovery system operating system Windows and Windows 7 and Windows Vista it works almost automatically. If you boot from the installer Windows disk 7 and click " System Restore" ("Repair Computer"), the Windows recovery system will start and try to fix any errors it finds on its own. It is able to fix a large number of problems, however, it is quite possible that the bootloader is corrupted, and the recovery system cannot cope with this problem. In this case you can restore the bootloader manually using the Bootrec.exe utility.

The Bootrec.exe application is used to fix errors related to bootloader corruption and, as a result, the inability to start the Windows 7 and Windows Vista operating systems.

Sequencing

Description of bootrec.exe startup keys

Bootrec.exe /FixMbr

Launched with the /FixMbr switch, the utility writes a Windows 7 and Windows Vista compatible Master Boot Record (MBR) to the system partition. Use this option to troubleshoot problems with master boot record corruption or if you wish to remove non-standard code from it. The existing partition table is not overwritten in this case.

Bootrec.exe /FixBoot

Launched with the /FixBoot key, the utility writes a new boot sector compatible with Windows 7 and Windows Vista to the system partition. You need to use this option in the following cases:

  1. The boot sector of Windows Vista or Windows 7 has been replaced with a non-standard one.
  2. The boot sector is corrupted.
  3. A previous version of the Windows operating system was installed after Windows installation Vista or Windows 7. For example, if Windows XP was installed, NTLDR (Windows NT Loader, Windows NT boot loader) will be used, the code of the standard NT 6 boot loader (Bootmgr) will be overwritten by the Windows XP setup program.

It should be noted that a similar effect can be achieved using the bootsect.exe utility, also located on the Windows 7 boot media. To do this, you need to run bootsect.exe with the following parameters:

Bootsect /NT60 SYS

The boot sector of the system partition will be overwritten with BOOTMGR compatible code. You can learn more about using the bootsect.exe utility by running it with the parameter /help.

Bootrec.exe /ScanOs

Launched with the /ScanOs key, the utility scans all disks for installed Windows Vista and Windows 7 operating systems. In addition, when using it, a list of found systems is displayed that, in this moment are not registered in the Windows Boot Configuration Data (BCD) Store.

Bootrec.exe /RebuildBcd

Launched with this key, the utility scans all drives for installed Windows Vista or Windows 7 operating systems. The found operating systems are displayed in a list from which they can be added to the Windows Boot Configuration Data Store. Also use this option if you want to completely rebuild the boot configuration data store. Before doing this, you must delete the previous storage. The set of commands in this case can be as follows:

bcdedit /export C:\BCDcfg.bak attrib -s -h -r c:\boot\bcd del c:\boot\bcd bootrec /RebuildBcd

In the example above, the current boot configuration store is exported to the file C:\BCDcfg.bak, the system, hidden, and read-only attributes are removed from it, after which it is deleted with the DEL command and rebuilt with the bootrec /RebuildBcd command.


Enlarge picture

Of course utility bootrec.exe very functional, however, it will not help if, for example, the Windows bootloader file bootmgr damaged or physically missing. In this case, you can use another utility, also included in the Windows 7 distribution media - bcdboot.exe.

Restoring the boot environment with BCDboot.exe

BCDboot.exe is a tool that is used to create or restore a boot environment located on the active system partition. The utility can also be used to transfer download files.

The command line in this case might look like this:

bcdboot.exe e:\windows

Replace e:\windows with the correct path for your system.
This operation will repair the corrupted Windows Boot Environment, including the Boot Configuration Data (BCD) store files, including the bootmgr file mentioned above.

Syntax of bcdboot command-line options

The bcdboot.exe utility uses the following command line options:

BCDBOOT source]

source

Specifies the location of the Windows directory to use as the source when copying boot environment files.

Optional parameter. Specifies the language of the boot environment. The default is English (United States).

Optional parameter. Specifies the drive letter of the system partition where the boot environment files will be installed. The default is the system partition specified by the BIOS firmware.

Optional parameter. Enables the mode of detailed logging of the utility operation.

Optional parameter. Combines the settings of the newly created and existing storage boot record and writes them to the new boot record. If an operating system bootloader GUID is specified, combines the bootloader object with the system template to create a boot entry.

Summary

The article discussed the principles of working with the bootrec.exe and bcdboot.exe utilities, which are used to resolve problems associated with the inability to start the Windows 7 operating system due to a damaged or missing bootloader.

Need some good advice on how toWindows 7 bootloader recoveryif the startup recovery using the installation disk of the seven did not help. I’ll briefly explain what’s the matter: Windows 7 was first installed on the computer, then Windows XP was needed as the second system, after installation it naturally started alone, I used the EasyBCD program to load two operating systems. In the future, XP became unnecessary and I formatted the partition on which it was located from Windows 7. Now, when loading, there is nothing but a black screen. What can be done in this case? More details if possible. Sergey.

Windows 7 bootloader recovery

Hello friends! Most importantly, do not worry, your problem is simple and, in principle, the simple tool "Windows 7 Startup Repair" described in our article should help, but! If this article does not help you, then two others should help:

These articles describe a few more good ways restore the boot of your operating system, besides them there is one more, so try it and just don't give up.

Let me remind you that you cannot install an older operating system after a younger one, Windows 7 will in no case boot after installation on a Windows XP computer, since the latter overwrites the master boot record (MBR) on itself during installation. Therefore, you installed an additional boot manager, which is used to configure the boot of several operating systems and has its own bootloader in turn.

  1. I also want to say that often errors are to blame for unsuccessful loading of Windows 7 file system, you can fix them even when the operating system does not boot, all the details in our other article " "
  2. Friends, in this article we will work with the Windows 7 Recovery Environment, or more precisely with the command line of the Recovery Environment. I will give you the necessary commands, but if it is difficult for you to remember them, you can. This will greatly facilitate your work.
  • The Master Boot Record (MBR) is the first sector on the hard disk, which contains the partition table and a small bootloader program that reads data in this table from which partition of the hard disk to boot the OS, then the information is transferred to the partition with the installed operating system, to download it. If the master boot record contains incorrect information about the location of the system, then we will receive various errors during boot, here is one of them "BOOTMGR is missing press CTR-Alt-Del for restart" or we will observe a black screen. The problem is being fixed Windows 7 bootloader recovery.

When you uninstalled old XP along with EasyBCD, you left your computer to fend for itself with a boot record that it did not understand, and it gives you a black screen as a token of gratitude. To remedy the situation, we will boot recovery Windows 7, namely, we will overwrite the master boot record using the utility Bootrec.exelocated on the recovery disk or on the Windows 7 installation disk (friends, if you have a netbook and want to use the recovery environment located on a USB flash drive, then read the comments first). Also, with this utility, we will write a new boot sector, understandable by Windows 7.

Windows 7 Boot Repair Automatically

We boot from the recovery disk or the installation disk with Windows 7, in the initial phase of booting the computer, when prompted to boot from the disk "Press any key to boot from CD ...", press any key on the keyboard for 5 seconds, otherwise you will not boot from the disk

There is a short search for installed Windows systems and an analysis of problems that prevent them from loading

Usually problems are found quickly and the recovery environment offers to fix them automatically. Click on the "Fix and restart" button, after which the computer will restart and the Windows 7 boot will be restored.

If the system boot problems continue or you are not prompted to fix the problems automatically, then in this window you need to select the operating system that you want to restore, you most likely have one and Next.

Choose a tool firstLaunch Recovery, it can also solve problems with loading Windows 7

Restoring the Windows 7 bootloader manually

If this remedy does not help, choose the remedy Command line

We enter the commands:

diskpart

lis vol (we display a list of hard disk partitions and see that "Volume 1" is hidden section System Reserved (Reserved by the system), the volume is 100 MB, it must contain the Windows 7 boot files and it must be made active). We also see a partition with Windows 7 installed, it has the letter D:, the volume is 60 GB.

sel vol 1 (select Volume 1)

activ (make it active)

exit (exit diskpart)

bcdboot D:\Windows (where D: is the partition where Windows 7 is installed), this command restores the Windows 7 boot files (the bootmgr file and the boot storage (BCD) configuration files)!

"Download files created successfully"

Restoring the Windows 7 bootloader manually (method number 2)

In the command prompt window, enter the Bootrec command and Enter

comes full information about the capabilities of the utility. Select the MBR entry Bootrec.exe /FixMbr .

Operation completed successfully. A new boot record has been written to the first sector of the boot partition.
The second command Bootrec.exe /FixBoot writes a new boot sector.

Operation completed successfully. exit. Next, we try to load our Windows 7.


Friends, if the Bootrec.exe /FixMbr and Bootrec.exe /Fixboot commands do not help you, do not despair, there is one more tool.

Method number 3

We enter the command Bootrec /ScanOs, it will scan all your hard drives and partitions for operating systems, and if any are found, a corresponding warning will appear. Then you need to enter the command Bootrec.exe /RebuildBcd, this utility will offer to add the found Windows to the boot menu, agree and enter Y and press Enter, all the Windows found are added to the boot menu.

In my case, two operating systems were found. Everything is visible on the screenshot.

In addition to the above method, there is another one, enter bootsect /NT60 SYS on the command line, the main boot code will also be updated.

Restoring the Windows 7 bootloader - performing actions to restore the operating system to working capacity after problems occur when loading Windows. Due to a system failure, the user may lose data, personal files located on the computer.

At one point in time, the operating system will not be able to boot on the computer. Various messages appear on the screen (not always in Russian), which indicate a problem with loading Windows.

The main causes of problems with the Windows 7 bootloader:

  • user actions: an attempt to use hidden system partitions, incorrect changes to boot files using EasyBCD, etc.;
  • system failure;
  • exposure to malicious software;
  • the appearance of bad blocks on the hard drive of the computer;
  • operating systems installed on the computer in the wrong order;
  • hardware problems.

The problem with the bootloader must be resolved, otherwise you will not be able to use Windows, because the system does not start on the computer. Problems can be fixed in a radical way: again on the PC.

If there is, created by a system tool, or using third-party programs, you need to restore from a backup Windows image created in advance. Many users, unfortunately, do not pay due attention to system backup, so these methods will not work for them.

How to restore the Windows 7 bootloader? To restore operating system boot files, use the built-in Windows tools: automatic recovery startup, as well as using the BootRec and BCDboot utilities that are part of the operating system, run on the command line.

Before using the operating system tools, you need to know the markup hard drive. Modern computers have the GPT hard disk layout style and the new BIOS - UEFI, and in the days of Windows 7, the disks used the MBR layout, and now the outdated BIOS. On some computers, Windows 7 64-bit is installed on UEFI and GPT disks, and in general, Windows 7 PCs use MBR (Master Boot Record) partitioning.

In this article, we will look at instructions on how to restore the bootloader using system tools in Windows 7: first, we will perform automatic repair, and then we will try to restore the bootloader from the command line.

To perform bootloader recovery operations, you will need either an installation DVD with the operating system, or a bootable Windows 7 flash drive. Bootable media is needed to be able to boot to personal computer Windows RE (Windows Recovery Environment) Recovery Environment, which can be used to try to solve the problem of the inability to start the system.

Performing Windows 7 Recovery Automatically by System Tool

The easiest way: automatic recovery of the boot partition on the hard drive using the operating system. This action takes place without user intervention, it only needs to be loaded on the computer with boot disk.

Immediately after starting the computer, using the keyboard keys, you need to enter the boot menu ( boot menu) to select an external device to boot: DVD disc or USB flash drives. Which keys to press depends on the equipment manufacturer, check this in advance.

Another way: you can enter the BIOS and set the boot priority from the connected device there: a USB drive or a DVD drive.

For this example, I am using installation disk Windows 7, all actions from a bootable USB flash drive are performed in a similar way.

In the first window of the Windows Setup program, click on the "Next" button.

In the window prompting you to start installing the operating system on your computer, in the lower left corner, click on "System Restore".

In the System Recovery Options window that opens, a search for installed systems will start.

After a while, a message appears stating that problems have been found in the computer's boot options.

Click on "Details" to see a description of the fix.

To start the automatic troubleshooting of system boot problems, click on the "Fix and restart" button.

After the bootloader is restored, the Windows 7 operating system will boot on the computer again.

Automatic troubleshooting by system tools can be started a little differently:

  1. In the "System Recovery Options" window, activate the option "Use recovery tools to fix problems starting Windows. Select the operating system to restore", and then click on the "Next" button.

  1. In the window for choosing recovery tools, click on "Startup Repair".

  1. Wait until the end of the operation to automatically fix problems that prevent the system from starting.

If the problem is not automatically resolved, continue with the following methods, in which the user will have to manually enter commands at the Windows Command Prompt.

Restoring the Windows 7 bootloader using the Bootrec utility

The next method involves restoring the Windows 7 bootloader via the command line. To do this, we use the Bootrec.exe utility. This method only works with disks that have an MBR master boot record.

From the boot disk, you need to enter the Windows Recovery Environment as described above.

In the System Recovery Options window, click on the Command Prompt option.

The Bootrec.exe utility uses the following basic commands:

  • FixMbr - The option writes the Master Boot Record (MBR) to the Windows 7 compatible system disk partition, the existing partition table is not overwritten
  • FixBoot - using the command, a new boot sector is written to the system partition, which is compatible with Windows 7
  • ScanOS - searches all drives of installed systems that are compatible with Windows 7, displays entries that are not in the system configuration store
  • RebuildBcd - search all disks of installed Windows 7 compatible systems, select systems to add data to the boot configuration store

The FixMbr command is used to fix the master boot record, as well as to remove incorrect code from the master boot record.

The FixBoot command is used under the following conditions: the boot sector is corrupted, the boot sector has been replaced with a non-standard boot sector, an older Windows 7 computer has been installed Windows version(Windows XP or Windows Vista).

The ScanOS command searches all disks for operating systems compatible with Windows 7. As a result, all entries related to other operating systems installed on the computer that are not displayed in the boot manager menu will be displayed.

The RebuildBcd command allows you to discover and add to the repository the boot configurations installed on the system machine. The parameter is used to completely rebuild the system boot storage configuration.

In the command line interpreter window, enter the command (after entering commands on the command line, press the "Enter" key):

Bootrec /fixmbr

If the problem persists, you may need to enter the following command:

Bootrec /fixboot

The rest of the commands apply if the computer has more than one operating system.

Close the command prompt, and in the "System Recovery Options" window, click on the "Restart" button.

How to repair the Windows 7 bootloader command line using the BCDboot utility

Using the bcdboot.exe utility, you can restore the Windows 7 bootloader on computers with MBR or GPT hard disk layout styles.

Boot from a removable device, go all the way to the window with the choice of the system recovery method, and then launch the command line. Another option: in the very first window, press the "Shift" + "F10" keys on your keyboard to enter the command line window.

In the command prompt window, enter the command to run the DiskPart utility:

diskpart

To display information about the disks on your computer, type the following command:

List volume

We need to find out the drive letter (volume name) on which the operating system is installed.

The volume name (drive letter) in Diskpart may be different from the drive letter in Explorer. For example, in my case, in Explorer, the system partition has the letter "C", and in diskpart it is marked with the letter "E".

To exit the diskpart utility, type:

bcdbootX:\windows

In this command: "X" is the drive letter on which the operating system is installed. In my case, this is the letter "E", you may have a different name for the volume (disk).

Close Command Prompt.

In the System Recovery Options window, click the button to restart your computer.

Article Conclusions

If you experience problems with the Windows 7 boot loader, you must restore the system boot files by booting your computer from the Windows boot disk. You can restore damaged or missing files using the operating system tools: automatic Windows boot troubleshooting using the Bootrec and BCDboot utilities launched from the command line in the recovery environment.

Experienced PC and Internet user

8. Restore Windows 7 boot without installation disk.

Option 1: Automatic - using the Windows RE recovery environment in Windows 7.

During the installation of Windows 7, a service partition is automatically created on the hard drive, providing access to the Windows RE (Recovery Environment) Recovery Environment. Using this service section, you can:

Boot into recovery environment from hard drive

Create a CD containing the recovery environment

1) Boot into the recovery environment from your hard drive or system recovery disc.

To enter the Advanced Boot Options menu, press F8 after the computer is turned on (but before the operating system loads).

2) Select the first menu item (Repair your computer) and press Enter.

3) Select the keyboard layout language in which you have set the password for the administrative account.

4) Enter the administrator password. After entering the password, you will see a window with recovery options.

5) Select item Launch Recovery(Startup repair), sometimes the item can also help System Restore(System Restore), which allows you to return to a point created before the problem occurred.

Option 2. Manual recovery, with the creation of a multi-boot menu.

The main thing here is to get to the command line to enter further commands.

1) Download the archive Bootfiles_x86+x64.zip (contains files: Bcdboot.exe; Bcdedit.exe; Bootsect.exe)

2) Create a Boot folder

3) Unpack the downloaded archive and copy the Bootsect.exe and Bcdedit.exe files of the bitness you need to the Boot folder you created.

4) Run the environment necessary for work:

5) Boot into Windows installed on another drive or recovery environment (On the hard drive, start by pressing the F8 key. If the F8 key is used motherboard, after selecting the disk, press F8 again, select the menu item Troubleshooting your computer

6) Launch command prompt.

On Windows: Win+R -> cmd -> Ok.

In the recovery environment: Select the keyboard layout language in which you have set your administrative account password. Enter the administrator password. Select an item Command line(Command Prompt)

1) Windows 7 uses an improved boot method - the Boot Configuration Data store. This store contains all information about all operating systems installed on the computer. Therefore, boot loaders of earlier Windows operating systems cannot be used to start it. So, to restore the boot sector of Windows 7, we overwrite the boot sector on all partitions:

X:\boot\bootsect.exe /nt60 all

where X is the letter of the drive that contains the Bootsect.exe program

2) If you have a second Windows XP system, then you need to perform a series of actions:

Create a Windows 7 Boot Store - Windows XP Boot Store.

Bcdedit /create (ntldr) /d" Microsoft Windows XP"

If the system refuses to do this, then this repository has already been created, so you only need to rename it:

Bcdedit /set (ntldr) description "Microsoft Windows XP"

Bcdedit /set (ntldr) device partition=C:

Then tell the Windows 7 bootloader the path to the Windows XP bootloader:

bcdedit /set (ntldr) path \ntldr

Then add a line about choosing Windows XP in the boot menu and placing it below the rest:

Bcdedit /displayorder (ntldr) /addlast

Also, to work with bootloaders, you can use the EasyBCD program, which allows you to perform the above actions using a graphical interface.

For information:

Master Boot Record (MBR) compatible with operating system loader (ntldr for Windows XP and bootmgr for Windows 7/Vista);

Boot files: for Windows XP - ntdetect.com and boot.ini files, for Windows 7/Vista - boot storage - Boot Configuration Data (BCD), which is located in the hidden BOOT system folder.

Option 3. Manual recovery using bootrec.exe.

1) Boot into the recovery environment (On the hard disk, it starts by pressing the F8 key. If the F8 key is used by the motherboard, after selecting the disk, press F8 again, select the menu item Troubleshooting your computer(Repair your computer) and press Enter)

2) Select the operating system you want to restore and click "Next".

3) In the window Recovery system options(System Recovery Options) select Command line(Command Prompt).

4) The cmd.exe command line interpreter window will open, where you should enter:

Bootrec.exe /FixMbr

The /FixMbr option writes a Windows 7-compatible MBR to the system partition. This option does not overwrite the existing partition table. This option should be used to troubleshoot MBR corruption or if you need to remove custom code from the MBR.

Bootrec.exe /FixBoot

The /FixBoot option writes a new boot sector to the system partition using a Windows 7 compatible boot sector. Use this option if any of the following conditions are true.

Windows 7 boot sector has been replaced with a non-standard boot sector

Boot sector corrupted

After installing Windows 7, an earlier version of the Windows operating system was installed on the computer. In this case, Windows NT Loader (NTLDR) is used to start the computer instead of Windows Boot Manager (Bootmgr.exe).

Bootrec.exe /RebuildBcd

The /RebuildBcd option searches for installed operating systems compatible with Windows 7 on all drives. In addition, this option allows you to select installed systems to be added to the boot configuration data store. Use this option if you need to perform a complete rebuild of the boot configuration data.

If you do not remember the value you need, you can simply enter:

and the utility will display help on the available command line options.

Starting the computer involves checking the BIOS of all hardware, and if the self-test is successful, Windows boot. The system is loaded thanks to the bootloader, in which special data is recorded for this. This data can be corrupted at any time and a type error and others will appear. If you see a similar error on the screen, or similar, but the fact is that Windows does not boot, you need to Windows 7 bootloader recovery. By the way, I wrote about restoring a boot record for other systems in the following articles:

Now let's get down to business.

Restoring the Windows 7 bootloader using a recovery disk

You need to get a disk with Windows 7, if there is one - great, but no, then make a bootable USB flash drive. The version in this case is not important, bit depth especially too. Boot from a flash drive. When you see the Windows installer at the bottom left, click "System Restore".

A small window will appear with system restore options. Select the system to restore. We press the "Next" button.

And here is the window with the necessary options. To get started, you can try automatic troubleshooting, this is the very first item, called "Launch Recovery". By clicking it, you just wait. The disadvantage of this method is that it does not always work, so we will use manual methods.

Using the command line

In recovery options, open a command prompt. There, enter the following command:

bootrec /fixmbr

With this simple command, you can restore the boot record on Windows 7. If it doesn’t help, go to the next step:

bootrec /fixboot

Both commands are more likely to restore the Windows 7 bootloader. Close the command prompt, restart the computer and see what happens. In fact, the system should boot without problems. If this is not the case, I have prepared a few more methods.

Using command line #Method 2

Again we enter the following commands and one additional one:

  • bootrec /fixmbr
  • bootrec /fixboot
  • bootsect /nt60 ALL /force /mbr

Trying to boot the system.

Editing the boot.ini file

A special boot.ini file is responsible for booting the system. Today we will torture him. Perhaps its integrity was compromised as a result of a virus attack or a simple PC failure, so Restoring the bootloader of Windows 7 or another system is a priority.

We again need a bootable USB flash drive with the seven. Once downloaded, click the "Install" button. Go to the window with the choice of disk for installing the system. Press the Shift+F10 keys to launch the command prompt.

At the command line, enter:

notepad

We will open a notepad, where we need to click "File" and "Open". AT system drive enable showing system files otherwise you won't see boot.ini.

Edit this file with notepad. There are the following options:

  • timeout=10– time to select the operating system boot (if there are several);
  • multi(0) and
tell friends