Free up Disk Space – Clear Systemd Journal Logs in Ubuntu 24.04 | 22.04

Last updated: May 1, 2024

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

NOTE: This tutorial is tested and works in my case in Ubuntu 24.04, Ubuntu 22.04, and Ubuntu 20.04

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 (For 23.04+, replace gedit with gnome-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 comment to let me know if the tutorial is outdated! And, notify me if you find any typo/grammar/language mistakes. English is not my native language. Contact me via [email protected] Buy me a coffee: https://ko-fi.com/ubuntuhandbook1 |

14 responses to Free up Disk Space – Clear Systemd Journal Logs in Ubuntu 24.04 | 22.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

  7. Hi,
    Thanks for your tricks, what is happening if the journal is raising up to 100 MB despite of the “SystemMaxUse=” defined to “100M”. Is it removed?
    Thanks

  8. Juan J. Martinez January 11, 2022 at 11:12 am

    Thanks for sharing.

  9. Thanks!
    Cool tips!

  10. Thanks a ton! very useful tips!

  11. Very informational. Thank you.

  12. Thanks a lot

    I couldn’t send emails from Thunderbird because the disk was full.

    You have helped me. Thanks.

  13. Here is what I do to clean up journal files, saved in file to copy and paste.

    #Clean-up Journal files
    Journalctl --disk-usage
    sudo journalctl --rotate
    sudo journalctl --vacuum-size=10M --vacuum-size=1s
    sudo nano /etc/systems/journal.conf
    #SystemMaxUse=50M
    sudo systemctl restart systemd-journald.conf
  14. Excellent! Thanks