Skip to content

Make systemd-journald logs persistent across reboots (and cap the disk)

Enable persistent systemd-journald storage so logs survive reboots, then bound disk usage with SystemMaxUse and retention limits — with real commands and expected output on systemd 255+.

If a reboot wipes your logs, systemd-journald is running with Storage=auto and no /var/log/journal directory — so it keeps everything in volatile /run/log/journal, which is tmpfs and disappears on restart. The fix is small: create /var/log/journal (or set Storage=persistent), flush the journal, and then set a size cap so the journal never quietly fills the disk. This article walks through both halves on modern systemd (255+): making logs persistent, and bounding their growth.

What you’ll accomplish

  • Confirm whether journald is currently volatile or persistent, and why.
  • Switch to persistent storage so prior-boot logs survive reboots.
  • Cap disk usage with SystemMaxUse, SystemKeepFree, and per-file limits.
  • Set time-based retention so old entries expire on a schedule.
  • Verify persistence end to end and reclaim space from an oversized journal.

Prerequisites

  • A Linux host with systemd 255 or newer. Check with systemctl --version. The options here are stable back to systemd 240-ish, but a couple of defaults and the journalctl --list-boots output format changed over the years, so older releases may print slightly differently.
  • Root or sudo. Editing /etc/systemd/journald.conf and creating /var/log/journal both require it.
  • A rough idea of how much disk you want to hand to logs. journald’s built-in default cap is 10% of the filesystem holding /var/log/journal, up to 4 GB — reasonable on a big disk, sometimes too much on a small one.
  • Distribution note: Debian and Ubuntu ship Storage=auto with no /var/log/journal, so they are volatile out of the box. Most RHEL-family releases (RHEL, Rocky, Alma) ship the directory pre-created, so they are already persistent. This guide assumes you are on a host that is not yet persistent.

How it works

journald’s Storage= setting decides where log entries land. With Storage=auto (the shipped default), journald writes to /var/log/journal only if that directory already exists; otherwise it falls back to /run/log/journal, a tmpfs that lives in RAM and is thrown away on every reboot. That is why a default Debian or Ubuntu box shows you only the current boot — the previous boot’s logs were never written to disk.

Setting Storage=persistent (or simply creating /var/log/journal) tells journald to write to disk and keep logs across reboots. Once that is in place, a second group of settings caps how large the journal is allowed to grow, so persistence does not turn into a slow disk-fill. The diagram below shows the two paths and the size knobs that gate growth on the persistent side.

Data-flow diagram comparing volatile /run/log/journal, lost on reboot, with persistent /var/log/journal that survives reboots, plus the SystemMaxUse and retention caps that bound journal growth

The caps interact: SystemMaxUse sets the hard ceiling on total journal size, SystemKeepFree reserves free space on the filesystem regardless of the journal, and journald honours whichever is more restrictive. SystemMaxFileSize bounds each individual journal file, which controls how granular deletion is — journald rotates and deletes whole files, never partial ones, so smaller files mean it can trim closer to your target. The two time controls sit on top of the size controls: MaxRetentionSec deletes entries older than the given age (say 1month), and MaxFileSec forces a rotation to a new file after that much wall-clock time even if the current file is not full, so archives line up on time boundaries. Whichever limit — size or time — is hit first triggers rotation and eventual deletion.

None of these caps do anything until journald restarts and re-reads its configuration, and they only bound the persistent store; the volatile /run journal is governed by the parallel RuntimeMaxUse family instead. In practice you set the System* limits, make storage persistent, and leave the runtime side at its defaults.

Step-by-step

  1. Check where the journal lives right now. Ask journald for its disk usage and look for the directory it reports.

    journalctl --disk-usage

    On a volatile host you will see the runtime path:

    Archived and active journals take up 48.0M in the file system.
    ls -ld /var/log/journal /run/log/journal 2>&1

    If /var/log/journal does not exist and only /run/log/journal does, you are volatile — that is the situation this guide fixes.

  2. Choose your method. Either creating the directory or setting Storage=persistent works. Setting the option is the more explicit and self-documenting choice, so do both: create the directory and set the option. Edit the config first.

    sudo mkdir -p /etc/systemd/journald.conf.d
    sudo tee /etc/systemd/journald.conf.d/persistent.conf >/dev/null <<'EOF'
    [Journal]
    Storage=persistent
    SystemMaxUse=2G
    SystemKeepFree=1G
    SystemMaxFileSize=200M
    MaxRetentionSec=1month
    EOF

    Using a drop-in under journald.conf.d/ instead of editing /etc/systemd/journald.conf directly keeps your changes separate from the vendor file, so package upgrades never clobber them. The values above are a starting point for a small-to-medium server: a 2 GB ceiling, always leave 1 GB of disk free, cap each file at 200 MB, and expire anything older than a month. Adjust SystemMaxUse to fit the disk you are willing to spend on logs — on a busy host you may want more, on a 20 GB VM considerably less.

  3. Create the persistent directory with the ownership and mode journald expects. On systems with systemd-journal-remote or an adm/systemd-journal group, systemd-tmpfiles sets this correctly for you.

    sudo mkdir -p /var/log/journal
    sudo systemd-tmpfiles --create --prefix /var/log/journal

    No output means success. This applies the mode 2755 and group systemd-journal that journald relies on.

  4. Apply the change by restarting journald, then flush any runtime logs into the new persistent store.

    sudo systemctl restart systemd-journald
    sudo journalctl --flush

    journalctl --flush moves entries from /run/log/journal into /var/log/journal and blocks until the move completes. It prints nothing on success.

  5. Confirm the storage moved to disk. Re-run the disk-usage check and confirm files now exist under /var.

    journalctl --disk-usage
    ls /var/log/journal/*/

    You should now see the persistent path populated:

    Archived and active journals take up 48.0M in the file system.
    /var/log/journal/3b9f.../system.journal
    /var/log/journal/3b9f.../user-1000.journal
  6. Prove that the caps are understood by asking journald to parse the config without applying it. A syntax error here is caught before it bites you at the next boot.

    sudo journalctl --header 2>&1 | head -n 5
    systemd-analyze cat-config systemd/journald.conf | grep -E 'Storage|SystemMax|KeepFree|Retention'

    The cat-config output merges the vendor file and your drop-in, so you see the effective values:

    Storage=persistent
    SystemMaxUse=2G
    SystemKeepFree=1G
    SystemMaxFileSize=200M
    MaxRetentionSec=1month

Validate it works

The real test is a reboot: persistent logs mean the previous boot is still readable afterward. List the boots journald has on disk.

journalctl --list-boots

Before your first reboot you will see only one line (boot index 0). After you reboot the host once, the same command lists at least two:

IDX BOOT ID                          FIRST ENTRY                 LAST ENTRY
 -1 a1b2c3d4e5f6...  Fri 2026-07-24 09:14:02 UTC Fri 2026-07-24 18:52:41 UTC
  0 f6e5d4c3b2a1...  Fri 2026-07-24 18:53:10 UTC Fri 2026-07-24 18:59:03 UTC

Read the previous boot directly to confirm the entries survived the restart:

journalctl -b -1 -n 20 --no-pager

If that prints log lines from before the reboot, persistence is working. Finally, verify the on-disk journal files are not corrupt:

journalctl --verify

A healthy journal reports PASS for each file. Warnings about No sealing key are expected and harmless unless you have enabled Forward Secure Sealing — that is a separate feature covered in protecting journald.

Troubleshooting

  • journalctl --list-boots still shows only one boot after a reboot. The storage did not actually become persistent. Re-check ls -ld /var/log/journal — if it is missing, the mkdir step did not run as root, or a read-only /var prevented creation. Confirm the drop-in is being read with systemd-analyze cat-config systemd/journald.conf.
  • The journal is already eating the disk. Persistence without a cap can grow to the 4 GB / 10% default. Reclaim immediately with a vacuum, then confirm your SystemMaxUse is applied. See the vacuum commands under When this is the wrong approach below, and cross-check with no space left on device.
  • Permission denied writing to /var/log/journal. The directory has the wrong group or mode. Rerun sudo systemd-tmpfiles --create --prefix /var/log/journal, then sudo systemctl restart systemd-journald. The correct state is drwxr-sr-x, group systemd-journal.
  • SystemMaxUse seems ignored. journald applies the more restrictive of SystemMaxUse and SystemKeepFree. If free disk is tight, SystemKeepFree wins and your journal is smaller than SystemMaxUse suggests. Both being active at once is correct behaviour, not a bug.
  • Config change had no effect. journald only re-reads its config on restart, not on systemctl reload. Always run sudo systemctl restart systemd-journald after editing, then journalctl --flush.

When this is the wrong approach

If the journal has already grown too large, you do not need to reconfigure anything to reclaim space right now — vacuum it. Trim by total size or by age:

sudo journalctl --vacuum-size=500M
sudo journalctl --vacuum-time=2weeks

Each prints the files it deletes and the space freed, ending with a Vacuuming done line. Vacuuming is a one-time cleanup; the SystemMaxUse and MaxRetentionSec settings above are what keep the journal bounded going forward, so set both rather than vacuuming on a cron.

Persistence is also the wrong default if you already forward every entry to a central log store (Loki, Elasticsearch, a systemd-journal-remote collector) and treat the local host as disposable. In that model the authoritative copy is off-box, local disk is scarce, and Storage=volatile with aggressive forwarding is a defensible choice — the log survives on someone else’s disk even if the host is reimaged. For anything you might have to reconstruct after a crash or a security incident, though, persistent local logs plus a cap is the sane baseline.

For the full list of settings and their exact semantics, see the official journald.conf manual and the journalctl manual.

If this is the kind of work you’d rather never own again, it’s the daily job of Managed Cloud Ops — book an infrastructure review.