Service disk partitions in Windows and their contents. How to create a bootable Windows EFI partition on a GPT disk manually How to create an efi partition

So you have indicated BIOS settings booting from CD / DVD or from USB, and when booting from Ubuntu LiveCD, instead of a purple screen with keyboard icons and a little man, we got this screen:

It's okay, it happens. In this case, you need to take into account a number of points, which will be discussed in this section. By the way, the presence of a purple screen at boot does not mean at all that you do not have UEFI, just with a black screen, all the features of UEFI appear most clearly. So, in any case, reading this section will be very useful. In the meantime, feel free to select the top line "Try Ubuntu without installing" and press Enter. After a short wait, you will be taken to the Ubuntu desktop, and while you wait for Ubuntu to load, let's talk about UEFI.

Introduction to UEFI and GPT

You probably remember that one of the goals of this guide is to teach the reader how to effectively and easily use all the main tools of the system. But for this you need to dig deeper and talk about the hardware stuffing of your computer, and how this stuffing works with the system. Therefore, again, the theory cannot be dispensed with without it.

What happens when you turn on the computer? First of all, the computer must correctly initialize itself, that is, its own hardware, and transfer control to the operating system loader. This process is handled by the "Extensible Firmware Interface" ( EFI) (Extensible firmware interface) - interface between operating system and firmware that controls the low-level functions of the hardware. Previously, BIOS was responsible for this, and now EFI, which, after another change in the standard, became known as the "Unified Extensible Firmware Interface" ( UEFI) is the name and will be used in what follows. It should be noted that UEFI, as a more modern interface, fully supports all BIOS functions, the opposite, unfortunately, is not true. In the settings, the BIOS support mode is most often called “Legacy” (“inherited” or “traditional” in English) or simply “UEFI Disabled” (“UEFI is disabled”, as you might guess). For now, however, we are interested in the enabled UEFI mode.

So, when you turn on the computer, UEFI starts to initialize the hardware and finds some kind of block device, say, HDD. You probably know that the entire hard disk is almost never used - the disk is necessarily divided into sections, including for ease of use. But to break it into sections, you can, today, two in standard ways: via MBR or GPT. What is their difference?

MBR("Master Boot Record" - the main boot record) uses 32-bit identifiers for partitions, which are placed in a very small piece of space (64 bytes) at the very beginning of the disk (at the end of the first sector of the disk). Due to such a small volume, only four primary partitions are supported (more on this can be found in this article). Since 32-bit addressing is used, each partition can be no larger than 2.2 TB. Also, the boot record does not have any spare MBR, so if an application overwrites the master boot record, all partition information will be lost.

GPT("GUID Partition table" - table GUID partitions) uses already 64-bit identifiers for partitions, so the piece of space in which partition information is stored is already more than 512 bytes, in addition, there is no limit on the number of partitions. Note that the partition size limit in this case is almost 9.4 ZB (yes, you read that right - zettabyte, one followed by twenty-one zeros!). And at the end of the disk there is a copy of GPT that can be used to repair a damaged main partition table at the beginning of the disk.

So, when communication between the hardware and the operating system is carried out through the enabled UEFI mode (and not the Legacy BIOS), using GPT for partitioning is practically compulsory, otherwise there will certainly be compatibility issues with the MBR .

Well, it seems that they figured out the block devices, UEFI initialized everything correctly, and now it must find the operating system loader and transfer control to it. As a first approximation, it looks like this: since UEFI is the successor to the BIOS, it searches for the bootloader in strict accordance with the established rules. If it finds an operating system loader that does not support UEFI, then BIOS emulation mode is activated (that's right, even if Legacy BIOS is not explicitly specified). And it starts all over again, with the only difference being that now emulated The BIOS checks the status of the hardware and loads firmware, which are simple drivers for individual hardware components. Thereafter emulated The BIOS again searches for the OS bootloader and activates it. That, in turn, loads the operating system or displays a list of available operating systems.

And in the case of UEFI, everything happens a little differently. The fact is that UEFI has its own operating system loader with integrated launch managers for installed operating systems. To this end, for it - for the UEFI bootloader - a small partition (100-250 MB) must be created on the disk, called the "Extensible Firmware Interface System Partition" (system partition of the expandable firmware interface, ESP). In addition to the specified size, the partition must be formatted in the FAT32 file system and be bootable. It contains drivers for hardware components that can be accessed by the running operating system. And in this case, the download occurs directly from this partition, which is much faster.

So, let's summarize some results: in order to fully use the UEFI functionality, the disk must be with GPT, and it must have a special partition ESP. Pay attention to the phrase "to complete use the functionality "- there are many ways to install Ubuntu on a system with a "trimmed" UEFI to one degree or another, and all of them depend on the presence or absence of pre-installed operating systems on your computer. For example, you want to keep Windows preinstalled. Which Windows - "seven" or newfangled 8.1? Or maybe, God forbid, you have a “Perat Windows” installed, activated with MBR, and not wanting to start with GPT, and you, nevertheless, want to study it further? In addition, a lot depends on the bitness of operating systems - without dancing with a tambourine it is impossible to make a 32-bit system work with UEFI. And there are many such examples. Therefore, this section will only talk about installing Ubuntu in the "maximum" UEFI mode, although even after reading this introduction, you will already be able to imagine the device of your computer and, if desired, implement your own installation script.

Well, let's get started?

Disk partitioning

So you've booted into Ubuntu from the LiveCD in UEFI mode. Open "GParted Partition Editor", but for now let's talk about very important features that you need to pay attention to.

Most importantly, you must have a plan of your actions, believe me - the list of steps and the order in which they are carried out is quite extensive, so it is advisable to write down the main points of the plan somewhere on a piece of paper and periodically check with them. So what do you know. For a normal installation of Ubuntu in UEFI mode, your computer's hard drive must be properly prepared, namely:

    The disk must be with GPT;

    The disk must have a special ESP partition;

    The disk should have standard partitions: system, swap, and a partition for the home directory.

In addition, you need to decide on the operating systems on your computer - whether Ubuntu will be the only system, or there will be other systems supporting UEFI mode next to it, depends on the breakdown and installation plan.

Let's start by answering the second question: the availability of other operating systems. If your computer has already installed operating systems that support booting in UEFI mode (for example, Windows 8), and you do not intend to refuse them yet, then the first two points of the plan have already been completed: the ESP partition probably already exists, and the disk, of course, with GPT. Let's check that this is indeed the case.

Suppose after launching the GParted partition editor, you will see the following window:

What information can be obtained by carefully studying this window? First, look at the "File System" column: all partitions are formatted in ntfs, except for one partition with a fat32 file system - this, apparently, is the ESP partition. Windows 8 is already installed on the disk (partition / dev / sda4 - in Windows this is the C :) drive - this is indicated by label disk ("Label" column). Secondly, there are a number of Windows service partitions on the hard disk - you can find out about this not only by the labels (WINRE_DRV and LRS_ESP), but also by flags(column "Flags") - all these sections are hidden because they have the hidden flag set, which hints at the special nature of the information on them. And finally, take a closer look at the /dev/sda5 partition - did you happen to lose your D: drive in Windows? Here he is, safe and sound.

So, the first two points of the plan have already been completed, and the implementation of the third point: creating partitions for Ubuntu - is described in sufficient detail in the example of using GParted to repartition a hard disk. Let us briefly recall that from the data disk (in the example it is /dev/sda5, or the D: drive in Windows), you need to “cut off” enough space and create three partitions in its place: swap, system and a partition for the home directory. Also note that your disk is GPT, so an extended partition containing logical drives, it does not, therefore, when creating partitions, select Primary partition("Main section").

Do not perform any operations with service Windows partitions- they are designed for the normal functioning of this OS. Accidental or deliberate modification of these partitions is guaranteed to cause problems in Windows, up to its complete inoperability.

The end result should look something like this picture:

Here are additionally created partitions:

Please write down the purpose of the sections. In the example shown:

    /dev/sda2 - EFI partition(ESP)

    /dev/sda6- system partition (partition for the "root" of the system)

    /dev/sda7- swap partition

    /dev/sda8- section for user data.

This information will be very useful in the future installing Ubuntu, because due to the large number of partitions, it is very easy to get confused and assign the required mount point to the wrong "number".

Nevertheless, we continue to work with the GParted editor. Your task is to remove all partitions and create the disk configuration that Ubuntu needs in the free space. To do this, you can click right click click on each section and select "Delete" from the drop-down menu. But it's better to do it differently: find the "Device" item on the menu bar of the GParted editor and select "Create Partition Table ..." from the menu (Create partition table ...). A warning will appear:

WARNING: This will ERASE ALL DATA on the ENTIRE DISK /dev/sda

(WARNING: this will DELETE ALL DATA on THE ENTIRE DISK /dev/sda)

Don't worry, did you take care of the backups? Look a little lower - at the inscription "Advanced" (Details). Click on the triangle on the left and select gpt from the menu:

All disk space will turn gray. Right-click on it and start creating the necessary partitions by selecting "New" from the drop-down menu. The first of the new partitions is a special ESP partition, which, as you remember, is required for UEFI to work. Since it is formatted in a file system that is not native to Linux, and in addition, it must be bootable, it must be located at the beginning of the disk space. Define its size in the field "New size (MiB)" (New size in MiB) 100 MB, and file system-fat32:

In the same way, create partitions for future: system (15 GB with ext4 file system), swap partition (4 GB with linux-swap) and for home directory (all remaining space in ext4). As you remember, GParted does not apply changes immediately, but simply queues them for execution. Therefore, click on the green checkmark "Apply All Operations" (Perform all operations):

Yes, it is not necessary to manage the boot flags at this stage - the Ubuntu installer will do everything as it should. Now carefully read about how to install Ubuntu, and when you are ready, we will continue.

Installing Ubuntu

After this preparatory work, installing Ubuntu should not be difficult, especially if you carefully read the installation rules. Just pull out a piece of paper with a list of partitions and note that for the special EFI partition (/dev/sda2 from the example of installing Ubuntu and Windows together), you need to precisely assign the property EFI boot partition, not the spare BIOS boot area:

If you don't, the installer will show you this notification:

Fix the error, and if that doesn't work, exit the installer, launch the GParted editor, and verify that everything above is done.

The assignments for all other partitions required when installing Ubuntu are described in great detail in this section, so there is not much point in dwelling on this in more detail.

Possible problems

Sometimes it happens that after installation one of the operating systems preinstalled on the computer does not start. Well, without going into rather complicated ways to bring everything back to normal, we note that there is a comprehensive solution. possible problems with loading. The name of this solution is boot-repair .

This little program is very powerful tool, which allows you to correct almost all errors that may occur when booting ubuntu and other operating systems after installation.

Stick to the golden rule: Never fix what's not broken»!

Boot into Ubuntu. It doesn't matter how you do it - Boot-Repair works both from the LiveCD and on the installed system. Of course, if you are having difficulty booting a freshly installed Ubuntu, then the first method becomes the only one. First you need to install Boot-Repair on your computer, this is done using the terminal. Press Ctrl + Alt + T and in the window that appears, type:

: Change team closer to release.

sudo add-apt-repository "deb http://ppa.launchpad.net/yannubuntu/boot-repair/ubuntu saucy main"

Now, of course, you will say: “What are you doing there, at all? So many letters - I don’t understand anything and I’ll definitely make a mistake!” Of course, no one enters the presented command letter by letter into the terminal - just select it completely and click the middle mouse button in the terminal window, or drag the selected text there as well. Press Enter . If you are on an already installed Ubuntu, you will be prompted to enter your password. Please note that when entering a password, no characters are displayed: no dots, no asterisks - nothing at all - probably no need to explain why this is done. After entering the password, press Enter again.

Download public key repository with the program from the trusted key store:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 60D8DA0B

Update the application list with the command:

Sudo apt-get update

Install and run Boot-Repair:

sudo apt-get install -y boot-repair && (boot-repair &)

After a short scan, the main Boot-Repair window will appear:

: In the process of writing.

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

One of the most important 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 ​​\u200b\u200bthe living space. If you install household air conditioners that are not designed to work in a large room in terms of power, then in this situation you simply cannot get proper cooling. Since the system will work to the maximum.
Note: Some OEM installations may have this section titled `system` or even `recovery`. In either case, this will be the `Active` partition on the same drive as the `C` drive.

Do I have an MSR partition?

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

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

What does the MSR section do?

The MSR section handles the second stage of the boot process after the Master Boot Record (MBR) . The MBR is located on the first sector of the disk and is loaded at system startup, after booting, control is transferred to the boot sector code section of the active partition, this is the MSR partition if it exists on your `C` drive. The MSR contains the `oot` directory containing the Boot Configuration Data (BCD) . 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 drive, and must be set to the `Active` partition. The contents of this partition will not change, and by default, no drive letter is assigned in Windows, so you cannot change it.

Do I need his image?

The image in 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 refer to 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 - available in the Windows PE CD rescuer and can be run from BartPE if you are running the free edition of Macrium Reflect.

Summary

  • You must create at least one image on the MSR partition if it exists on your system. However, the partition will only take up 100 MB and it is only a small amount to have 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" not active), then there is no need to restore the MSR partition.
  • If you are restoring your system to install it on a blank or unformatted drive, then you should first restore the MSR partition as the "active" partition, then restore the `C` drive as primary .

When we install Windows on an empty (untagged) hard disk or partition formatted in the usual way - using installation media, we don't have to worry about creating EFI operating system markup. All necessary sections, in particular, boot EFI, are created automatically when the computer is in BIOS UEFI. But if Windows needs to be installed in a non-traditional way.

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

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

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

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

Creating one on an empty hard drive is very easy.

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

So, we have initialized as GPT media without markup and data.

We start the command line.

Be sure to do this as an administrator.

Enter in succession:

diskpart lis disk sel disk 1 (instead of 1, specify the number under which the hard disk 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 disk you need is listed above)

create par efi size = 100

format fs=FAT32

In the disk management utility, we see that the second hard drive has EFI- section on 100 MB. Now we can form a regular section to indicate it to programs like or WinToHDD as system partition WITH .

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

Who doesn't love the command line to create EFI-blank media markup can use the utility with GUI. 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 - "Repartitioning".

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

As a result, we get a disk layout with EFI- section on 128 MB and a partition containing 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 EFI-partition after the failure or disconnection of the hard drive on which its bootloader previously existed. And there are solutions for this. To restore a system without a bootloader, we naturally need an environment to perform certain operations. In one case, a regular Windows installation media will do. Otherwise, we will work with a disk space manager, so we 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 the Windows mirror left without a bootloader must first be converted to base type. This can only be done using third party tools.

3. Creating an EFI Partition at the End of Windows

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

How to run it? The simplest and fast way- create EFI-partition at the end of the system partition and recreate the bootloader. Nothing more is needed for this. command line. Booting from the installer Windows media, immediately press Shift + F10 . This combination will launch a command prompt. If we use LiveDisk Sagittarius, we start, respectively, from it.

And already on board we use the command line.

In it we enter:

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

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

Now we can recreate the bootloader.

On the command line, exit :

That's it - Windows 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 found the bootloader. On the SSD such optimization is unlikely to be tangible, but in the case of HDD you can compete even for a fraction of productivity.

On board LiveDisk Sagittarius we start . We make a click on the system partition, on the sidebar of operations, click "Change of size".

Slightly pull the slider on the map to the right so that in the column below "Unallocated space in front" several MB. Next, instead of the drawn figure, we enter 105 . To make it work 105 MB. We press "OK".

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

We confirm.

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

Here EFI-section created.

It remains only to recreate the bootloader, as described at the end item 3 articles.

As soon as we turn on the computer, it immediately starts running a miniature operating system, which we know as the BIOS. It deals with testing devices, memory, loading operating systems, and allocating hardware resources. Many of the features in this suite of programs (usually around 256-512 KB in size) make it possible to support older operating systems like MS-DOS, giving them a lot of options. Since the days of the PC/AT-8086, the BIOS has changed very little, and by the time the first Pentiums were launched, its development had almost stopped. Actually, there was nothing to change in it, except for the dual BIOS, support for network facilities and the possibility of flashing. But there were a lot of minuses: the starting entry into the real mode of the processor, 16-bit addressing and 1 MB of available memory, the inability to have a "repair" console. And, of course, the eternal problem of support hard drives. Even now, drives up to 2.2 TB are guaranteed to be supported, no more.

Back in 2005, Intel decided to change the BIOS to EFI / UEFI (Unified Extensible Firmware Interface). The EFI system is a more advanced base operating system. On some Unix and Windows platforms, UEFI has been around for a long time, but the mass transition has not yet taken place, despite good intentions. And they are:

  • The presence of the notorious console for repairing system parameters and installing the OS;
  • The EFI section makes it possible to perform some actions without loading the OS (watching movies, starting music);
  • Internet access and therefore availability installed drivers network, TCP/IP stack, etc.);
  • Presence graphics mode and user scripts;
  • Support for giant disks;
  • UEFI storage on new format partitions (GPT);
  • Full support for all hardware from launch.

UEFI can use a generic executing machine like the JVM to consume hardware-independent code, and this opens up vast possibilities for creating "bootable" software.

There is also criticism of this technology. In particular, its implementation can lead to cutting off new players from the operating system market: there will always be some technological loophole in the code for this. Like, for example, the inability to boot Windows 98 from modern BIOSes. But, worse, you will have to forget about the millions of MS-DOS programs and other systems that relied on BIOS functions to work. Perhaps they will still be emulated, but there are doubts about this. And among them, there are probably important programs that there will be no one to rewrite. However, all these issues are solvable - at least through virtual operating systems. But the fact that new types of viruses will appear is certain, and we will be able to see this pretty soon.

Hello! Windows 8.1 won't boot on laptop with UEFI BIOS and I can't do anything. When loading, an error occurs on the screen File: \ EFI \ Microsoft \ Boot \ BCD ... I studied all the Internet articles on this topic, but nothing helps in my case.

What have I done!

  1. Booted from installer Windows disk 8.1 and searched for the installed operating system with the command bootrec /RebuildBcd, an error occurred Scanning installed systems Windows completed successfully. Total Windows systems detected: 0»
  2. Deleted partition (300 MB), encrypted (EFI) system partition containing all files Windows bootloader 8.1 team del vol, then applied Automatic recovery boot, the system re-creates this partition, but does not boot. I made this section active on the command line, it did not help either.
  3. I entered commands that are successful, but Windows is not loaded.

    bootrec /FixMbr

    bootrec /FixBoot

  4. Also formatted the same partition (300 MB) Encrypted (EFI) with the command format fs=FAT3 and recreated it.
  5. I tried to write for Windows 8.1 a new boot store with the command bcdboot.exe C:\Windows, where (C:) is the partition with the operating system installed Windows system 8.1 and I get the error againFailed to copy download files.

I don’t know what else to do and how to restore the Windows 8.1 bootloader. What can you suggest?

Hello friends! My name is Vladimir and I will answer this question.

If your Windows 8.1 does not boot and you have used all available means to restore the bootloader, then you can delete the system boot manager: the 300 MB encrypted (EFI) system partition, as well as the 128 MB MSR partition and create them again.

In Disk Management you can only see 300 MB encrypted (EFI) system partition, 128 MB MSR partition visible only on the command line when typing a command"lispar".

Note: If you are inexperienced, do not perform this operation unless necessary, use other methods from the section about first. If you want to experiment on a working laptop, then do not start work without first creating backup these sections, and best of all, create a .

We will delete and create new partitions:

1. Section (400 MB) containing environment Windows Recovery 8.1 (from this section and you can completely get rid of and use, if necessary, the recovery environment located on bootable media with Win 8.1).

2. Section (300 MB), Encrypted (EFI) system partition containing all Windows 8.1 boot loader files.

3. Service partition MSR (Microsoft System Reserved) 128 MB, required for partitioning GPT disks.

We boot the laptop from and in the initial window of the system installation, press the keyboard shortcut Shift + F10,

A command prompt window opens, enter the following commands:

diskpart

lis dis (lists physical disks).

sel dis 0 (we select a 931 GB laptop hard drive, and a second 14 GB drive - bootable flash drive Windows 8.1).

lis par (show all partitions of the selected disk, we will delete the first three partitions).

sel par 1 (select the first section

del par override (we delete the partition, to delete the ESP and MSR partition or the laptop OEM partition, you must specify the override parameter)

sel par 2

del par override

sel par 3

del par override

Everything, we deleted all three hidden sections.

Now, if you select a drive and enter the lis par command, then we will see only two partitions on the laptop's hard drive:

Section 4 - installed Windows 8.1

Section 5 - hidden section restore with factory settings.

Create a newly encrypted (EFI) 300 MB system partition, as well as a 128 MB MSR partition

We enter the commands:

diskpart

lis dis (displays a list of disks).

sel dis 0 (select laptop hard drive).

create par efi size=300 (we create an encrypted (EFI) 300 MB system partition).

format fs=fat32 (we format it into the FAT32 file system).

creat par msr size=128 (create a 128 MB MSR partition)