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:
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:
That’s all, Enjoy!
Thanks Ji m! Very useful to clear extra space !!
Thanks for sharing a very clear set of steps!
Thanks for that dude. You’re awesome, it’s not true at all what they say about you.
Thanks for sharing the know-how!
Since this journald has little usage for an ordinary user,
why not make it disable by default?
I have been 2 days trying to release disk space. I appreciate your post.
This helped me lots. Thanks may God bless you
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 for sharing.
Thanks a ton! very useful tips!
Very informational. Thank you.
Thanks a lot
I couldn’t send emails from Thunderbird because the disk was full.
You have helped me. Thanks.
Here is what I do to clean up journal files, saved in file to copy and paste.