Free up Disk Space – Clear Systemd Journal Logs in Ubuntu 20.04

Last updated: December 2, 2020 — 6 Comments

Going to free up Ubuntu system disk space? Try clearing the systemd journal logs, it may free up a few GB of space.

By using the Disk Usage Analyzer tool, I found that /var/log/journal takes more than 4 GB system space in my Ubuntu 20.04.

Systemd has its own logging system called the journal, and the log files are stored in /var/log/journal. As long as I don’t need the logs for any debugging, it’s safe to delete these files. And following steps will show you how.

1. First open terminal from system app launcher, and you may run command to check out the current disk usage of all journal files:

journalctl --disk-usage

2. If you decide to clear the logs, run command to rotate the journal files. All currently active journal files will be marked as archived, so that they are never written to in future.

sudo journalctl --rotate

3. Now clear the journal logs by choosing one of following commands:

  • Delete journal logs older than X days:
    sudo journalctl --vacuum-time=2days
  • Delete log files until the disk space taken falls below the specified size:
    sudo journalctl --vacuum-size=100M
  • Delete old logs and limit file number to X:
    sudo journalctl --vacuum-files=5

4. You can also edit the configuration file to limit the journal log disk usage (100 MB for example).

Run command in terminal to edit the file via Gedit text editor:

sudo -H gedit /etc/systemd/journald.conf

When the file opens, un-comment (remove # at the beginning) the line #SystemMaxUse= and change it to SystemMaxUse=100M.

Save the file and reload systemd daemon via command:

systemctl daemon-reload

That’s all, Enjoy!

Twitter

I'm a freelance blogger who started using Ubuntu in 2007 and wishes to share my experiences and some useful tips with Ubuntu beginners and lovers. Please notify me if you find any typo/grammar/language mistakes. English is not my native language. Contact me via [email protected]

6 responses to Free up Disk Space – Clear Systemd Journal Logs in Ubuntu 20.04

  1. Thanks Ji m! Very useful to clear extra space !!

  2. Thanks for sharing a very clear set of steps!

  3. Thanks for that dude. You’re awesome, it’s not true at all what they say about you.

  4. Thanks for sharing the know-how!

    Since this journald has little usage for an ordinary user,
    why not make it disable by default?

  5. I have been 2 days trying to release disk space. I appreciate your post.

  6. This helped me lots. Thanks may God bless you

Leave a Reply

Text formatting is available via select HTML.

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> 

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.