以下是利用Debian清理优化系统启动速度的方法:
systemctl list-unit-files --type=service --state=enabled 查看已启用的服务,通过 sudo systemctl disable <服务名> 禁用不需要的服务。sudo systemctl stop <服务名>。/etc/default/grub,设置 GRUB_TIMEOUT=2(或更小)减少启动菜单显示时间,运行 sudo update-grub 生效。systemd-analyze blame 找出耗时较长的服务,针对性禁用。systemd-analyze plot > ~/boot.svg,辅助分析。sudo apt-get clean。sudo apt-get autoremove。sudo find /var/log -type f -exec truncate -s 0 {} \;。/etc/sysctl.conf,添加如 net.ipv4.tcp_tw_reuse=1 等参数优化网络性能,运行 sudo sysctl -p 生效。/etc/fstab 中添加 noatime,nodiratime 挂载选项减少元数据操作。注意:操作前建议备份重要数据,避免误删关键服务或文件。