CentOS / RHEL 7 : Booting process

关注微信公众号:
huyouxiao.com
回复语言名称,比如java,python,go,C, C++.有海量资源免费赠送!
https://www.thegeekdiary.com/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_TIMEOUT=5
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT=“console”
GRUB_CMDLINE_LINUX=“rd.lvm.lv=rhel/swap crashkernel=auto rd.lvm.lv=rhel/root rhgb quiet net.ifnames=0”
GRUB_DISABLE_RECOVERY=“true”

– 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.

initramfs
– 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
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值