Yandex
Update cookies preferences

How the server starts

Even experienced system administrators sometimes feel difficulty in understanding all the steps that take place during server startup. That's why we decided to examine this process in detail. For clarity, let's consider the server startup with Intel 64-bit processor; in Legacy mode; MBR disk partitioning; GRUB2 boot loader.

Launch

The server can be turned on in a variety of ways, the main one being pressing the Power On button. There are other options, such as activation via network or external devices. The first methods require an intelligent approach and sending commands via data buses.

Reset

The first stage of starting the equipment is to activate the power supply and set the reset signal for the processor. The processor frequency generator is stopped and the registers are reset to the initial values set by the manufacturer.

When the power supply is turned on, temporary changes occur that may cause the output voltage to temporarily exceed the allowable limits, which negatively affects the processor. Therefore, the reset signal is not cleared until the power supply stabilizes.

Stabilization

Once the voltage has stabilized, the Power Good signal is set. This indicates that the motherboard can start up all server components. The chipset then addresses all connected devices, the reset signal is cleared, and the processor frequency generator is started.

What is BIOS

It is a system that provides control of the software interface for interacting with hardware and devices. The main task of BIOS is to initialize and verify the hardware as soon as the server starts up.

BSP

When the server is turned on, only one core of one processor is activated - the base processor core (BSP). The other cores remain in standby mode. After the Reset signal disappears, the processor registers are set to a specific state so that the processor can function in a special 32-bit Initial Processor Mode.
In this mode, the processor can execute instructions designed for 32-bit systems and use the 4 GB address space.

Reset Vector

When the reset signal is activated, the processor instruction counter points to address 0xFFFFFFFFFFF0, which is known as the Reset Vector. This is the first instruction that the processor decodes and executes.

In Legacy mode, this instruction is a Far Jump to the memory segment containing the BIOS code. After it is executed, the processor enters 16-bit Real Mode and begins executing the BIOS code.

Real Mode

This is a compatibility mode for legacy 16-bit processors, offering access to 16-bit instructions only and limiting the lower memory address space to 1 MiB.

The BIOS, which contains the executable code, is stored on an external device with limited access speed. It initializes RAM and copies its code from ROM to RAM to speed up operation. The BIOS is compatible with legacy processors, so it performs all operations in 16-bit mode.

POST - enable automatic testing

POST is a critical stage of BIOS operation. It can be either a brief or a full test. Full testing includes checking all available controllers and testing all RAM, which can take considerable time.

Simplified power-on testing speeds up the boot process and includes only the minimum necessary steps:

  • BIOS software integrity verification in ROM using the checksum verification mechanism;
  • detection and initialization of the main controllers, system buses and connected devices;
  • determination of RAM size and testing of the first segment (64 kilobytes);
  • transfer of control to the bootloader.
The display of the current POST code is considered to be the most informative method for obtaining data on possible faults. If the tests are successful, the codes change quickly, but in case of a failure, POST stops, showing the ID of the failed test. Modern motherboards are equipped with LED indication to help identify a damaged component.

The successful start of booting is accompanied by a beep. The duration and number of sounds can also be used to identify a problem in the system.

In rare cases, you can use an external device - a POST card. Motherboards transmit information about POST tests via data buses, and the POST card processes this information and displays the results on the available indicators.

BIOS Setup Utility

This is a special configuration menu in the BIOS. To open it, press Del and F2 during POST. The combination of the required keys is always shown during booting.
One of the important parameters here is Boot Priority, which determines the sequence of checking devices for boot information. As soon as a suitable device is found, control is transferred to the boot loader and the operating system starts booting.

Loader

In Legacy mode the boot loader is called Master Boot Record (MBR), it occupies the first 512 bytes of the disk, where you can read the primary boot code - from 0 to 445 bytes;
partition table - from 446 to 509 bytes; magic number 0xAA55 - from 510 to 511 bytes.

If the number 0xAA55 is missing, it means that the MBR record on this disk is not found and BIOS proceeds to check the next disk.

When the BIOS finds an MBR record, it is copied to RAM at address 0x7C00, and then the BIOS makes a jump to that address. The second stage code then begins loading the second stage code into memory and control is passed to it. This piece of data takes up 31 KB of memory; on modern systems it can be expanded to 1 MB.

The file system drivers are loaded; the third stage is looked for; the code is loaded into RAM and control is passed to it.

The tasks of the third stage are to minimally customize the environment and the bootloader:
putting the processor into Protected Mode; loading the installed GRUB2 extensions; finding the fourth stage and handing over control to it.

Protected Mode is a compatibility mode designed to work with x86 processors. The processor can execute 32-bit instructions and the address space is expanded to 4 GB. Important innovations are introduced in Protected Mode: paged memory addressing; virtual memory; protection rings.

At the fourth stage the system already functions in 32-bit mode. If necessary, extensions for the GUI are loaded from disk, then the grub.cfg file is processed and the familiar operating system selection menu appears.

Operating system kernel

GRUB2 uses the Multiboot standard to load the kernel executable. The magic number 0x1BADB002 at the beginning of the kernel is checked and a checksum is checked to verify compatibility with the specification. The kernel is loaded into the OS and takes control.

Although the loader can use file systems and graphics drivers, the loaded kernel does not get all of these at once. It releases the full potential of the server and puts the processor into Long Mode.

Long Mode

The main mode of operation of 64-bit processors, which allows executing 64-bit instructions and using the corresponding general-purpose registers.

The kernel configures page-based memory addressing. Loads necessary drivers and initializes hardware. Configures schedulers to manage memory and running processes. Detects and starts the init process.

After all APs are initialized, the scheduler starts a special "idle" process. The server becomes available over the network, and the console screen displays a login prompt.

Problems with the server at power on - how to fix the situation?

  • Server does not start at all - check power supply, performance and integrity of components.
  • Blue Screen of Death (BSOD) appears - check hardware compatibility or perform OS diagnostics.
  • The server starts successfully, but some services do not work - examine the logs, perhaps the problem is in the configuration or misconfiguration.
  • Network communication with the server fails - check network settings, hardware and connection.

Summary

Starting a server with loading the operating system is a complex and intricate process with many subtle details. Going through it is a kind of evolution that your mentee must successfully complete.
04 Jul 2024, 19:21:45

VPS in Bulgaria

Browse Configurations

Windows Storage VPS

Browse Configurations

Dedicated Servers, NL

Browse Configurations