notes on infra

2025-12-05 ยท linux

Stopping journald from eating your root partition

Found a small VPS at 79% disk usage with 957 MB of journal logs. journalctl --disk-usage tells you the truth.

One-shot cleanup:

journalctl --vacuum-time=7d

Permanent fix โ€” drop-in is cleaner than editing main config:

mkdir -p /etc/systemd/journald.conf.d
cat > /etc/systemd/journald.conf.d/00-size.conf <<EOF
[Journal]
SystemMaxUse=200M
SystemKeepFree=500M
MaxRetentionSec=30day
EOF
systemctl restart systemd-journald

SystemMaxUse caps total disk usage of all journals. SystemKeepFree is a safety margin โ€” journald will trim more aggressively if free space drops below this. MaxRetentionSec is the upper bound on log age.

Defaults are way too generous for small VPS instances.