| 用途 | 控制 journal 上限与保底空间 |
|---|---|
| 配置 | /etc/systemd/journald.conf |
| 生效 | restart systemd-journald |
配置示例
配置示例
sudo tee /etc/systemd/journald.conf.d/size.conf > /dev/null <<'EOF'
[Journal]
SystemMaxUse=2G
SystemKeepFree=5G
SystemMaxFileSize=100M
MaxRetentionSec=90day
EOF
sudo systemctl restart systemd-journald
journalctl --disk-usage校验
校验
man 5 journald.conf | grep -A3 SystemKeepFree
systemd-analyze cat-config systemd/journald.conf | tail -n 20 # 看合并后的有效配置SystemKeepFree 是「至少留给文件系统多少」;与 SystemMaxUse 同时命中时取更严的一侧。