Linux booting process – Explained

Have you ever wondered about the processes behind a system boot up?

Yeah, as a SysAdmin, it’s very important to know about the steps and the processes in every steps while a machine boots up. If you are a good SysAdmin, you must have a better knowledge in Booting Process.

In this article, I am going to explain the booting process in detail. I can assure you that, you will get a clear idea about the Linux booting process after reading this post. I would like to divide the Linux booting in the following 5 steps:

From power up/reset to login prompt, we can mainly divide the Linux booting process in to five areas. The BIOS, Stage I boot loader, Stage II boot loader, Kernel and Init. These are the important areas behind a booting process.

Let us start with BIOS.

Step 1. BIOS (Basic Input Output System)

It is a pre-installed firmware on a system/server’s Mother board. BIOS controls the computer hardware. BIOS is used to perform hardware initialization during the booting process. The main job assigned to BIOS is POST (Power On Self Test). It’s a hardware self test. POST tests are simple read/write tests of a few location.

The POST tests are not much useful as a Hardware diagnostic test. It just test the system hardware components, and loads a boot loader.

The main two errors occur during POST are:

  1. Fatal error. This occurs due to hardware problems.
  2. Non fatal error. Due to software problems.

Main responsibilities of BIOS during POST are listed below:

  1. Verify CPU registers.
  2. Verify the integrity of the BIOS code itself.
  3. Verify some basic components like DMA, timer, interrupt controller.
  4. Find, size, and verify system main memory.
  5. Initialize BIOS
  6. Identify, organize, and select which devices are available for booting.

The beep sound after the POST indicate its result. A short beep while restart/start means normal POST – system is OK. Two short beeps means POST error – error code shown on screen and so on. Check POST manual for more details.

BIOS act as an intermediary between computer CPU and Input/Output devices. This eliminates the need for the operating system and software on the system/server are always aware about the details of hardware and other I/O devices. If any harddisks or I/O devices changed, only the BIOS needs to be updated.

BIOS is stored in EEPROM (Electrically Erasable Programmable ROM) / Flash memory. BIOS can not stored on a  hard disk or other devices, because it manages those devices.

BIOS is written in assembly language.

Remember, POST, that is the main thing happen at BIOS stage of booting. Next we can move to 1st boot loader stage, MBR stage.

Step 2. Stage 1 boot loader (MBR)

Master Boot Record, is the first place where boot loaders begins to start. MBR is a 512 byte sector located in the first sector of hard disk. MBR contains both program code and partition table details. Please see the image added below:

When allocating disk space for a partition, the first sector or data unit for each partition is always reserved for programmable code used in booting process. The very first sector of the hard disk is reserved for same purpose and it’s called the Master Boot Record. In case of a mechanical spinning disk, sector 1 of cylinder 0, head 0.

First 446 byte are the primary boot loader which contains both executable code and error message text.

Next 64 bytes contains the partition table. This section contains records for each of four partitions. In the above image P1 represents Partition 1, P2 for Partition 2 and so on.

4 x 16 bytes = 64 bytes

The last two bytes known as magic number (0xAA55). This number is used for the validation check of MBR.

When booting from a hard disk, the BIOS starts by loading and executing boot loader code. The MBR size is not enough sometimes to execute the complete boot loader code. Because, its size is larger than the available space in MBR. So booting has to be done in different stages. These stages are different in different boot loader on your system. Yeah, it’s time to move over to Stage 2 boot loader.

Step 3. Stage 2 boot loader.

Post navigation

Arunlal Ashok

Linux Systems Architect at Endurance International Group. I know her (Linux) since many years. Linux lover. Like to play on Linux console. I started this blog to share and discuss Linux thoughts.

Always happy for an open discussion! Write to arun (@) crybit (dot) com. Check about me for more details. About this blog and our strong members, check The team

3 thoughts on “Linux booting process – Explained

  1. As a [beginner-self-learned] sysadmin; thank you very much for this article! Much appreciated, it clears up quite a few questions!

Leave a Reply

Your email address will not be published. Required fields are marked *