Ask Your Question
0

How can I clean /var?

asked 2018-03-07 07:51:48 -0500

harmnot09 gravatar image

My /var was almost full and I use Bleachbit to clean up , Before run Bleachbit it was 77% and after running Bleachbit to clean up , it still 66%

Anyone could help me ?

edit retag flag offensive close merge delete

Comments

1

What about your log files? Did bleachbit touch those? Run journalctl --disk-usage to learn more. (They are located in /var/log/journal and usually occupy a lot of space).

florian gravatar imageflorian ( 2018-03-07 09:53:02 -0500 )edit

journalctl --disk-usage Archived and active journals take up 168.8M in the file system.

harmnot09 gravatar imageharmnot09 ( 2018-03-07 18:15:53 -0500 )edit

If you think you don't need the log files anymore and if the 170M is significant in your case: sudo rm -rf /var/log/journal/*

florian gravatar imageflorian ( 2018-03-11 20:49:34 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted
2

answered 2018-03-08 02:15:21 -0500

tonioc gravatar image

A short command to list 20 directories in /var which are using more space :

$ sudo du -ah /var/* 2>/dev/null | sort -rh | head -n 20
edit flag offensive delete link more

Comments

469M   /var/cache
432M    /var/lib
199M    /var/lib/clamav
196M    /var/log
181M    /var/cache/PackageKit/27
181M    /var/cache/PackageKit
181M    /var/cache/dnf
177M    /var/log/journal/ace121a524ec4bcabcc145f9b69edbdc
177M    /var/log/journal
139M    /var/spool
138M    /var/spool/abrt
117M    /var/lib/rpm
115M    /var/spool/abrt/ccpp-2018-03-07-20:46:09.575431-2374
114M    /var/spool/abrt/ccpp-2018-03-07-20:46:09.575431-2374/coredump
113M    /var/lib/clamav/main.cvd
102M    /var/lib/rpm/Packages
97M /var/cache/PackageKit/27/hawkey
85M /var/cache/PackageKit/27/metadata
61M /var/cache/fedy/jre/jre-8u161-linux-x64.rpm
61M /var/cache/fe

harmnot09 gravatar imageharmnot09 ( 2018-03-08 02:56:14 -0500 )edit

Are you using clamav? If not, get rid of all the clamav stuff. Are you using PackageKit (Gnome Software)? If you are using dnf instead (what you should), delete /var/cache/PackageKit/* and mask (disable) the PackageKit service. You can also delete /var/spool/abrt/ccpp-2018-03-07-20:46:09.575431-2374 and the corresponding coredump. As well as /var/cache/fedy/jre/jre-8u161-linux-x64.rpm.

Also, consider increasing your /var to at least 5 GB. Is there a special reason why you have /var on a separate partition?

florian gravatar imageflorian ( 2018-03-09 10:50:10 -0500 )edit

Thanks for your advice , but i get confused now because i am not IT guy, what command i should run for those things ? Please help , i just want to make my root and swap have more space so i did seperate on /var , /tmp , hehe

harmnot09 gravatar imageharmnot09 ( 2018-03-10 08:43:49 -0500 )edit

Command: sudo rm -rf /var/cache/PackageKit/*

... and so on for the others. You may want to make yourself familiar with the sudo and rm command (among others). Also, as long as you don't need it and don't have a clear picture of large each partition should be, and don't separate /var and /tmp and maybe not even swap (use swap file on / instead) - that way you actually waste less space (20-30 gb / incl /var is sufficient in most cases). You want a large /home. Keep the rest together.

florian gravatar imageflorian ( 2018-03-10 17:59:59 -0500 )edit

If you think you don't need your past logs: sudo rm -rf /var/log/journal/*

florian gravatar imageflorian ( 2018-03-10 18:01:41 -0500 )edit
1

answered 2018-03-07 13:32:19 -0500

ssieb gravatar image

updated 2018-03-08 18:23:08 -0500

A common issue is a lot of stale files in /var/cache/PackageKit. Try running du -hd2 /var to find out where the space is being used.

Update: Is your /var a separate partition? You're only using 1.2GB in /var which is very little. Unless it is separate, which is unlikely, it's your root (/) partition that is full.

edit flag offensive delete link more

Comments

enter code here

4.0K    /var/account
16K /var/lost+found
144K    /var/log/sssd
4.0K    /var/log/cups
4.0K    /var/log/gdm
4.0K    /var/log/cluster
2.1M    /var/log/audit
4.0K    /var/log/blivet-gui
169M    /var/log/journal
4.0K    /var/log/glusterfs
4.0K    /var/log/chrony
8.0K    /var/log/samba
4.0K    /var/log/httpd
12K /var/log/fedy
4.0K    /var/log/speech-dispatcher
8.0K    /var/log/libvirt
4.8M    /var/log/anaconda
4.0K    /var/log/ppp
187M    /var/log
4.0K    /var/nis
4.0K    /var/www/html
4.0K    /var/www/cgi-bin
12K /var/www
4.0K    /var/adm
4.0K    /var/preserve
44M /var/cache/cups
4.0K    /var/cache/gdm
4.0K    /var/cache/foomatic
4.0K    /var/cache/abr

harmnot09 gravatar imageharmnot09 ( 2018-03-07 18:14:25 -0500 )edit

8.0K   /var/cache/libX11
4.0K    /var/cache/krb5rcache
152K    /var/cache/ibus
181M    /var/cache/dnf
3.9M    /var/cache/man
4.0K    /var/cache/realmd
8.0K    /var/cache/httpd
181M    /var/cache/PackageKit
61M /var/cache/fedy
100K    /var/cache/ldconfig
144K    /var/cache/libvirt
469M    /var/cache
8.0K    /var/db/sudo
12K /var/db
8.0K    /var/tmp/systemd-private-d3e42b24f2b949adaf9010b4e33dec70-fwupd.service-O5l6nV
88K /var/tmp/dnf-popcorn-pht8kc82
8.0K    /var/tmp/systemd-private-d3e42b24f2b949adaf9010b4e33dec70-colord.service-UphBtM
4.0K    /var/tmp/abrt
8.0K    /var/tmp/systemd-private-d3e42b24f2b949adaf9010b4e33dec70-rtkit-daemon

harmnot09 gravatar imageharmnot09 ( 2018-03-07 18:35:42 -0500 )edit

8.0K   /var/tmp/systemd-private-d3e42b24f2b949adaf9010b4e33dec70-chronyd.service-E6IOvC
8.0K    /var/tmp/systemd-private-d3e42b24f2b949adaf9010b4e33dec70-bluetooth.service-Y9chgX
136K    /var/tmp
4.0K    /var/opt
20K /var/lib/AccountsService
8.0K    /var/lib/geoclue
4.0K    /var/lib/hyperv
38M /var/lib/systemd
44K /var/lib/upower
28K /var/lib/iscsi
976K    /var/lib/gdm
4.0K    /var/lib/corosync
52K /var/lib/NetworkManager
48K /var/lib/flatpak
4.0K    /var/lib/dbus
4.0K    /var/lib/dav
4.0K    /var/lib/tpm
12K /var/lib/gssproxy
16K /var/lib/abrt
8.0K    /var/lib/ni
4.0K    /var/lib/fwupdate
4.0K    /var/lib/openvpn
8.0K    /var/lib/

harmnot09 gravatar imageharmnot09 ( 2018-03-07 18:37:15 -0500 )edit
4.0K   /var/yp
4.0K    /var/games
4.0K    /var/gopher
4.0K    /var/ftp
4.0K    /var/empty/sshd
8.0K    /var/empty
12K /var/spool/at
8.0K    /var/spool/cups
4.0K    /var/spool/lpd
138M    /var/spool/abrt
4.0K    /var/spool/mail
4.0K    /var/spool/cron
16K /var/spool/anacron
4.0K    /var/spool/abrt-upload
4.0K    /var/spool/plymouth
139M    /var/spool
4.0K    /var/crash
4.0K    /var/local
8.0K    /var/kerberos/krb5
12K /var/kerberos
1.2G    /var
harmnot09 gravatar imageharmnot09 ( 2018-03-07 18:37:36 -0500 )edit

My /var is seperate with /root , my /var is about 2GB and my /root 55GB

harmnot09 gravatar imageharmnot09 ( 2018-03-09 02:21:50 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2018-03-07 07:51:48 -0500

Seen: 1,658 times

Last updated: Mar 08 '18