CentOS / RHEL 7 : Booting process

系统运维 waitig 588℃ 百度已收录 0评论

CentOS / RHEL 7 : Booting process

It is important to understand the linux boot process to troubleshoot boot problems. The post describes the high level steps in the boot process. Below flow chart describes basic boot stages and what happens during each boot stage.

Linux 7 booting process
1. BIOS (or firmware phase)

– The BIOS (Basic Input/Output System), performs the POST (power on self test) to detect, test and initialize system hardware components.
– Loads the MBR (Master boot record).

  1. Master boot record (MBR)

– Master Boot Record (MBR) is the first 512 bytes of the boot drive that is read into memory by the BIOS.
– The next 64 bytes contain the partition table for the disk. The last two bytes are the “Magic Number” which is used for error detection.

Master boot record (MBR)

– MBR discovers the bootable device and loads the GRUB2 boot loader into memory and transfers control over to it.
3. GRUB2 Bootloader

– The default bootloader program used on RHEL 7 is GRUB 2. GRUB stands for GRand Unified Bootloader. GRUB 2 replaces the older GRUB bootloader also called as legacy GRUB.
– The GRUB 2 configuration file is located at /boot/grub2/grub.cfg (Do not edit this file directly).
– GRUB 2 menu-configuration settings are taken from /etc/default/grub when generating grub.cfg.
– Sample /etc/default/grub file :

cat /etc/default/grub

GRUB_CMDLINE_LINUX=”rd.lvm.lv=rhel/swap crashkernel=auto rd.lvm.lv=rhel/root rhgb quiet net.ifnames=0”

– If changes are made to any of these parameters, you need to run grub2-mkconfig to re-generate the /boot/grub2/grub.cfg file.

grub2-mkconfig –o /boot/grub2/grub.cfg

– GRUB2 searches the compressed kernel image file also called as vmlinuz in the /boot directory.
– GRUB2 loads the vmlinuz kernel image file into memory and extracts the contents of the initramfs image file into a temporary, memory-based file system (tmpfs).
– The initial RAM disk (initrd) is an initial root file system that is mounted before the real root file system.

– The job of the initial RAM file system is to preload the block device modules, such as for IDE, SCSI, or RAID, so that the root file system, on which those modules normally reside, can then be accessed and mounted.
– The initramfs is bound to the kernel and the kernel mounts this initramfs as part of a two-stage boot process.
– The dracut utility creates initramfs whenever a new kernel is installed.
– Use the lsinitrd command to view the contents of the image created by dracut:

lsinitrd | less

  1. Kernel

– The kernel starts the systemd process with a process ID of 1 (PID 1).

root 1 0 0 02:10 ? 00:00:02 /usr/lib/systemd/systemd –switched-root –system –deserialize 23

  1. systemd

– systemd is the ancestor of all processes on a system.
– systemd reads the file linked by /etc/systemd/system/default.target (for example, /usr/lib/systemd/system/multi-user.target) to determine the default system target (equivalent to run level). The system target file defines the services that systemd starts.
systemd brings the system to the state defined by the system target, performing system initialization tasks such as:
1. Setting the host name
2. Initializing the network
3. Initializing SELinux based on its configuration
4. Printing a welcome banner
5. Initializing the system hardware based on kernel boot arguments
6. Mounting the file systems, including virtual file systems such as the /proc file system
7. Cleaning up directories in /var
8. Starting swapping
CentOS / RHEL 7 : Beginners guide to systemd
CentOS / RHEL 7 : Begginners guide to systemd targets (replacement of SysV init run levels)

Filed Under: CentOS/RHEL 7, Linux
Some more articles you might also be interested in …

CentOS / RHEL : How to find if a network port is open or not?
CentOS / RHEL : How to activate and mount 2 Volume groups with same names
CentOS / RHEL 5,6 : Change default kernel (boot with old kernel)
CentOS / RHEL 5 : How to rebuild Initial Ramdisk Image
RHEL 7 – RHCSA Notes : Configure a system to use time services
CentOS / RHEL 6 : How to setup yum repository using locally mounted DVD
CentOS / RHEL : How to configure NTP server and client
CentOS / RHEL : How to determine which SNMP version is being used
CentOS / RHEL 7 : How to enable telnet for a group of users
RedHat / CentOS : Managing software RAID with mdadm

本文固定链接:CentOS / RHEL 7 : Booting process
点赞 (0)分享 (0)