Web Hosting Talk







View Full Version : What to do with a totally fiiled up /var


Tazzman
03-15-2002, 04:55 PM
Well, here's the Ensim report:

Partition:/dev/hda6 Mountpoint:/var Total:988M Used:939M Free:0

I dunno how this happened, considering the /var was at 66% yesterday. I did read something about this before on this board, but I can't find it using search. Just want to know what to delete and what to keep in the /var directory.

Here's the content of /var:

[root@core /root]# cd /var
[root@core /var]# dir
analog-5.0 db local lost+found nis run tux yp
arpwatch ftp lock mail opt spool usage zope
cache lib log named preserve tmp www
[root@core /var]#

Any solutions are welcome. The one I read before was deleting certain log files stored on this partition and then adding these to a cronjob to prevent them from filling up the partition in future, but I'm not sure.

Thanks, and sorry for beeing a pain in the *ss dedi-newbie yet again :)

kwimberl
03-15-2002, 04:59 PM
cd /var
du -h

That will give you a breakdown of where your space is going.

zupanm
03-15-2002, 06:05 PM
one quick fix is find a dir taking up the most space and find a partition that can handle it and move everything to that partition and then create a sym link.

like move /var/bla to /usr/bla

then create a symlink /var/bla to point to /usr/bla

serve-you
03-15-2002, 06:12 PM
Chances are it's a log file that went wild. If I don't make a big fat / partition to handle everything, I always make a separate partition just for /var/logs. There is little else in /var that takes up much space except named if you have a REALLY populated name server.

-Dan.

Tazzman
03-15-2002, 06:27 PM
hmmm, ok, it's the /var/log/hhtpd that's hogging all the space. What you think? Delete it or make a symlink to my home directory. Don't particularly need the logs, and they are just wasted space.

Here's the content of that dir:

[root@core /root]# cd /var/log/httpd/
[root@core httpd]# dir
access_log access_log.2 error_log error_log.2 ssl_engine_log
access_log.1 access_log-ssl error_log.1 error_log-ssl
[root@core httpd]# du -h
868M .
[root@core httpd]#

serve-you
03-15-2002, 06:32 PM
Do you use log rotation? If not, now's the time to start. Apache logs can become HUGE in a matter of days.

-Dan

Tazzman
03-15-2002, 06:54 PM
No, I don't use log rotation, but I was going to look into it and set it up later :)

But first I'm gonna get rid of the hose mamma's on there now.

Actually, after looking a bit closer, it was one single log that was taking all the space, the error log, probably because of all the problems I had installing Ensim. I'll still look into log rotation though ;)

Jedito
03-15-2002, 11:22 PM
rm -f /var/logs/*.1
rm -f /var/logs/*.2
rm -f /var/logs/*.3
rm -f /var/logs/*.4
rm -f /var/spool/exim/input/*
rm -f /var/spool/exim/msglog/*

Hope this help :)

neonlexx
03-12-2003, 05:50 PM
Can that be put into a script and run as a cron-job every 2 weeks safely?

Jedito
03-12-2003, 05:54 PM
You can safely run daily if you want

rm -f /var/logs/*.1
rm -f /var/logs/*.2
rm -f /var/logs/*.3
rm -f /var/logs/*.4

However, I'll more cautious to do it with
rm -f /var/spool/exim/input/*
rm -f /var/spool/exim/msglog/*
There is where the email in spool are storaged, sometimes you'll that are emails from 30 days, but some others are very recently.

If you use WHM/Cpanel, I'll suggest to delete them from there (Mail queu).

Regards

admin0
03-12-2003, 06:54 PM
Hi,

login as root:


cd /var/

du -sm * // this will show you which is using how much
cd <directory> // the directory reported the biggest
ls -lS // this will show the largest files on the top

now, based on what file it is, you can delete the file as:
rm -f filename
rm -f secondfilename

or clear the content of the file as

cp /dev/null filename
y ENTER

cp /dev/null filename
y ENTER

and so on..


maybe some user tried to send a 100+mb email as attachment ?

cd /var/spool/exim/input
ls -lS * | more
-- this will show the biggest email on the top

rm -f <filename>
rm -f <second filename>

Hope this helps.



:homer: