`/var` and `/usr` gets too big (12G and 14G, respectively) after only five month since starting to use Manjaro, does it look normal?

A deeper look into the sizes of these root subdirectories using du -sh /var/cache/* returns
15M var/cache/app-info
4.0K var/cache/cups
1.7M var/cache/fontconfig
4.0K var/cache/ldconfig
4.0K var/cache/man
7.6G var/cache/pacman
411M var/cache/pkgfile
4.0K var/cache/private
4.0K var/cache/samba
4.0K var/cache/snapd
So, pacman cache is really the one dominating most of the /var size.

Whereas doing du -sh /usr/* returns
934M usr/bin
333M usr/include
5.8G usr/lib
430M usr/lib32
0 usr/lib64
40K usr/local
0 usr/sbin
6.6G usr/share
4.0K usr/src

Based on the output of the second du command above, am I right to say that most of the size of /usr is dominated by user-installed programs?
I am surprised by the storage size the /var and /usr directories take up. For your info, my Manjaro installation is just 5 months old and I am not a software-greedy person, I install only what I need. As I recall during the course of this 5 months, I installed insync, megasync, avogadro, and their dependencies. I mentioned only these programs because they look like somewhat big program (they have GUI) but there may be other CLI-based software installed that I don’t know are big. I am just really skeptical that I have been that intense in installing program by Linux standard.

As for the pacman cache, will it do and be safe if I simply rm everything inside /var/cache/pacman?
These two directories are in a partition that is now only having less than 2G of free space thanks to them, I really need to do some cleaning. Do you mind sharing how big are these two subdirs of root in your computer and how long have you been using Manjaro?

If you don’t want to downgrade or reinstall packages without downloading them again, sure.

1 Like
paccache -rvk2

is probably my preferred - keeps 2 on cache. (1 current, 1 previous version)

1 Like

Sorry for late reply. I did that and keep the current and last version if installed packages, it freed only about 3 Gb. I look into my MacBook Pro, the applications takes up only less than 5 Gb. Now I am not sure where those extra sizes in my /var and /usr come from.

My Pacman cache is similar, it depends on your configuration. Look in Pamac Settings for GUI configuration, choose the number of version for each package to keep there, you can also click the Clean button regarding your newly selected setting.

For /usr/ it contains the system basically… at some point install minimal OS and go from there if you want the leanest install. Or uninstall everything you don’t need on your system.

Thanks, I didn’t know that the /usr belongs to system, I am always under the impression that linux OS is small in storage size.

A basic misconception is that /usr/ stands for user, it doesn’t, it stands for User System Resources if I’m not wrong.

To be fair, a system (/usr/) under 10GB is small, what do you expect in size? Install Manjaro MINIMAL ISO if you want the least packages installed (but then you need to install additional packages to suit your needs).

The Pacman cache is obviously a convenience folder, you don’t NEED it for the system to run, but it saves time when you need to reinstall a package, it helps to downgrade if needed with older kept packages, things like that, as said you can configure it to be empty.

1 Like

Even the full ISOs are markedly smaller in system install size than say windoze … but once you start installing things it can grow of course.
Example, this is an old and not particularly clean system and my /usr/share is 5.8G …

1 Like

I do remember I had to install a handful of dependencies of megasync. May be these are the things that takes up the space. Or may be not since I also install megasync in my MacBook and the applications part of the used space is just less than 4 Gb. I don’t know, may be I should look to buying a bigger SSD and do repartition.

Maybe … its all how you want to run your system or mitigate challenges.

You can also look a bit closer:

du -sh /usr/share/* | sort -h | tail -n20

I also notice that while you state cache is taking 12G … I only saw 7 (and we removed 2) …so same thing:

du -sh /var/cache/* | sort -h | tail -n20

(ps - du wont necessarilly parse everything without sudo - ‘permission denied’ … but its also usually ignorable)

1 Like

Yeah, I mentioned /var/cache because this is the subdir of /var that takes the most space. The second biggest is /var/log/journal which is about 2.9 Gb, I don’t know what this is.

Journal is … well the journal of logs.
If you dont need all of them … you can remove a lot with something like

sudo journalctl --vacuum-size=50M 

You can also cap this size by editing /etc/systemd/journald.conf

cache is also pretty expendable… you can use something like this to clean it up
(removes things not accessed in the last 60 days)

find ~/.cache/ -type f -atime +60 -delete 

(heh … oh yeah, thats user cache … I guess you could do something similar in /var/cache/ but maybe dont)

You can find these and other tips at the wikis:

1 Like

Thanks, that’s really helpful. But I still don’t get why journal is dispensable, is it because it contains just the output of some commands?

It contains every event in the system, according to its ‘log level’ (report warning? or errors? etc)
There is more at the wiki systemd/Journal - ArchWiki
But suffice to say that these lines of text do not take up very much space individually … a size of 50M will still allow you to read logs from multiple boots prior, assuming your journal isnt being spammed by constant error messages. And thats assuming you even need/want the logs at all.
Honestly if you dont know what it is … you likely do not need it to be very large.
(I do inspect logs from time-to-time and 50M is quite enough for a personal system)

1 Like

Oh. PS … this snippet will print/sort your 20 largest packages if that may be helpful as well:

pacman -Qi | egrep '^(Name|Installed)' | cut -f2 -d':' | paste - - | column -t | sort -nrk 2 | grep MiB | head -n20

And even more… you can enable a timer to run automatically and clean your pacman cache, and other things:

(note: for repo packages manjaro’s pamac shares its cache with the original pacman directory)

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.