# How to free space on /var



## skoinga (Jan 4, 2011)

Hi all,

How can I free space on /var partition? What are the directories that I can safely delete? Thank you very much.


----------



## SirDice (Jan 4, 2011)

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`


----------



## skoinga (Jan 4, 2011)

Hi, thankyou for your reply.

Here is the output:


```
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
```


----------



## SirDice (Jan 4, 2011)

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.


----------



## skoinga (Jan 4, 2011)

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]


```
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.


----------



## SirDice (Jan 4, 2011)

Do NOT delete stuff in /var/db/pkg/. If you do the pkg_tools won't know what's installed anymore.


----------



## jalla (Jan 4, 2011)

I suppose you can just move sup somewhere else like /usr/local and change your supfile accordingly

```
*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.


----------



## SirDice (Jan 4, 2011)

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.


----------

