Restore the boot partition. How to repair the boot sector and boot record

At the stage of logical formatting of each partition (logical disk), four logical areas are created: · boot sector; · File allocation table (EKG1 and FAT2); · Directory; · Data area.

The boot sector on any logical disk (partition) is located first. Its data block (512 bytes) begins with a JMP command that transfers control to the IPL2 program, contains the name of the operating system and its version, contains the disk BIOS parameter block (BPB), the IPL 2 program that loads the operating system, and ends with the signature 55AA .. Below Table 5 explains some of its most important entries.

Boot sector changes Number of reserved sectors

The number of reserved sectors is now 32 before the first FAT.

New bios parameter block

The EAT32 BIOS parameter block takes up more space than the standard one and is called the Big FAT BIOS Parameter Block (BF_BPB). Because of this, the boot sector now occupies not one, but three physical sectors, and there is an additional one and is located through three physical sectors in the seventh, eighth and ninth physical sectors. BF_BPB is an extended version of the BPB found in 12- and 16-bit FAT. It contains the same structures as the standard BPB, but includes a few additional fields that are required for FAT32. The changes made to BPB to support FAT32 are described below.

Table 5. The most important records in the boot sector

Length (bytes)

Content

JMP and NOP commands

Windows name and version

Bytes per sector

Number of sectors per cluster (always a multiple of two to the power of n)

Number of reserved sectors before the first FAT

Number of FAT tables

Number of elements in the root directory (maximum limit)

Total number of sectors (00 00 - if the disk size is more than 32 MB)

Environment descriptor; in this case F8, which identifies the drive as hard with any capacity

Number of sectors per element of the FAT table

Number of sectors per track

Number of heads

Number of hidden sectors

The total number of sectors if the disk size is more than 32 MB

Disc number; in this case 80, which identifies the main section

Reserved

Extended signature (always 29h)

Volume serial number

Volume label

Filesystem type (12 or 16 bit)

Note.This portion of the boot sector is known as the BIOS Parameter Block (BPB). It contains the physical characteristics of the disk that MS-DOS and Windows use when searching for a specific region. By adding or multiplying the values \u200b\u200bof these parameters, the operating system knows where the FAT table is located, the root directory, where the data area begins and ends.

Root directory field.

This item reports the number of sectors in the root directory. For hard drives, this value was always 512 (0200h) and meant the number of directory lines located in thirty-two sectors. It is now changed to 0 (0000h) and is ignored on FAT32 drives.

The number of sectors per element of the FAT table.

This item has been replaced with zero and now acts as a pointer to the corresponding item in BF_BPB when it comes to BF_BPB during the download process.

Disc description.

A new two-byte field used as a flag indicating the number of FAT tables on disk - one or two. If the flag is set, there is only one FAT on the disk, if it is cleared - two. FAT32 created by the Format command always creates 2 FAT tables.

The first cluster of the root directory.

The maximum number of items in the root directory has now been expanded to 65535, and the root directory itself can be anywhere. This value indicates the number of the first cluster occupied by the root directory on the EAT32 disk.

File information sector.

Indicates the second boot sector. It contains information about how many clusters there are on the disk, how many of them are free, and which cluster was most recently allocated. Thus, you no longer need to read the entire FAT table to get this commonly used information.

Boot sector backup.

Another important innovation in EAT32. In previous versions of the FAT file system, damage to the boot sector resulted in the complete loss of all disk contents. FAT32 takes the edge off this problem. By writing changes to the FAT32 boot volume, FDISK creates a boot sector backup and places it in logical sector 6 of that volume. If the new MBR encounters a read error or an invalid signature when accessing the boot sector, it looks for sector 6 and reads the rest of the boot code from there.

If Windows does not start when you turn on your computer, the process freezes on a black screen, then the hard disk boot record (MBR) may be damaged.

External manifestations

When an error appears on the screen, doubts disappear.

Other information about a malfunction of the HDD loader may also be displayed.

The text information may vary depending on the classification of the error. But when the word boot is mentioned, it is clear that there is a problem with the boot.

How to recover the MBR is reported on this page.

The reasons

Pay attention to common causes of HDD boot sector failures.

Two types of bootloader

Older systems prior to Windows XP used the NT Loader (NTLDR). In Windows 7, Vista and subsequent versions of the OS, UEFI and EFI began to be used. Therefore, old and new systems are usually not installed on the same PC. Otherwise NTLDR overwrites UEFI.

Third party software

Errors in the HDD boot sector can occur when using even popular programs for the hard drive partition. I've had this happen with Acronis. This happens because such software replaces the boot drivers with its own. This can corrupt the original MBR. Therefore, it is better to use the built-in hard disk partitioning methods from Windows.

Viruses

Viruses sometimes introduce their "orders" in the MBR. Therefore, after restoring the HDD boot, check the computer with anti-virus programs.

If you are sure that viruses are the cause, then clean the PC from them before repairing the MBR. For this there are utilities of well-known antivirus companies, for example - Kaspersky Rescue Disk. They are provided free of charge on official sites with instructions for use.

Any of these programs is included in the set of software for CD or DVD, which allows you to boot from a CD, find and remove viruses on the HDD.

Windows 7 Boot Repair

Sector repair is performed from a CD or USB flash drive with an operating system installation package.

  1. First, insert the DVD into the drive or flash drive into the USB port with the Windows distribution.
  2. Then you need to allow launching from these devices. This is done in the BIOS settings.

Changing download sources

Technology of the following order:


Be sure to press F10 when you exit, otherwise the changes will not be saved!

Working from CD or flash drive

Proceed in the following order:

  1. After rebooting, an inscription will appear at the bottom: "Press any key ...". It is asked to press any key. Click. Otherwise it will not work. If the inscription has already disappeared, repeat all over again. To do this, press three keys at once: Ctrl + Alt + Del. This will cause the computer to restart.
  2. When you boot from DVD or USB stick, the Windows installation window will appear. At the bottom left, select "System Restore".
  3. They will offer to connect network capabilities, choose languages \u200b\u200bor a drive letter. Change nothing and come to the choice of systems.
  4. Highlight the required Windows and put a check mark next to "Use recovery tools ...".
  5. If the required system is not there, then it should appear when you click "Download drivers".
  6. Continue with the "Next" button.
  7. In the next window, select "Startup Repair", and the MBR can be reanimated in automatic mode.
  8. If the sector does not work, then press "Command line".
  9. On the command line, call the Bootrec utility and write for it to repair the MBR: bootrec / fixmbr... End each command with the Enter key.
  10. Then create a new boot sector: bootrec / fixboot... To exit the program, type exit and remember to press Enter.

If the fixes didn't help

There is another MBR resuscitation team - bootsect / NT60 SYS... After that, try to boot again.

In case of an unsuccessful attempt, write on the command line like this: bootsect / rebuildbcd.This will search for operating systems installed on your PC.

Now try to log into Windows again. Please note that there will be one more systems in the list now. Try to go to each of them. It should work!

Non-standard way

If you have not saved all the options for recovering the sector, then it is recommended to reinstall Windows. And no matter how much you want to do it sometimes! Isn't it true?

I also thought so and decided to put another small system next to it. What does "small" mean? This is a bootloader system. It is empty: I did not install drivers and my programs on it, because I do not work in it. But it loads!

What I needed, I achieved: a working boot area appeared on the hard drive. Now I log into the old system normally. The downside is that it lost about 14 GB of disk space. If you are not afraid of this, you can take this method into service.!

How to fix a sector in Windows 8-10 and Vista?

For Vista and later versions of Windows, the same methods are suitable as for the "seven", only the design is different. For example, in the G8 he is like that.

But the points remain the same. Therefore, we will not describe them. Use the instructions above for Windows 7.

On Windows XP

The principle of reanimation of the sector is similar in the “expishka”. But the entrance is a little different. Now you will see it:

  1. After booting from the CD, the system files are copied to the hard drive.
  2. Then the action selection window appears.

Each Windows operating system of a personal computer has special tools that are responsible for an action or operation. But there is such a tool with which you can change errors and problems, as well as restore windows from the command line.
If the OS does not load, you must use the Bootrec.exe utility

With its help, problems in the computer are eliminated, data is corrected, including windows boot or boot configuration files.

Bootrec.exe - help fixing Windows boot

If you have problems starting your computer and find problems with it, you should use the method of fixing Windows startup errors. It doesn't matter which Windows is installed, the problem must be solved so that you can continue to perform the tasks assigned to you.

When working with a tool such as Butrek.exe, they use commands for, but if a problem situation occurs in the OS itself, the tool must be launched inside it.

If this happened in Windows 7, you will need an installation media or disk that is capable of restoring the boot sector of the hard disk. You can boot from USB or DVD, depending on the OS version.

fig. 1. When you see such a picture on the monitor, click on the highlighted function

Then you need to decide on the choice of the operating system that needs updating. This is a major challenge, as among many systems only one fix is \u200b\u200brequired. Click the Next button to continue.

fig. 2. A new window will open with recovery properties, but here you only need the boot command line

If you do not have a disk for installation on Windows 7 or a disk responsible for restoring the boot sector, you will need access to tools. They are using recovery hidden partitions. Windows 7 will be able to set them automatically when the OS is installed.

Follow the sequence: you need access to Recovery Systems, Diagnostics, Advanced Options and Command Line

Writing new boot sectors

The bootrec function with the / FixBoot parameter will enable writing to the boot sector inside the system partition on hard disks. When performing this procedure, you need to use boot partitions, but only those that are compatible with Windows 7 and 8 versions.

These parameters can be applied:

  • If there is damage to the boot sectors, and their structure and size do not match the requirements of the hard disk.
  • When writing incompatible boot sectors with the Windows system.
  • When the old Windows OS was installed in place of the new version.
In order to write a new boot sector, you need to run bootrec.exe as in the picture

For many years, Microsoft has improved the Windows operating system recovery 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 start and independently try to fix all the errors it finds. It can fix a large number of problems, however, it is quite possible that the bootloader is damaged, and the recovery system cannot cope with this problem. you can manually restore the bootloader using the Bootrec.exe utility.

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

Sequencing

Description of startup keys for 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 troubleshoot a corrupted master boot record, or if you want to remove non-standard code from it. The existing partition table is not overwritten in this case.

Bootrec.exe / FixBoot

Launched with the / FixBoot switch, the utility writes a new boot sector compatible with Windows 7 and Windows Vista to the system partition. 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 installing Windows Vista or Windows 7. For example, if Windows XP was installed, NTLDR (Windows NT Loader, Windows NT loader) will be used; ...

It should be noted that this effect can be achieved using the bootsect.exe utility, also available on the Windows 7 bootable media. To do this, you must 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 the installed Windows Vista and Windows 7 operating systems. In addition, when using it, a list of found systems is displayed that are not currently registered in the Windows Boot Configuration Data (BCD ) Store).

Bootrec.exe / RebuildBcd

Launched with this key, the utility scans all disks for installed operating systems Windows Vista or Windows 7. Found operating systems are displayed in a list from which they can be added to the Windows Boot Configuration Data Store. Use this option also if you want to completely rebuild the boot configuration data store. Before that, you need to delete the previous store. In this case, the set of commands can be as follows:

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

In the above example, the current boot configuration repository 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 drawing

Of course the 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 that is also included in the Windows 7 distribution media - bcdboot.exe.

Restoring 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 may look like this:

Bcdboot.exe e: \\ windows

Replace e: \\ windows with the path that matches your system.
This operation will repair the damaged Windows boot environment, including the Boot Configuration Data Store (BCD) files, including the bootmgr file mentioned above.

Bcdboot command line parameter syntax

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

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 US English.

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

Optional parameter. Enables verbose logging of the utility operation.

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

Summary

This 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.

No matter how advanced an operating system is, it cannot be loaded without two sectors on the hard disk that contain the code needed to start any operating system. The first sector is called the Master Boot Record (MBR); it is always located at sector 1 / cylinder 0 / head1 and is the very first sector of the hard disk. The second most important sector is the Boot Sector, located in the first sector of each volume.

Master Boot Record

The Master Boot Record is the most important disk structure; this sector is created when the disk is partitioned. The MBR sector contains a small code called Master Boot Code, as well as the disk signature and partition table. At the end of the MBR sector is a two-byte structure pointing to the end of the sector. It has the value 0x55AA. A disk signature is a unique number located at offset 0x01B8 that allows the operating system to uniquely identify a given disk.

The code in the MBR sector does the following:

  • looks for the active partition in the partition table;
  • looks for the starting sector of the active partition;
  • loads a copy of the boot sector from the active partition into memory;
  • transfers control to the executable code from the boot sector.

If these functions cannot be completed for some reason, one of the following system error messages is generated:

  • Invalid partition table;
  • Missing operating system.

Note that there is no concept of MBR for floppy disks. The boot sector is the first sector on the disk. It should also be remembered that each hard disk contains an MBR sector, but the boot code is used only on disks that have an active primary partition.

Partition table

A partition table is a 64-byte structure used to determine the type and location of partitions on a hard disk. The content of this structure is unified and does not depend on the operating system. Information about each partition is 16 bytes, so there can be no more than four partitions on a disk.

Information about each section starts at a certain offset from the beginning of the sector, as shown in table. 1 .

Note that only volumes with a System ID field of 0x01, 0x04, 0x05, or 0x06 are available under MS-DOS. However, volumes with a different System ID of this field can be deleted using the FDISK utility.

Cylinder, Head and Sector fields

The Starting Cylinder, Ending Cylinder, Starting Head, Ending Head, Starting Sector, and Ending Sector fields (collectively known as CHS) are additional elements of the partition table. The boot code uses the values \u200b\u200bof these fields to find the boot sector and activate it. The Starting CHS fields of inactive partitions point to the boot sectors of the primary partitions and the extended boot sector of the first logical disk in the extended partition.