How to free space on /var

Hi all,

How can I free space on /var partition? What are the directories that I can safely delete? Thank you very much.
 
skoinga said:
how can I free space on /var partition?
What are the directories that I can safely delete?
That depends on what you have installed.

Please post the output of # du -sk /var/* | sort -n
 
Hi, thankyou for your reply.

Here is the output:

Code:
2	/var/account
2	/var/audit
2	/var/empty
2	/var/games
2	/var/heimdal
2	/var/preserve
2	/var/rwho
2	/var/virusmails
4	/var/crash
4	/var/mail
4	/var/msgs
6	/var/at
14	/var/amavis
14	/var/cron
22	/var/yp
42	/var/backups
54	/var/named
74	/var/restoresymtable
88	/var/run
652	/var/spool
2784	/var/tmp
11872	/var/log
150540	/var/db
 
Alright, so most of the space is taken up by /var/db/. Just drill down until you find out what's using up your space.

# du -sk /var/db/* | sort -n

If you have installed MySQL it's quite likely the culprit. You can move the databases to a spot with more capacity. Just change the MySQL variables in /etc/rc.conf accordingly.
 
SirDice said:
Alright, so most of the space is taken up by /var/db/. Just drill down until you find out what's using up your space.

# du -sk /var/db/* | sort -n

If you have installed MySQL it's quite likely the culprit. You can move the databases to a spot with more capacity. Just change the MySQL variables in /etc/rc.conf accordingly.

Hi,

thankyou again. Here is the output of [cmd=]du -sk /var/db/* | sort -n[/cmd]

Code:
0       /var/db/mountdtab
2       /var/db/dhclient.leases
2       /var/db/freebsd-update
2       /var/db/ipf
2       /var/db/portsnap
6       /var/db/fontconfig
6       /var/db/postfix
18      /var/db/entropy
36      /var/db/mergemaster.mtree
118     /var/db/portaudit
346     /var/db/ports
894     /var/db/spamassassin
3168    /var/db/locate.database
14570   /var/db/postgrey
22668   /var/db/pkg
47736   /var/db/clamav
60964   /var/db/sup

Can I safely delete stuff from sup and pkg? Thankyou.
 
Do NOT delete stuff in /var/db/pkg/. If you do the pkg_tools won't know what's installed anymore.
 
I suppose you can just move sup somewhere else like /usr/local and change your supfile accordingly
Code:
*default base=/usr/local

If sup is not what I suspect (maintenence directory for csup) you can always resort to the oldest trick in the book: Move the directory somewhere and leave a symbolic link.
 
I don't use clamav but I'm assuming it has a similar option to have it save it's database somewhere else. That'll also free up some space.
 
The same problem:


du -sk /var/* | sort -n


4 /var/account
4 /var/authpf
4 /var/empty
4 /var/games
4 /var/heimdal
4 /var/preserve
4 /var/rwho
8 /var/crash
8 /var/cron
8 /var/msgs
8 /var/tmp
12 /var/at
12 /var/audit
28 /var/unbound
28 /var/yp
72 /var/lib
76 /var/spool
128 /var/run
1828 /var/mail
2932 /var/log
32480 /var/backups
1479148 /var/cache
2455520 /var/db


du -sk /var/db/* | sort -n


4 /var/db/dhclient.leases.re0
4 /var/db/dhclient.leases.wlan0
4 /var/db/entropy
4 /var/db/hyperv
4 /var/db/ipf
4 /var/db/mixer0-state
4 /var/db/mixer1-state
4 /var/db/ntp
4 /var/db/zoneinfo
8 /var/db/colord
8 /var/db/sudo
8 /var/db/zfsd
12 /var/db/AccountsService
12 /var/db/ntpd.leap-seconds.list
32 /var/db/mergemaster.mtree
92 /var/db/samba4
140 /var/db/ports
2112 /var/db/services.db
2440 /var/db/fontconfig
3196 /var/db/etcupdate
6176 /var/db/locate.database
106088 /var/db/pkg
191792 /var/db/portsnap
2143364 /var/db/freebsd-update

Can I delete the entire contents of the /var/db/freebsd-update directory, or only the *.gz files?
 
doesn't "pkg clean -ay" delete downloaded packages? I think those wind up under /var/db?

A minor "aside" are you using ZFS or UFS?
 
And /var/db/freebsd-update contains all the files, patches and whatnot freebsd-update(8) downloads and uses to update the system. If you're not currently in the process of updating you can delete everything that's in there.
 
Back
Top