centos7 啟動流程
阿新 • • 發佈:2019-02-12
systemdPOST --> Boot Sequence --> Bootloader --> kernel + initramfs(initrd) --> rootfs --> /sbin/initinit: CentOS 5: SysV initCentOS 6: UpstartCentOS 7: SystemdSystemd:系統啟動和伺服器守護程序管理器,負責在系統啟動或執行時,啟用系統資源,伺服器程序和其它程序Systemd新特性:系統引導時實現服務並行啟動按需啟動守護程序 (儘可能的啟動必要的服務)自動化的服務依賴關係管理同時採用socket式與D-Bus匯流排式啟用服務系統狀態快照核心概念
- loaded:Unit配置檔案已處理
- active(running):一次或多次持續處理的執行
- active(exited):成功完成一次性的配置
- active(waiting):執行中,等待一個事件
- inactive:不執行
- enabled:開機啟動
- disabled:開機不啟動
- static:開機不啟動,但可被另一個啟用的服務啟用
- 關機:systemctl halt、systemctl poweroff
- 重啟:systemctl reboot
- 掛起:systemctl suspend
- 休眠:systemctl hibernate
- 休眠並掛起:systemctl hybrid-sleep
- UEFi或BIOS初始化,執行POST開機自檢
- 選擇啟動裝置
- 引導裝載程式, centos7是grub2
- 載入裝載程式的配置檔案:/etc/grub.d/ /etc/default/grub
- 載入initramfs驅動模組
- 載入核心選項
- 核心初始化,centos7使用systemd代替init
- 執行initrd.target所有單元,包括掛載/etc/fstab
- 從initramfs根檔案系統切換到磁碟根目錄
- systemd執行預設target配置,配置檔案/etc/systemd/system/default.target
- systemd執行sysinit.target初始化系統及basic.target準備作業系統
- systemd啟動multi-user.target下的本機與伺服器服務
- systemd執行multi-user.target下的/etc/rc.d/rc.local
- Systemd執行multi-user.target下的getty.target及登入服務
- systemd執行graphical需要的服務
- 設定核心引數,隻影響當次啟動
- 啟動時,在linux16行後新增systemd.unit=desired.target //修改執行模式
- systemd.unit=emergency.target
- systemd.unit=rescue.target
- rescue.target 比emergency 支援更多的功能,例如日誌等
- systemctl default 進入預設target