You could possibly have cleaned up ur disk space for future reference.
You could make a script with these commands and run every now and then to trim excess files.
sudo pacman -Scc # Clear pacman cache (this often gets very big, likely would've fixed ur /var/lib problem too)
sudo pacman -Rns $(pacman -Qtdq) # Uninstall dependencies that are no longer needed
sudo journalctl --flush --vacuum-files=5 # Clear old journals/logs
rm -rf ~/.cache/yay/* # Clear yay cache (this often gets very big)
There’s also a bunch more stuff under ~/.cache
that you could clean out without issues, such as browser cache.
/opt/
usually has packages which weren’t installed using standard linux filesystem structure. It’s usually just unofficial packages you’ll get from yay with some exceptions such as cuda.
Here, I just ran a script with these and some other commands, this was the result:
The bulk of the free space came from the commands I listed above.
Here’s my full script:
#!/bin/sh
#Get Filesystem Size
size=$(df -h / | grep G | cut -d 'G' -f3 | sed 's: ::g')
#Commands:
sudo pacman -Scc
sudo pacman -Rns $(pacman -Qtdq)
sudo journalctl --flush --vacuum-files=5
rm -rf $HOME/.cache/yay/*
rm -rf $HOME/.cache/mozilla/firefox/*
rm -rf $HOME/.cache/chromium/Default/*
rm -rf $HOME/.cache/nvidia/GLCache/*
rm -rf $HOME/.cache/winetricks/*
rm -rf $HOME/.cache/unity3dcache/*
gio trash --empty
#Results
sizea=$(df -h / | grep G | cut -d 'G' -f3 | sed 's: ::g')
echo "Free space before: $size GB
Free space after: $sizea GB"
If you don’t regularly do something like this, you’re liable to just run out of space again.