How to restore Windows 7 boot sector.

The Windows operating system is equipped with a huge number of built-in tools to protect against damage and loss of information. Despite this, there are often cases when the OS stops starting correctly. Most often, this occurs due to damage to the special MBR boot record on the hard drive, which stores Windows 7 startup data. This article describes in detail how to restore the bootloader.

Bootmgr program

BootManager or Bootmgr is a special program that is located in a special service sector of the hard drive called MBR. It takes over control of the computer after the BIOS checks the functionality of all installed components and connects the HDD.

The manager reads data from a special table located in the very first or boot sector of the disk. This table indicates where the files necessary to start the system are located. When all the required information has been collected, the computer begins loading Windows.

If the program cannot find any necessary information, this will lead to the fact that the personal computer will not be able to load Windows and will give the user an error message. As a rule, this is a blank black screen with a single static inscription: “bootmgr is missing”.

Similar consequences will occur if the entire boot sector of the hard drive is damaged. In this case, the address table may be in perfect order, but the manager program itself will not work properly. In this case, restoration is required.

Virus attacks

There are three main reasons why the Master Boot Record can become corrupted: virus attacks, system crashes or power outages, and incorrect OS installation.

While surfing the Internet, users may accidentally download some dangerous virus that can change the MBR of the hard drive, causing damage to the operating system installed on it.

To counteract malicious scripts, there are special applications - antiviruses. It is highly recommended to install one of them on your computer. For example, you can use free software developed by Microsoft – Security Essentials.

The program is freely available for download on the page https://www.microsoft.com/ru-ru/download/details.aspx?id=5201.

Problems with HDD

Another common cause of problems is system failures. If, while the operating system is running, you turn off the PC with the Power button and disconnect it from the power supply, the files stored on the hard drive may be damaged. The same thing will happen if, while the system is performing some tasks, the voltage in the network suddenly disappears.

In order to protect your personal computer from such emergency situations, you should use an uninterruptible power supply device, and also turn off the PC using the Start menu, and not the button.

Also, the bootloader program may be damaged if you installed several copies of operating systems on one hard drive. To prevent this from happening, it is recommended to install each copy of Windows on a separate logical partition. To fix the problem, use bootloader recovery.

Creating a bootable USB flash drive

Before repairing the Windows 7 boot loader, users need to find an installation DVD or create a special

All Windows 7 boot files are located in the Boot folder, which is usually located on the C: drive. However, the folder is securely hidden so that our playful hands cannot reach it. Not surprisingly, the contents of the folder determine whether Windows will boot or not.

However, there are situations when you really want to change the Windows 7 boot method. For example, when working with, you may need a program such as ReadyDriverPlus. For this program to work, you need to specify the path to the C:\Boot folder. You go to the C: drive and... you don’t see this folder at all. She's not there, just roll the ball. And how to find it?

There are two simple options, discussed below.

Showing hidden folders and files

This recipe is well known to many Windows 7 users, but it wouldn’t hurt to remind you about it again. By default, in Windows 7, system files and folders are hidden - this is understandable, well, who wants some teapot to get into places it shouldn’t and ruin everything it could? However, files and folders are hidden very close.

  1. To get started, select a team Start > Computer and go to the C: drive in the window that opens.
  2. Now you need to press the key to display the top menu bar. In this panel, select the command Tools > Folder Options. A window will open Folder Options, in which go to the tab View.
  3. In this tab you need to do two things:
  • uncheck the box Hide protected system files;
  • select radio button Show hidden files, folders and drives.

Now Windows doesn’t have a single folder or file hidden from your eyes. Go to drive C:. Now it has a bunch of hidden folders that you better not mess around with!

Showing a hidden section

Okay, I see all the hidden folders, but there is still no Boot folder? Where is my Boot folder, you bastards, give me my boot files!

Calm down - we'll find it now. Since it is not in hidden folders, it means it is hiding... in a hidden section of Windows 7. The evil chebureks from Microsoft hid this section from us, but we will fix it now. The partition size is only 100 MB, and you can find it as follows.

Press the key combination and enter the command in the window that opens diskmgmt.msc. A window will open Disk Management. In this window we need a hidden section (signed as “ Reserved by the system"). And here he is, look at the picture.

This section is hidden and cannot be seen. To bring it into the light of day, right-click on the section and select the command Change drive letter or drive path.

A new window will open, in which click on the button Add and select a free drive letter, like Y: or any other.

Hello friends! In today's article, we will recreate the Windows 7 bootloader. In what cases can this be useful?For example, Windows 7 does not boot and displays errors associated with a faulty bootloader, for example: “An operating system was not found”, BOOTMGR is missing. Press ctrl+alt+del, NTLDR is missing when loading Windows 7. Or maybe you transferred Windows 7 from a hard drive to a solid-state drive, but the system does not start from the SSD and displays an error or shows a black screen.You are trying to restore the operating system boot, but you are unable to do so.In such cases, you need to delete and then create again hidden section - System Reserved (Reserved by the system, volume 100 MB), this partition contains the Windows 7 download files.

When installing Windows 7 on a laptop or computer with a regular BIOS (MBR hard drive), a hidden System Reserved partition (100 MB capacity) is automatically created, the purpose of which is to store and protect operating system boot files.This partition always has the following attributes: (Active, System, Primary partition), and the operating system installed on your computer starts from it.

If you assign a drive letter to this partition and in the folder options (view) set the "Show hidden files" options and uncheck the "Hide" optionprotected system files", then inside you will see the "Boot" folder (containing the boot configuration store file - BCD), and the boot manager file "bootmgr".

For the success of our business, let’s remember the Windows 7 boot mechanism and the program will help us BOOTICE.

First of all, after turning on the computer, control is received by the BIOS subroutine, which checks the functionality of all components of the system unit, then the BIOS looks in its settings for the priority device for booting (hard drive, flash drive, DVD drive) and, having found one (for example, a hard drive) disk) reads the MBR boot record from it (Windows 7 is usually installed on an MBR partitioned disk). The MBR is located in the first sector of the boot disk, has a size of 512 bytes, and contains NT 6.x program code,

Which searches for the active partition from which the operating system can be loaded, this active partition

called PBR (Partition Boot Record) andhas its own boot recordBootmgr.

After this, control passes

boot manager file "bootmgr", which runs the Windows 7 winload.exe file. What is winload.exe?

The operating system (in our case, Windows 7) is a program, and in order for it to work (start loading), you need to run the OS executable file:winload.exe or winload.efi. ZThe bootloader releases these files. ZLoader is a small program. Filewinload.exe starts MBR- the loader, and the filewinload.efi starts the EFI boot loader. Windows 7 in most cases is installed on a disk with an MBR boot loader.

Windows 7 boots in the following order:download manager"bootmgr" file processes the available information in the boot store (BCD file), and this is the menu, display time, list of operating systems (if there are several), and so on, if the data is correct, then the operating system is loaded. But! If at least one of the files I mentioned (bootmgr or BCD) turns out to be incorrect or missing altogether, then we are guaranteed to have problems booting the system.It often happens that the integrity of these files is violated due to some reason (careless user actions, installation of third-party boot managers, viruses, etc.), in this case standard actions to restore the bootloader may not help and then it is best to delete this partition completely, then format and create the download files again. How can this be done?

We delete the hidden System Reserved partition (Reserved by the system, volume 100 MB) and create it again using the built-in systemdiskpart command line utilities

We boot from the Windows 7 installation flash drive. If you don’t find the ISO image of the seven, you can use the download. USB flash drive Windows 8.1 or Win 10.

In the initial system installation window, open the command line using the keyboard shortcut Shift+F10.

Enter the commands sequentially:

diskpart

lis vol (this command displays letters, numbers, labels, size and file system. BUkva partition 100 MB (C:). Volume 1. BThe partition name with Windows 7 installed is (D:).

sel vol 1 ( selecting the volume with which we will work - 100 MB (C:). Volume 1)

del vol ( delete the 100 MB volume).

After deleting a volume, an unallocated area of ​​100 MB appeared on the disk.

creat par prim ( create the main partition in this unallocated area)

format fs=ntfs ( create an NTFS file system on the partition)

assign letter C ( assign the letter C to the created partition)

activ ( make the section active)

exit (exit diskpart)

bootsect /nt60 C: /mbr (this command writes the necessary PBR codes to the hard disk ( Bootmgr) and MBR (NT 6.x))

bcdboot D:\windows /s C: ( create a bootloader for Windows 7 located on (D:),bootloader location (C:))

The download files have been successfully created.

This method is also suitable for those who have several hard drives, and they have an OS with a bootloader installed.

On these diskswe don't usebootrec /fixmbr and bootrec /fixboot toolsto update MBR and PBR codes. These commands only work on hard drive 0.

The bootsect command works with the disk that we specify. T The same applies to bcdboot.Without the /s parameter, bcdboot works with the active partition on hard disk 0. ANDThe /s parameter we use indicates the active partition of the desired hard drive.

It is not always possible to cure Windows 7 using standard methods without using additional bootable media. The most convenient option is to use a bootable flash drive as the latter, which is written both by the OS’s own tools and by third-party utilities. Also, before performing the recovery procedure, you must prepare the BIOS accordingly.

Creating a bootable USB flash drive for Windows 7

The easiest way to make a bootable drive is offered by Microsoft in its Windows 7 USB/DVD Download Tool. It is downloaded from the company's website and requires installation of Microsoft .NET Framework 2.0 and an OS ISO image to work. To create bootable media using this utility, do the following:

This is just one way to create a USB drive to solve system problems. It can also be recorded using the UltraISO program - although it is paid, but with a trial period.

Using UltraISO for boot drive

After installing and launching the program, the user will be required to do a minimum of actions to burn the installation media:


Preparing a laptop or PC for working with a USB drive

Modern devices allow inexperienced users to not have to go into the BIOS in order to be able to boot from something other than the hard drive. For this purpose, there is a boot menu, which is usually called up by pressing the F12, F10, F8, etc. keys (depending on the BIOS version and the board manufacturer) immediately after turning it on. F12 is most often used on laptops.

If this mode is not available to you, you will have to change the BIOS settings.

You can usually enter the configuration change window by pressing the Del key before loading Windows. In the window that opens, you will need to select an item that may be called Boot, Boot Menu, Boot Manager, etc., and then change the boot priority from HDD to USB.

Restoring Windows 7

After loading information from the USB drive, the OS installation window will open. It is possible to reinstall the system, but this method should be reserved for the most extreme case, since some or all of the user information on the disk may not be saved after this, and a lot of time will be spent on reinstallation. Therefore, first try to restore Windows using the means that you have:


Here are several remedies that often help cure the system even with very severe failures.

Startup recovery

This tool also works in automatic mode and is often unable to provide normal operation. However, she often manages to solve problems that may arise when installing previous versions of the OS, for example, XP as a backup along with the “Seven”.

In this case, the MBR boot record is overwritten and the newer OS simply does not boot. After launching this utility, if a problem is detected, the user will see a window prompting them to fix it. After rebooting, the system can be started as expected.

System Restore

This item involves returning the OS configuration to one of the previously saved states, i.e., with its help you can roll back to the last or earlier checkpoints. For this.

For many years, Microsoft has been improving the recovery system for the Windows operating system, and in Windows 7 and Windows Vista it works almost automatically. If you boot from the Windows 7 installation disc and click " System Restore" ("Repair Computer"), the Windows recovery system will launch and will independently try to fix all the errors that it finds. It can fix a large number of problems, however, it is quite likely that the bootloader is damaged, 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 associated with bootloader corruption and, as a result, the inability to start the Windows 7 and Windows Vista operating systems.

Sequence of actions

Description of keys for launching the Bootrec.exe utility

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 resolve problems with the master boot record being corrupted, or if you wish to remove non-standard code from it. In this case, the existing partition table is not overwritten.

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. This option should be used in the following cases:

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

It should be noted that a similar effect can be achieved using the bootsect.exe utility, also located on the Windows 7 bootable 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 switch, the utility scans all disks for installed Windows Vista and Windows 7 operating systems. In addition, when used, it displays a list of found systems that are not currently registered in the Windows boot configuration data store (Boot Configuration Data (BCD) )Store).

Bootrec.exe /RebuildBcd

Launched with this key, the utility scans all disks for the presence of installed Windows Vista or Windows 7 operating systems. Found operating systems are displayed in a list from which they can be added to the Windows boot configuration data store (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 could be as follows:

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

The example above exports the current boot configuration store to C:\BCDcfg.bak, removes its system, hidden, and read-only attributes, removes it with DEL, and rebuilds it with bootrec /RebuildBcd.


Enlarge picture

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

Recovering the boot environment using 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 path that matches your system.
This operation will repair a corrupted Windows boot environment, including boot configuration data (BCD) store files, including the bootmgr file mentioned above.

Syntax of bcdboot command line parameters

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

BCDBOOT source]

source

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

Optional parameter. Sets the boot environment language. The default is English (US).

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

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

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

Resume

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.