第 3 章 Optimizing systemd to shorten the boot time
As a system administrator, you can optimize performance of your system and shorten the boot time. You can review the services that systemd starts during boot and evaluate their necessity. Disabling certain services to start at boot can improve the boot time of your system.
3.1. Examining system boot performance 复制链接链接已复制到粘贴板!
To examine system boot performance, you can use the systemd-analyze command. By using certain options, you can tune systemd to shorten the boot time.
Prerequisites
Optional: Before you examine
systemdto tune the boot time, list all enabled services:$ systemctl list-unit-files --state=enabled
Procedure
Choose the information you want to analyze:
Analyze the information about the time that the last successful boot took:
$ systemd-analyzeAnalyze the unit initialization time of each
systemdunit:$ systemd-analyze blameThe output lists the units in descending order according to the time they took to initialize during the last successful boot.
Identify critical units that took the longest time to initialize at the last successful boot:
$ systemd-analyze critical-chainThe output highlights the units that critically slow down the boot with the red color.
图 3.1. The output of the systemd-analyze critical-chain command