[For beginners] Illustrated explanation of the mechanism from turning on the server to completing booting

Hello.
I'm Kita from Beyond, a player who has obtained super rare characters and is unrivaled in the Battle Cats.

Last time, I wrote a blog
post about hardware This time, I'd like to explain in an easy-to-understand way how a server works from when it's turned on until it's fully booted.

We often start and stop servers in the cloud without even thinking about it, but I think there are fewer people than you might think who understand the process that leads up to that point.
(I was one of them.)

This time, we will explain the startup order with illustrations so that even beginners can understand, so please read to the end

Overall view of Linux server startup

First of all, in conclusion, a Linux system boots up in the following order:

Firmware (BIOS/UEFI) → Boot loader → Kernel → Init process

However, this information alone is difficult to understand, so we will explain in more detail using diagrams

There are a total of eight steps from turning the power on to completing the startup process.
Roughly speaking, startup is completed in the following order:

  1. Boot to BIOS/UEFI
  2. Hardware detection is performed
  3. Boot device selection process runs
  4. GRUB starts
  5. The kernel starts
  6. initramfs starts
  7. systemd starts
  8. Startup completed

The overall flow is as shown above, and the entire system startup process is called booting.
The series of steps from starting up the BIOS/UEFI to the above is called the "boot sequence" or "boot-up process."
We will now explain each step in detail.

Explanation of each item

①BIOS/UEFI boot

First of all, when you press the power button to start your computer, the first thing that runs is the BIOS/UEFI.
The BIOS/UEFI is installed in the ROM on the motherboard, and its role is to initialize various devices installed in the computer before starting the OS and to start the OS properly.

The difference between BIOS and UEFI is that, as shown in the diagram, UEFI is an improved version of BIOS.
However, this does not mean that UEFI is the only option, and currently both systems coexist.

Although both are similar in terms of functionality, UEFI has improved upon the traditional BIOS in terms of its complexity and ease of use

②Hardware detection

Next, we will explain hardware detection

One of the BIOS processes is called
POST (Power-On Self-Test), which recognizes, checks, and initializes connected hardware so that it can be used.

③ Select boot device

Next, the boot device selection process runs.
This is also a part of the BIOS process, and after POST (hardware recognition) is performed, the boot device (storage containing the OS) is selected.

A boot device is a storage device (HDD/SSD) that contains the program you want to run first when you start up the server.
the storage device that contains the OS you want to start .

④ Boot loader startup

Next, the BIOS starts the boot loader stored on the boot device.
The boot loader is a program that recognizes and starts the OS (kernel) .

Many Linux systems use GRUB as a boot loader, and
there are two types of GRUB: the long-standing "GRUB Legacy" and "GRUB 2."
Note: Support for GRUB Legacy has already been discontinued.

Most modern operating systems use the newer version of GRUB 2

⑤Start the kernel

Now we are finally ready to start the kernel

The kernel is the core program of Linux, also known as Linux in the narrow sense.
It is primarily responsible for controlling the hardware connected to the server.

In summary, the BIOS/UEFI launches the boot loader (GRUB) contained in the boot device, and the boot loader launches the kernel

⑥Start initramfs

The kernel then starts the initramfs to access the data it needs to boot the system

The initramfs is placed in memory by the boot loader, then extracted by the kernel for temporary use, and the kernel is responsible for mounting the file system

It starts with the boot loader loading the kernel and RAM file system (initramfs) into memory, then the kernel unpacks the initramfs and registers it as a temporary rootfs → initializes it → mounts it

This will allow the necessary kernel modules to be loaded and devices to be initialized

After this process is complete, the original file system contained in the HDD or SSD will be remounted as the rootfs

This is a complicated topic, so to summarize, it's best to think of it as a mechanism that allows the kernel to access the data necessary to start the system

⑦Start systemd

After initramfs mounts the root filesystem, the kernel loads and starts "systemd"

systemd is the first process (PID=1) generated when the system starts up.
It stands for "system daemon," and a daemon resides in memory and has the role of controlling the entire system.

A daemon is a program that is started when the system boots and continues to run in the background while the system is running

⑧Startup complete

Finally, the boot is complete.
After systemd is called from the kernel, it will sequentially generate the "child processes" necessary for system operation, and the login screen will be displayed.

summary

Finally, let's review the process up to startup

  1. First, press the power button to start the BIOS/UEFI (firmware)
  2. BIOS initializes hardware through POST
  3. The BIOS selects the boot device from the recognized hardware
  4. The BIOS launches the boot loader stored on the boot device
  5. The boot loader loads and starts the kernel from the selected boot device
  6. The kernel starts the initramfs
  7. initramfs provides the kernel with the data it needs to start the system
  8. systemd takes over the process, creates the child processes necessary for system operation, initializes the system, and displays the login screen

That's how it went

lastly

So far, we have provided detailed explanations about BIOS/UEFI, boot devices, boot loaders, initramfs, systemd, and more, from the time the power is turned on until booting is complete

Since it is common for servers to start up, you may not have many opportunities to understand the startup process, but this knowledge will be useful when troubleshooting if the server does not start up properly, so I hope that this article will help you understand at least a little about the server startup process

was created with reference to the video of
Nezumiya's Infrastructure Engineer Dojo, a channel operated by our company This is a great channel where you can learn knowledge about infrastructure from scratch, so if you are interested, please subscribe to the channel and give it a high rating!

If you found this article helpful , please give it a like!
7
Loading...
7 votes, average: 1.00 / 17
2,161
X facebook Hatena Bookmark pocket

The person who wrote this article

About the author

Kita

Beyond picked me up from my part-time job.
Human Resources Department Education Division Infrastructure Engineer
I hate flying insects.