SDB:Cleanup system
If your root file system is running out of space, try these commands. You may get back 10 GB or more free space.
Cleanup journal logs
Journal logs can grow fast and use up several GB disk space. Unless you want to troubleshoot your system, these logs are not very useful.
You can safely clean up journal logs and keep only logs from yesterday:
sudo journalctl --vacuum-time=1d
Cleanup downloaded RPM packages
This command will delete all downloaded RPM packages.
sudo zypper clean
Cleanup old kernels
This command will delete the old kernels based on configuration at /etc/zypp/zypp.conf
sudo zypper purge-kernels
Cleanup Btrfs snapshots
Tell snapper to delete old snapshots based on configuration at /etc/snapper/configs/root
sudo snapper cleanup number
By default, snapper allows:
- Maximum 50% of root file system space for snapshots. (20 GB of 40 GB root file system)
- Minimum 2 and maximum 10 normal snapshots.
- Minimum 4 and maximum 10 important snapshots.
You can reduce it using the following command:
snapper set-config SPACE_LIMIT=0.2 NUMBER_LIMIT=2-6 NUMBER_LIMIT_IMPORTANT=4
Which means
- Maximum 20% of root file system space for snapshots. (8 GB of 40 GB root file system)
- Minimum 2 and maximum 6 normal snapshots.
- 4 important snapshots.
Cleanup /tmp
EDIT: As of August 2020 (Snapshot 20200806), fresh installations will use tmpfs for /tmp by default, meaning /tmp would be cleared at each shutdown. See openSUSE:Tmp_on_tmpfs
Usually, applications should delete temporary files when they quit or set an expiring date. However, not all applications do it correctly and many files will stay there forever.
Simple solution is:
sudo rm /tmp/* -rf
Operating system and applications will not be broken by removing these files. But you should keep in mind, some running applications may have unsaved data stored here. For example, screenshot, office documents, files in downloading progress. Deleting files may interrupt the application and you will lose unsaved data. That's why you must quit all applications before running this command.