My Var log folder is eating up all my space. Help Please

I'm not tech savy I tried running echo "" > /var/log/syslog and it said permission denied. I don't even understand what this folder is but I literally don't have even 1gb of harddrive space left

I have researched how to fix this but nothing is working.
If this issue is not resolved easily I am uninstalling Zorin.

It should not be complicated to clear cache, if that's what this is.

The most likely cause is that Flatpak packages are taking up that space, as they tend to grow rather quickly. However, the /var folder also contains information such as system logs, which also can grow very large when left unchecked, especially if there's some misbehaving process.

You tried to empty the syslog file... may I ask why? Without confirming it's the reason, may actually be counter productive as it may contain the reason itself why this is happening.

On the terminal, run:

sudo du -sh /var/* 

This will give you a quick summary of what is taking up the space.

Since I'm already thinking of Flatpak, to gain some time you can also run:

flatpak uninstall --unused

Maybe this post will help you with reducing size taken by logs: Using the Terminal Emulator in Linux Distros - #2 by zabadabadoo

sudo truncate -s 0 /var/log/syslog
rm -rfv ~/.cache/thumbnails
sudo du -sh /var/cache/apt

I have to insist that deleting log entries without knowing whether this is the culprit is a bad idea. Log files don't randomly explode in size for no reason; something must be writing to it. Deleting the main log file doesn't solve the underlying issue (whatever that may be) and can result in losing potentially crucial information about it.

Yes, in Zorin OS there's also journalctl that registers log activity... but not all applications may be using that log mechanism. For instance, journalctl --disk -usage reports 229.5M in my system, whereas du -sh /var/log reports 468M.

Is there a ... how can I say that ... normal Size of the var Folder?

Not really, the name /var is short for "variable" which means that in there there could be files that can vary from one installation to the next, or that are prone to change often, like log files. In my case, the entire /var folder weights at around 28G... mostly because of Docker and virtual machines.

1 Like

Then are my 4.5GB are totally okay I guess, hahaha!

i do not disagree with you there , deleting log entries.
but for me ( and maybe the average not tech savvy user also ) , i don't care about logs.
i mean have you seen logs ? lol there's 1000000 of lines , who's gonna scroll through that looking for a problem when they don't even know what to look for ?
so in my (stupid) opinion , just delete it , if it's taking up all your space.
btw, i have minimal ram available , and i never had to delete logs to clear space.
so makes me thinks OP has some other underlying issue ?

my .var files show 6.9 MB?
why ?
:grin:

my output for sudo du -sh /var/*
jp@jp14:~$ sudo du -sh /var/*
[sudo] password for jp:
5.2M /var/backups
366M /var/cache
4.0K /var/crash
3.0G /var/lib
4.0K /var/local
20K /var/lock
12M /var/log
4.0K /var/mail
4.0K /var/metrics
4.0K /var/opt
0 /var/run
96K /var/snap
132K /var/spool
60K /var/tmp
jp@jp14:~$

That is what I'm getting at: if log files are so large that you need to delete them, that is the proof that something is wrong. By deleting them, you are also deleting the evidence of what is going on.
Although, chances are that whatever is causing the issue will just continue to produce logs and eventually fill the drive again. Still, not a good idea because evidence of the root cause might be long gone.

For reference, log files are rotated periodically. Older entries are compressed in a separate file, so they don't take up too much space, and eventually get deleted.

But in any case, I'd still like to know how OP arrived at the conclusion that /var/log/syslog is the culprit here. Flatpak is far more likely given they tend to grow pretty quickly in size. But if it indeed is the logs, we should take a look at them first to see what is the problem.

Note that /home/jp/.var is not the same as /var at the root of the filesystem. But everything looks fine from what I see on your system.

In a recent installation of Zorin OS, /var/lib shows 6.2GB and /home/zenzen/.var is at 15M. It depends on how many applications you have, which ones, how often you use them, etc.

On my end /var is only 3.6GB

I recommend this tool ncdu to check disk usage of the directories.

  • Install: sudo apt install ncdu
  • run: sudo ncdu --color=dark /


(Use left & right arrow keys to go back & forth between the directories)

1 Like

cool , didn't know that
found my /var and it's size is 5.5GB
guess its fine i'll just leave it be

got lots of space ... :grin:

1 Like

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