This is the first blog post of a series talking about systemd. This serie will shows some useful commands for common scenarios.
This post is about managing the disk space used by journald.
systemd-journald is the
systemd component who takes care of logging all system and unit’s messages. It typically stores its files in
/var/log/journal/<id>/ , where your <id> is something like
Go and check how much space it is used there:
Last time i checked on my Fedora notebook running with default configuration it was around 4GB: quite a lot of space for a notebook with a small SSD disk like mine.
So, I edited
/etc/systemd/journald.conf and added the following line:
which basically says that log in general shouldn’t use more than 500 MBytes. Allowed units are
If you prefer to limit your log by defining how many days (or weeks, or month) you wish to retain, you could use the variable MaxRetentionSec
Other valid units are
year, month, week, day, h or m.
Once you edited the configuration file, to apply your new settings issue a
systemctl restart systemd-journald
If you are fine with your default setup, and just need to free some space because you are in an emergency, you can use the commands:
which have immediate effects and won’t change your
For many more options, as always, take a look at the man page!