Reclaim disk space

If you’ve had your phone for a while now and haven’t done a clean install or re-flashed the OS recently, there’s a good chance you can reclaim a significant amount of disk space by hoovering up the journal logs.

From the terminal you can see how much disk space the journal logs are currently occupying with…

sudo journalctl --disk-usage

Having just checked with a friends phone who re-flashed Amber approx 5 months ago, they had around 4GB worth of journal log files.

Before you can hoover them, you need to rotate the logs to archive them…

sudo journalctl --flush --rotate

If you need/want to have a clear out, you can clear them by time, file count or size.

To clear out by time, for example to keep the last 3 days of logs and clear everything else…

 sudo journalctl --vacuum-time=3d

To clear out by files count, for example to keep the last 5 log files and clear everything else…

sudo journalctl --vacuum-files=5

To clear out by size, for example to keep the last 200 MB of logs and clear out everything else…

sudo journalctl --vacuum-size=200M

You should be able to combine the rotate with the vacuum, for example to flush and hoover everything except the logs of the last week…

sudo journalctl --flush --rotate --vacuum-time=1w

For me, I only check the logs for reproducible problems, so I have disabled journal logging for day to day and only enable it when I need/want to check for info/detail of a problem.

13 Likes

Before it came with all O/S, reminds me of the days of DOS and Windows 3.1. I think it was Norton that offered a disc data optimizer (to speed up loading your programs!). Depending on how messy it was, it could run for a long time.

The graphics were fun to watch, as they used whole colored characters to represent disc sectors. You could hypotize yourself watching the letters rearrange themselves on the screen.

Hahaha I used to be mildly mesmerized by that as a kid.

Thanks for the tip. I actually hadn’t done that in the 8+ years that I’ve owned my System76 Ubuntu laptop so I just reclaimed 2G and will be keeping that in my notes. Thanks!

1 Like

I suggest making that permanent and automatic. Or at least that’s what I have done. /etc/systemd/journald.conf

2 Likes

Apologies for the necro, but to clarify, the modification to /etc/systemd/journald.conf to limit the maximum size of the journald logs is as follows.

As root, modify the file to uncomment

#SystemMaxUse=

and set a max threshhold in MB (M), GB (G), etc.

SystemMaxUse=512M

Save the file and restart the journald service.

$ sudo systemctl restart systemd-journald.service

Source

6 Likes

See also Tips & Tricks · Wiki · Librem5 / Librem 5 Community Wiki · GitLab

2 Likes

This is what a distribution (PureOS, Debian) should do - set the defaults that most users want and let the minority make changes. Not to mention that devs and maintainers should know better than most of their users to select good defaults.

1 Like

I agree. These are settings I feel would best benefit users to bake in as defaults. Losing 10% of internal storage to a journal log is excessive and, if my parents hypothetically picked up a Librem 5, I wouldn’t expect to have to inform them to modify a system file to avoid log bloat.

Yes I’m an old head too that remembers this feeding my ocd.

1 Like

I also have issues with disk space as I mentioned here (focused on the boot partition):

I just followed what @JCS wrote. My journalctl was taking up 2.3GB and I now limited to 512M, hence freeing up almost 2G.

1 Like