Re-creating boot efi msr win7. System partition (EFI or ESP system partition). Repairing EFI bootloader and BCD in Windows

Most Windows 7 installations include tiny 100MB partitions called `system Reserved', also known as MSR or 'Microsoft System Reserved' partition. For the rest of this article, for brevity I will refer to this section as MSR.

One of the most basic parameters of each air conditioner is its power. The power of the air conditioner is calculated depending on where you intend to install the equipment or depending on the area of ​​the living space. If you install household air conditioners, which in terms of power are not designed to operate in a large room, then in this situation you simply will not be able to obtain proper cooling. Since the system will work to the maximum.
Note: Some OEM installations may have this section title `system` or even `recovery`. In any case, this will be the `Active` partition on the same drive as the `C` drive.

Do I have an MSR partition?

Some OEM Windows 7 installations do not include an MSR partition. To check if you have this partition, run Macrium Reflect and find the partition on system disk called `System Reserved'.

Note: If drive `C` is your `Active` partition, you just need to do backup and repairing the `C` drive for full recovery systems.

What does the MSR partition do?

The MSR partition handles the second stage of the boot process after Master Boot Record (MBR) . The MBR is located on the first sector of the disk and is loaded at system startup; after loading, control is transferred to the code section boot sector active partition, this is the MSR partition if it exists on your `C` drive. The MSR contains an `oot` directory containing Boot Configuration Data (BCD). The BCD controls the next step in the boot process and loads the operating system from the C: drive. The MSR partition is always the `Active` partition on the system disk, and must be mounted to the `Active` partition. The contents of this partition will not change, and by default, there is no drive letter assigned in Windows, so you will not be able to change it.

Do I need his image?

The image on the MSR partition is necessary to restore your system in order to move the system to new disk. However, if you only need to update the system to an earlier date, the MSR recovery partition is not needed, you just need to restore the C drive. This is necessary to restore the Windows 7 partitions to the same location for the BCD to still be able to reference them while loading. If you restore to a new or unformatted drive, and then go to the primary C drive as “primary”. The simplest solution is to use DiskRestore to restore both partitions at the same time. DiskRestore is available in the Windows PE CD rescuer and can be launched from BartPE if you are running the free edition of Macrium Reflect.

Summary

  • You must create at least one image in the MSR partition if one exists on your system. However, the partition will only take up 100 MB and that's only small volume so that there is an image of the entire image of your `C` drive.
  • If you want to restore your system to an earlier point, then you just need to restore the `C` drive (as "primary" is not active), then there is no need to restore the MSR partition.
  • If you are restoring your system to install it on an empty or unformatted drive, you should first restore the MSR partition as the "active" partition, then restore the `C' drive as primary.

Before the operating system begins to load, specialized software The computer initializes all components, checks their readiness for operation, and only then transfers control to the OS bootloader.

Previously, a set of BIOS programs was used for these purposes, but this standard is now considered obsolete, and it has been replaced by UEFI technology, which supports secure boot, has a nice graphical configuration interface and many other advantages. Most modern motherboards and laptops are already produced with UEFI. In this article we will look at how to install Linux on UEFI and what problems you may encounter.

This is an option for owners of UEFI cards who do not want to understand the intricacies of using this technology and agree to use their device as before with the BIOS. Most motherboards allow you to emulate BIOS mode. In this mode, you can install Linux without any problems and additional partitions, as it was done in the BIOS.

To enable Legasy BIOS mode, you need to enter the BIOS/UEFI settings using the F2, Del or Shift+F2 button and find the corresponding item there. For example, for me this item is on the Boot tab. Here you need to select a mode UEFI boot or Legacy.

After saving your settings, you can install your operating system as usual. If you are not satisfied with this option, then we will look at how to install Linux on UEFI.

Installing Linux on UEFI boards

I will look at installation using Ubuntu as an example, but all steps are similar for other distributions. First you need to burn the disk image to a flash drive. Most distributions already support UEFI booting.

Step 1: Burn Linux to UEFI Flash Drive in Linux

To write an image to a flash drive in Linux is better use the Etcher utility. The program will write media that can be booted into both UEFI and a regular system. After starting the program, you need to select the system image:

Then the memory card and wait for the recording to complete:

You can also write the image to a flash drive manually. This is easier than for a regular BIOS, although it will require more steps. First, format your media to FAT32. This can be done in the standard Gnome Disk Management utility:

Then unzip the contents installation image to the root of the flash drive:

sudo mount /path/to/image.iso /mnt
sudo mount /dev/sdb1 /media/flash/
sudo cp -r /mnt/* /media/flash

Here /dev/sdb1 is the name of the partition of your flash drive. You can do all these steps in the file manager. It is not necessary to use commands. Next, you need to install two flags on the partition of the flash drive where you unpacked your files - boot and lba. This can be done using Gparted. Just run the program, select your flash drive in the list of disks:

Right-click on the partition, select Manage Flags and check the boxes next to the boot and lba flags.

Whatever method you use, your flash drive is ready and you can boot from it. Most Linux images already contain an EFI boot loader and the computer's firmware will find it the next time it reboots.

Step 1 (alternative). Burning Linux to a UEFI flash drive in Windows

If you decide to burn Linux on Windows, then it is better to use the Rufus utility. It is necessary to set the following parameters:

  • Partition layout and system interface type: GPT for computers with UEFI;
  • File system: FAT32.

All other parameters are default. Once recording is complete, your flash drive is ready for use.

Step 2: Select Boot Order

In order for your system to boot from the flash drive you just recorded, you need to disable UEFI Secure Boot. This mode allows only signed operating systems to boot, and only Microsoft operating systems are signed. Therefore, for Linux this mode must be disabled. I also have this setting on the Boot tab:

In addition, you need to install the flash drive in the first place:

After this, you can restart your computer and begin installation. If you see a window like this, then everything is fine. Here you need to select "Try Ubuntu without installing", this is a prerequisite:

I will not describe all the installation steps that need to be completed, they are no different from installing a regular OS, the only difference is installing the bootloader and disk partitioning. We will dwell on it further.

Step 3. Disk partitioning for UEFI

UEFI has several differences from BIOS in this regard. The first is the use of a GPT disk partition table. This new technology, which has a lot of advantages over MBR, including a very large number of primary partitions (there are only four in MBR), recovery from damage, and much more. Read more about this in a separate article. The second difference is that the bootloader files operating system are no longer stored in the first 512 bytes of the hard drive. All of them are stored on a separate partition called ESP.

Before you click "Install Ubuntu" It is advisable to prepare the disk using Gparted. Open the utility from the main menu of the image. Then select Device -> Create Partition Table:

Select GPT partition table from the list:

Step 4: Create an ESP partition

In Gparted we only need to create an ESP partition for UEFI. To do this, select "Unnoticed", and then right-click on it and select "New":

You must select FAT32 as the file system for the partition, size - 100 megabytes. Next, click the button "Apply" to apply the changes.

Then click "Manage Flags" and check the boxes next to the flags "boot" And "efi".

Step 5. Disk partitioning option

When the system prompts you to select a markup method, you can let the system mark everything up automatically. But this is only if you do not already have any operating system installed. Otherwise we choose "Your own version":

Step 6. Assigning partitions

If you chose a different layout option, a menu will open in front of you with a list of all sections. Find the windows at the bottom "Device for installing bootloader" and select the partition for EFI from the list.

Then click on the EFI section in the list and select "EFI System Partition":

You can then continue the installation as usual. You need to create a root partition, and you can optionally create a bootloader, swap, and home partition. Read more about installing Ubuntu 18.04 you can read at.

Step 7: Complete installation

Once all the files are unpacked and the bootloader is installed, the Linux installation on UEFI is complete, you can reboot your computer and use your system as usual.

But let's also look at managing menu items and EFI bootloaders.

Managing UEFI Bootloader with eifbootmgr

When the system boots you can display UEFI settings by default by running the command:

Let's take a closer look at what each of the parameters means:

  • BootCurrent- the bootloader that was used to launch this operating system;
  • BootOrder- the order of bootloaders in which the boot manager will sort them out during system startup. If the first bootloader does not work, the second one will be used and so on;
  • BootNext- a bootloader that will be launched at the next boot;
  • Timeout- timeout during which the boot loader selection menu will be shown before it is selected automatically;
  • Items 0000 - 0004- loaders that can be used.

You can change the boot order using the -o option, for example, let's make the OS from the optical disk boot first:

sudo efibootmgr -o 0,1,2,3

And let's put Ubuntu back in first place:

sudo efibootmgr -o 3,0,1,2

You can change the timeout to display the system selection menu:

sudo efibootmgr -t 20

Here we have set the timeout to 20 seconds.

conclusions

In this article, we looked at how to install Linux on UEFI, as well as how to control the boot order in installed system. Now, if you have a desire to install this operating system on your new laptop with EFI, then you already know how to do it. If you have any questions, ask in the comments!

In this article, we will show you how to manually recover an accidentally deleted Windows boot partition on a UEFI system. Initially, the article described my experience in restoring a bootable EFI partition on Windows 7, but the article is also relevant for modern operating systems Microsoft systems(from Windows 7 to Windows 10). It has helped me out more than once after accidentally formatting or deleting an EFI partition in Windows 10. In this article we will show you a simple way to manually recreate bootable EFI and MSR partitions in Windows.

So, let's assume that somehow accidentally (or not so accidentally, for example, when trying) the EFI boot partition on a UEFI system (not BIOS) was deleted or formatted, as a result of which Windows 10 / 8.1 / 7 stopped booting, cyclically asking to select boot device (Reboot and select proper boot device or insert boot media in selected). Let's see if it can be restored Windows performance when deleting a partition from Boot Manager without reinstalling the system.

Warning. The instructions assume working with disk partitions and are not intended for beginners. If you misinterpret commands, you may accidentally delete all data on your hard drive. It is also highly recommended that you back up your important data to a separate media.

Partition structure on a GPT disk

Let's look at what the partition table of a bootable hard drive with GPT markup should look like. At a minimum, the following sections should be present:

  • EFI system partition (EFI System Partition or ESP - Extensible Firmware Interface) - 100 MB (partition type - EFI).
  • Microsoft backup partition – 128 MB (partition type - MSR).
  • The main Windows partition is the partition with Windows.

This is exactly the minimum configuration. These sections are created Windows installer when installing the system on an unpartitioned disk. PC manufacturers or users themselves can additionally create their own sections containing, for example, the environment Windows recovery in file winre.wim(), section with in a backup manner systems from the manufacturer (allows you to roll back to original state computer), user partitions, etc.

EFI partition with the Fat32 file system is required on disks with GPT partitioning on UEFI systems. This section, similar to the System Reserved partition on MSR-partitioned disks, stores the boot configuration storage (BCD) and a number of files necessary for Windows boot. When the computer boots, the UEFI environment loads the boot loader from the EFI partition (ESP) (EFI\Microsoft\Boot\ bootmgfw.efi) and transfers control to him. If this partition is deleted, the OS cannot be booted.

MSRchapter on GPT disk used to simplify partition management and is used for utility operations (for example, when converting a disk from simple to dynamic). This is a backup partition and does not have a partition code assigned to it. User data cannot be stored on this partition. In Windows 10, the MSR partition size is only 16 MB (in Windows 8.1, the MSR partition size is 128 MB), file system– NTFS.

Manually creating EFI and MSR partitions on a GPT disk

Because the system does not boot correctly, we will need an installation disk with Windows 10 (Win 8 or 7) or any other boot disk. So, boot from the installation disk and press the key combination on the installation start screen Shift+F10 . A window should open command line:

Let's launch the disk and partition management utility:

Let's display a list hard drives in the system (in this example there is only one, disk 0 . Asterisk ( * ) in the Gpt column means that the disk uses a GPT partition table).

Let's select this disk:

Let's display a list of partitions on the disk:

In our example, there are only 2 partitions left in the system:

  • MSR partition - 128 MB
  • Windows system partition – 9 GB

As we can see, the EFI partition is missing (deleted).

Our task is to delete the remaining MSR partition so that at least 228 MB of free space remains unallocated on the disk (for MSR and EFI partitions). You can delete the remaining partition using graphical GParted or directly from the command line (that’s exactly what we’ll do).

Select the partition to delete:

Select partition 1
And delete it:
Delete partition override

Let's make sure that only the Windows partition remains:

Now we can manually recreate the EFI and MSR partitions. To do this, in the context of the diskpart utility, run the following commands:

Select a disk:

create partition efi size=100

Make sure that the 100 MB partition is selected (the asterisk opposite the Partition 1 line):

list partition
select partition 1
format quick fs=fat32 label="System"
assign letter=G
create partition msr size=128
list partition
list vol

In our case, the section with Windows already drive letter assigned C:, if this is not the case, assign a letter to it as follows:

select volume 1
assign letter=C
exit

Repairing EFI bootloader and BCD in Windows

Once you have created the minimum disk partition structure for the UEFI system, you can proceed to copying the EFI boot files to disk and creating configuration file bootloader (BCD).

Let's copy the EFI environment files from the directory of your disk where your Windows is installed:

mkdir G:\EFI\Microsoft\Boot

xcopy /s C:\Windows\Boot\EFI\*.* G:\EFI\Microsoft\Boot

Let's recreate the configuration Windows boot loader 10 / 7:

g:
cd EFI\Microsoft\Boot
bcdedit /createstore BCD
bcdedit /store BCD /create (bootmgr) /d “ Windows Boot Manager"
bcdedit /store BCD /create /d “Windows 7” /application osloader

You can replace the inscription “My Windows 10” with any other one.

Advice. If only the EFI environment files were damaged on the EFI partition, but the partition itself remained in place, you can skip the process of rebuilding partitions using diskpart. Although in most cases it is enough to restore the bootloader according to the article. You can manually recreate the BCD on regular MBR+BIOS systems.

The command returns the GUID of the created entry; in the next command, this GUID must be substituted instead of (your_guid).


bcdedit /store BCD /set (bootmgr) default (your_guid)
bcdedit /store BCD /set (bootmgr) path \EFI\Microsoft\Boot\bootmgfw.efi
bcdedit /store BCD /set (bootmgr) displayorder (default)

Further commands are executed in the context (default):

bcdedit /store BCD /set (default) device partition=c:
bcdedit /store BCD /set (default) osdevice partition=c:
bcdedit /store BCD /set (default) path \Windows\System32\winload.efi
bcdedit /store BCD /set (default) systemroot \Windows
exit

We reboot the computer... In our case, it did not boot the first time, we had to additionally dance with a tambourine:

  1. Turn off the power to the PC.
  2. Disconnect (physically) the hard drive.
  3. We turn on the PC, wait for the boot error window to appear, and turn it off again.
  4. We connect the disk back.

Then in our case (testing was carried out on) we had to add a new boot menu item by selecting the file EFI\Microsoft\Boot\bootmgrfw.efi on the EFI partition.

In some UEFI menus, by analogy, you need to change the priority of boot partitions.

After all the above manipulations, Windows should boot correctly.

When we install Windows to empty (unlabeled) HDD or a formatted partition in the usual way - using installation media, we don't need to bother creating EFI-operating system markup. All necessary partitions, in particular the boot EFI, are created automatically if the computer is running in BIOS UEFI. But if you need to install Windows in a different way.

And to another hard drive with its own independent bootloader, if there is a question about restoring the system after deletion hard drive with a boot partition, in such non-standard situations manual work will be required.

Windows on the second one connected to the computer GPT-the disk does not install with its own EFI-structure. During a normal installation from installation media, the bootloader of the second system is registered on the existing one. EFI-partition – the one located on the first disk.

What makes the second Windows vulnerable is that it will not be able to exist independently if the boot loader of the first system is damaged. Or if the first hard drive fails or is simply disconnected. To second Windows had its own independent EFI- markup, during its installation you need to make the first system invisible - disable its media in the settings BIOS, if possible, or in hardware. This is not always convenient, and sometimes even impossible in the case of laptops.

A second Windows with its own independent bootloader can be installed by programs like or running in the environment of the current system WinToHDD. But they will require you to specify the bootloader EFI-chapter.

It's very easy to create one on an empty hard drive.

1. Create an EFI partition on an empty hard drive in the command line

So we have initialized as GPT a medium without markup or data.

Launch the command line.

Be sure to do this on behalf of the administrator.

We enter one by one:

diskpart lis disk sel disk 1 (instead of 1, indicate the number under which the hard drive you need is listed above) creat par efi size=100 format fs=FAT32

lis disk

sel disk 1 (instead of 1 indicates the number under which the hard drive you need is listed above)

creat par efi size = 100

format fs = FAT32

In the disk management utility we see that on the second hard drive appeared EFI-section on 100 MB. Now we can create a regular section to indicate its type to programs or WinToHDD as a system partition WITH .

2. Creating an EFI partition on an empty hard drive using the Bootice utility

Who doesn't like the command line to create EFI-to mark up empty media, you can use the utility with graphical interface. It is free and can be downloaded from any software portal on the Internet. In the main window, select the second hard one. Click.

Then - "Re-Partitioning".

First of all, check the box GPT in the column "Partition table type". Then put a tick "Create ESP partition". And at the top in the graph "Settings" remove all values "Size" except the last one. Click "OK".

As a result, we get a disk layout with EFI-section on 128 MB and a partition that contains the rest of the disk space.

But what if the hard drive is not empty? If it has a structure and stored user data. Or we want to restore Windows that has lost its boot boot EFI-partition after failure or disconnection of the hard drive on which its bootloader previously existed. And there are solutions for this case. To restore a system without a bootloader, we naturally need an environment to perform certain operations. In one case, regular Windows installation media will do. In another case, we will work with a disk space manager, so we will need a functional and reliable LiveDisk WinPE. One of these is LiveDisk Sagittarius. Image download site - Sergeistrelec.Ru .

Note: the following operations cannot be performed on disks dynamic type. The disk of a Windows mirror that is left without a bootloader must first be converted to a basic type. This can only be done by third-party means.

3. Creating an EFI partition at the end of Windows

So, we have, for example, a second Windows that has lost EFI-bootloader after the failure of the disk with the first system.

How to launch it? The simplest and quick way- create EFI-partition at the end of the system partition and recreate the bootloader. You don't need anything more than the command line to do this. Boot from the Windows installation media, immediately press Shift + F10. This combination will launch the command prompt. If we use LiveDisk Sagittarius, we start, accordingly, from it.

And already on board we use the command line.

In it we enter:

diskpart lis vol sel vol 1 (instead of 1, indicate the number under which your partition with the system is listed above) shrink desired=100 creat par efi format fs=FAT32

Here is the specified section compressed to 100 MB and in the vacant place was created EFI-chapter.

Now we can recreate the bootloader.

On the command line, exit :

That's it - Windows functionality has been restored.

4. Creating an EFI partition before Windows

The boot partition usually exists at the beginning of the disk, before the system partition. It doesn't have to be this way, but it's done to speed things up. Windows startup. To UEFI I found the bootloader faster. On SSD such optimization is unlikely to be noticeable, but in the case of HDD you can compete even for a little bit of productivity.

On board LiveDisk Sagittarius let's launch. Click on the system partition and click on the operations sidebar "Change of size".

Pull the slider on the map a little to the right so that in the column below "Unoccupied space in front" several appeared MB. Next, instead of the drawn number, we enter 105 . To make it work 105 MB. Click "OK".

As a result, the program will release the correct amount of disk space, in our case 102.01 MB. And it will leave a small tail at the back of the section. Click.

We confirm.

Now let's launch the command line. And we create EFI-section exactly as described in clause 1 articles.

Here EFI-the section has been created.

All that remains is to recreate the bootloader, as described at the end clause 3 articles.

On hard drives most computers running Windows control traditionally there are two sections - system and user, at least that's what Explorer shows. In fact, there are more partitions, just some of them are hidden and do not have a letter, which is easy to verify by opening the standard disk management snap-in. The meaning of hiding them, we hope, is clear to everyone. They contain important data.

Deliberate or accidental deletion of which can lead to Windows not working correctly or even being unable to boot.

Another thing is a healthy interest in them, many people would probably like to know what the service partitions of the system are hiding and what the risk is for a user who wants to delete them, say, for the sake of increasing free disk space. By the way, you can still delete service partitions, but you need to do it correctly and only when it is really necessary. It should also be remembered that in any case this will lead to a decrease in the overall fault tolerance of the system, which is ensured by separate storage of important system and boot files. However, offline storage of the bootloader is far from the only purpose of hidden partitions; they may contain encryption data BitLocker, image "factory" system, recovery environment, and so on.

Hidden sections first appeared in Windows 7, V XP there was nothing like that; if the system stopped booting, it was simply reinstalled. On Windows Vista a more advanced mechanism was used, in this OS the user could create on DVD -disk recovery environment and use it to bring the system back to life if it could not boot. But in Windows 7 could already be seen on the disk alone, and in OEM -systems have two service partitions - "Reserved by the system" size 100 MB and an untitled volume ranging in size from 6 before 15 GB, containing an image of the original operating system divided into several parts with "factory" settings - analogous to full backup, created by programs like Acronis True Image .

If you mounted the first one, you would see a folder storing boot configuration files Boot and file download manager bootmgr, on the second volume you would find a standard program Recovery and several original system image files. With the exit Windows 8.1, and then Windows 10 everything has changed a little. Chapter "Reserved by the system" got bigger, got support UEFI, and along with it several more service volumes were added to the disk, including the one required for GPT -disk partition MSR, not showing up in Disk Management. You can view all hidden partitions on your computer using third-party disk managers or the most common command line. Run it as administrator and run the following commands:


list disk
select disk 0
list partition

On our PC There are two hidden service sections, you may have more. Let's try to enter them, for which we will mount the volumes that interest us using the command. Without leaving the utility, run the following commands:

list volume
select volume 2
assign or assign letter=x

2 V in this example this is the number of the mounted volume, and X– the letter assigned to it (if you do not specify a letter, it will be selected and assigned automatically) . After that, go to the section through Explorer and look at the contents, having previously turned on the display of hidden objects.

However, this method has a drawback - folders may not be viewable due to your lack of necessary rights, so we still recommend using third-party file managers, best included in "alive" disks.

So, what do our hidden sections actually contain?

On disk "Restore" size 498 MB there is a folder Recovery .

Which in turn contains the folder WindowsRE .

With Windows Recovery Environment.

If you remove it, Windows will still be able to boot, however, all disaster recovery tools will become unavailable.

Second service section (EFI encrypted) size 99 MB contains a folder EFI .

Where directories are stored Boot And Microsoft with download files.

In addition to these two volumes, you may have one or two more service partitions. Chapter MSR size 128 MB marked "Reserved" not as important as section EFI, but its removal can also lead to disastrous consequences. Typically it stores data responsible for markup GPT, but it may also contain boot files. Biggest hidden section (more than 5 GB) marked "Recovery" contains an image "clean" Windows with original settings. This section appears on OEM -devices with pre-installed OS.

If there is little space left on the disk, you can delete it, but at the same time you will lose the ability to restore the system to "factory" settings. Finally, the fifth hidden section marked "Recovery" size 400-600 or a little more than a megabyte can be found on computers updated with Windows 8.1 before Windows 10. It stores the recovery environment previous version systems, that is Windows 8.1. You can format it without any negative consequences.

And that's all for now.

If you suddenly want to delete "extra" service section, first think carefully about whether this is really necessary and only then proceed with what you have planned.