# /var has only 116MB free space



## mfaridi (Aug 18, 2010)

after I run this command 

```
portmaster -D -r libgcrypt
```
I see after long time compile my 
	
	



```
/var
```
partition full ,
 this is is my 
	
	



```
df -h
```
you can see

```
Filesystem      Size    Used   Avail Capacity  Mounted on
/dev/ad10s1a    484M    278M    167M    62%    /
devfs           1.0K    1.0K      0B   100%    /dev
/dev/ad10s1d    989M    550M    360M    60%    /tmp
/dev/ad10s1f    137G    105G     21G    83%    /usr
/dev/ad10s1e    1.9G    1.7G    116M    94%    /var
```
and you see I set 1.9GB for var partition.
So I run 

```
ncdu
```
and I see this 

```
233.4MiB [##########] /db                         
.  94.0MiB [####      ] /log
.  66.7MiB [##        ] /tmp
    7.4MiB [          ] /account
.   1.9MiB [          ] /spool
.   1.2MiB [          ] /qmail
```
 so many space is full by 
	
	



```
/db
```
 so I go to 
	
	



```
/db
```
 and I see this 

```
128.5MiB [##########] /pkg
   35.8MiB [##        ] /sup
   28.4MiB [##        ] /clamav
   26.9MiB [##        ] /tripwire
```
so many space use by 
	
	



```
/pkg
```
 and I go to 
	
	



```
/pkg
```
 and I see this

```
39.8MiB [##########]  pkgdb.db
    1.4MiB [          ] /teTeX-texmf-3.0_6
    1.3MiB [          ] /webmin-1.510_1
    1.2MiB [          ] /zope-3.3.1
    1.2MiB [          ] /plone3-3.1.7_2
    1.2MiB [          ] /netbeans-6.8
    1.1MiB [          ] /ruby-1.8.7.248_2,1
    1.0MiB [          ] /zope210-2.10.11
  904.0kiB [          ] /tikiwiki-3.1
  808.0kiB [          ] /icon-bluecurve-theme-7.0.0_3
  732.0kiB [          ] /boost-libs-1.43.0_1
  666.0kiB [          ] /qt4-doc-4.6.3
  666.0kiB [          ] /openoffice.org-3.2.1
  634.0kiB [          ] /foomatic-db-20090530_1
  620.0kiB [          ] /jdk-1.6.0.3p4_17
  618.0kiB [          ] /tex-texmflocal-1.9
  602.0kiB [          ] /gnome-icon-theme-2.30.3
  602.0kiB [          ] /gnome-themes-extras-2.22.0_8
  554.0kiB [          ] /joomla15-1.5.18
  474.0kiB [          ] /icons-tango-0.8.90_1
  456.0kiB [          ] /claws-mail-themes-20100514
  440.0kiB [          ] /python26-2.6.5_1
  430.0kiB [          ] /firefox-3.5.11,1
  420.0kiB [          ] /moinmoin-1.9.2_4
  410.0kiB [          ] /xfce4-wm-themes-4.6.0
  394.0kiB [          ] /perl-threaded-5.8.9_3
  384.0kiB [          ] /openssl-1.0.0_2
  382.0kiB [          ] /gnome-games-2.30.2_1
  378.0kiB [          ] /gnome-themes-2.30.2
  362.0kiB [          ] /diablo-jdk-1.6.0.07.02_9
  362.0kiB [          ] /gnome-applets-2.30.0_3
  346.0kiB [          ] /zope-2.7.9_3
  334.0kiB [          ] /libxul-1.9.2.8
  330.0kiB [          ] /gnome-user-docs-2.30.1
  316.0kiB [          ] /python24-2.4.5_6
  292.0kiB [          ] /libX11-1.3.3,1
  288.0kiB [          ] /docbook-xsl-1.75.2
  282.0kiB [          ] /p5-DateTime-Locale-0.45
  266.0kiB [          ] /evolution-2.30.3
  256.0kiB [          ] /squirrelmail-1.4.21
  250.0kiB [          ] /gimp-app-2.6.10,1
  248.0kiB [          ] /apache-ant-1.7.1
  220.0kiB [          ] /gnutls-2.8.6_2
  220.0kiB [          ] /qt-3.3.8_12
  220.0kiB [          ] /mailman-2.1.12
```
 so I see many space use by these packages and db.



so this is my questions 

why I have these packages and db files?
Can I delete all of them for have free spaces ?
which app make this db files ?


----------



## jem (Aug 18, 2010)

Your /var partition is almost 2GB and your pkgdb is only taking up a small part of that.  Something else is filling up your /var partition.  Try the following:

`# cd /var`
`# du -hs *`

Also, don't use the 
	
	



```
tag for everything, it makes your post too long and spaced out.  There's [cmd] and [file] too.
```


----------



## mfaridi (Aug 18, 2010)

jem said:
			
		

> Your /var partition is almost 2GB and your pkgdb is only taking up a small part of that.  Something else is filling up your /var partition.  Try the following:
> 
> `# cd /var`
> `# du -hs *`
> ...


----------



## jem (Aug 18, 2010)

/var has a total of 1.9GB of space, of which /var/db is only using 310MB.

Disk usage by all of the subdirectories in /var only adds up to about 460MB.  Something else is using up all the space, but it's not /var/db.

Have you deleted any large log files recently, and not restarted the program that created them?


----------



## mfaridi (Aug 18, 2010)

I only delete some big log file , they was old and was compressed files


----------



## mfaridi (Aug 18, 2010)

which files I can delete and does not make problem for systems ?


----------



## jem (Aug 18, 2010)

You need to discover what is using nearly 1.5GB of space in /var.  The fstat() command might help with this, but I'm not familiar with its use.


----------



## SirDice (Aug 18, 2010)

This will show you the biggest directory:
`# du -sk /var | sort -n`


----------



## mfaridi (Aug 18, 2010)

SirDice said:
			
		

> This will show you the biggest directory:
> `# du -sk /var | sort -n`



this output


```
467084	/var
```


----------



## SirDice (Aug 18, 2010)

Oh, oeps.. try `# du -sk /var/* | sort -n`


----------



## jb_fvwm2 (Aug 18, 2010)

You have unneeded stuff in /var/tmp and/or /var/spool ??


----------



## mfaridi (Aug 18, 2010)

SirDice said:
			
		

> Oh, oeps.. try `# du -sk /var/* | sort -n`



this is output

```
/var # du -sk /var/* | sort -n
2	/var/agentx
2	/var/audit
2	/var/empty
2	/var/games
2	/var/gdm
2	/var/heimdal
2	/var/mediatomb
2	/var/preserve
2	/var/rwho
4	/var/mail
4	/var/msgs
8	/var/at
8	/var/crash
10	/var/net-snmp
12	/var/munin
14	/var/cron
22	/var/backups
22	/var/yp
48	/var/named
58	/var/lib
114	/var/run
448	/var/cache
1438	/var/qmail
3564	/var/amavisd
7546	/var/account
17996	/var/log
46034	/var/spool
73576	/var/tmp
316272	/var/db
```


----------



## SirDice (Aug 18, 2010)

There isn't much else you can remove. Whatever you do do NOT remove anything in /var/db/. If you do the system won't know what packages are installed anymore. That specific directory is used by all the pkg_tools.


----------



## mfaridi (Aug 18, 2010)

SirDice said:
			
		

> There isn't much else you can remove. Whatever you do do NOT remove anything in /var/db/. If you do the system won't know what packages are installed anymore. That specific directory is used by all the pkg_tools.



Can I delete other thing in /var and do not delete /var/db ?


----------



## SirDice (Aug 18, 2010)

mfaridi said:
			
		

> Can I delete other thing in /var and do not delete /var/db ?



There's almost nothing in there so it'll be rather pointless.


----------



## jb_fvwm2 (Aug 18, 2010)

Okay.  see /var/db... you *may* have subdirectories there which have lots of files that can be deleted.  (Varies by machine so I cannot tell you which ones...)


----------



## jem (Aug 18, 2010)

This still doesn't explain why a 1.9GB filesystem is almost full even though it only contains 460MB of files.


----------



## fronclynne (Aug 18, 2010)

You probably have a deleted file in /var/ being written to, so the space hasn't been freed yet.  You can try sysutils/lsof to track down the file and restart the application that's writing to it.

Restarting is also usually effective in this case.


----------



## galaxsat (Dec 23, 2010)

A service is probably eating up space on /var. Try restarting each running service and determine which one triggers a drastic increase in space on /var. In my case, it is snmpd, but damned if I know why...that's why I'm poking around in here


----------



## francis (Dec 23, 2010)

I had a similar problem with the /var partition. Just like you, I set 2 GB. After a few weeks, I saw message that /var partition is full, and the [CMD=]$ dh -h[/CMD] command showed 108% of Capacity! So I removed the /var/tmp directory, but it did not help. I added to the /etc/rc.conf file, this option; 
	
	



```
cleanvar_enable="YES"
```
Till now I have no problem. [CMD=]$ df -h[/CMD]
	
	



```
Filesystem     Size    Used   Avail Capacity  Mounted on
/dev/ad4s1d    1.9G    157M    1.6G     9%    /var
```
 Maybe this will be helpful for You?
Remember, portmaster has some interesting functions, like e.g 
	
	



```
-d  always clean distfiles
-B  prevents creation of the backup package for the installed port
-i  interactive update mode -- ask whether to rebuild ports
-P|--packages
	 use packages, but build port if not available
```
 o portmaster(8)


----------



## SirDice (Dec 23, 2010)

Note that *cleanvar_enable* only does its thing if you boot the machine. For a workstation that's regularly shutdown and restarted this might be fine. For a server that's hardly (if ever) rebooted it might not have the desired effect.


----------



## francis (Dec 23, 2010)

Yes SirDice, You are right, but *mfaridi* does not wrote if it is a production server or whatever. Or I'm blind. 
True, on workstation which cannot be restarted it is not a good option.


----------



## SirDice (Dec 23, 2010)

francis said:
			
		

> You are right, but *mfaridi* does not wrote if it is a production server or whatever.


That's why I mentioned it


----------

