LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat
User Name
Password
Red Hat This forum is for the discussion of Red Hat Linux.

Notices

Reply
 
LinkBack Search this Thread
Old 05-23-2008, 01:35 PM   #1
jmmo1981
LQ Newbie
 
Registered: Feb 2007
Posts: 11

Rep: Reputation: 0
Question How to clean up disk space on /var partition RED HAT


Hi,

i am having problems with /var partition, it is hitting 100% periodically. I have tried to clean it up deleting files from path /var/spool/clientmqueue but seems it is not helping properly. How can i clean up space on this partition without ruin the whole system.

Also i am not able to increase this partition.

I will appreciate your replies.

THANKS A LOT!

Jorge
 
Old 05-23-2008, 03:01 PM   #2
jschiwal
Moderator
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,263

Rep: Reputation: 562Reputation: 562Reputation: 562Reputation: 562Reputation: 562Reputation: 562
You could delete the log backups an modify your logrotate.conf (and /etc/logrotate.d/* configs) so that not as many old logs are kept, the size of logs are reduces, or they are rotated more frequently.
 
Old 05-23-2008, 03:12 PM   #3
brianmcgee
Member
 
Registered: Jun 2007
Location: Munich, Germany
Distribution: RHEL, CentOS, Fedora, SLES (...)
Posts: 398

Rep: Reputation: 36
Generally find huge files and decide the purpose of that file and if you need it at all.
 
Old 05-23-2008, 04:31 PM   #4
jmmo1981
LQ Newbie
 
Registered: Feb 2007
Posts: 11

Original Poster
Rep: Reputation: 0
Hi thanks for your fast comments, i have found a script that monitors this situation: http://linuxphile.org/node/27

Do you know how to run this script with a cron job?

thanks a lot

jorge
 
Old 05-23-2008, 07:47 PM   #5
unSpawn
Moderator
 
Registered: May 2001
Posts: 21,615
Blog Entries: 47

Rep: Reputation: 1413Reputation: 1413Reputation: 1413Reputation: 1413Reputation: 1413Reputation: 1413Reputation: 1413Reputation: 1413Reputation: 1413Reputation: 1413
Not so fast. Recurring problems with diskspace points should be investigated. It might be a structural error like not enough space allocated for /var, or might point to (service?) problems making some log fill up at a more than average(?) rate. I wouldn't use a script but an application like Monit. It's configurable, easy to add checks to, it can poll all sorts of items and will alert you by e-mail.
 
Old 05-23-2008, 08:36 PM   #6
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Debian, FreeBSD
Posts: 3,755
Blog Entries: 5

Rep: Reputation: Disabled
Right. First you diagnose the problem. Then, armed with a hypothesis, you attempt to fix the problem.

What do the following display? (Please post the output in code tags so we can read it.)

# df -h

# du -ks /var/* | sort -nr | head

FWIW, yet another possible culprit for a filled up /var (in RHEL5 anyway) is yum.
 
Old 05-24-2008, 10:11 AM   #7
jmmo1981
LQ Newbie
 
Registered: Feb 2007
Posts: 11

Original Poster
Rep: Reputation: 0
Hi Anomie,

This are the results of runnign the commands you gave me:

[Server]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda7 1.5G 279M 1.2G 20% /
/dev/sda3 152M 26M 119M 18% /boot
none 1004M 0 1004M 0% /dev/shm
/dev/sda5 6.2G 2.5G 3.4G 43% /usr
/dev/sda8 1012M 382M 579M 40% /var
/dev/sda2 57G 38G 17G 70% /home
[Server]# du -ks /var/* | sort -nr | head
268876 /var/log
82800 /var/lib
2652 /var/www
1720 /var/spool
1692 /var/cache
132 /var/run
40 /var/named
28 /var/yp
20 /var/crash
16 /var/lost+found

I have been trying to find an script like i told you so i could be able to get a notification email when the Use% of a partition reaches certain value. If you could provide me an script would be just perfect.

Thanks again!
 
Old 05-24-2008, 10:51 AM   #8
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Debian, FreeBSD
Posts: 3,755
Blog Entries: 5

Rep: Reputation: Disabled
Quote:
Originally Posted by jmmo1981
Code:
[Server]# df -h
Filesystem            Size  Used Avail Use% Mounted on
...
/dev/sda8            1012M  382M  579M  40% /var
...

[Server]# du -ks /var/* | sort -nr | head
268876  /var/log
82800   /var/lib
2652    /var/www
1720    /var/spool
1692    /var/cache
132     /var/run
40      /var/named
28      /var/yp
20      /var/crash
16      /var/lost+found
That's a start. Right now /var/log takes up the majority of the space at 262MB. But at the moment you still have plenty of free space. We need to see the results of the same commands when you're getting nearer to your threshold.

Quote:
Originally Posted by jmmo1981
I have been trying to find an script like i told you so i could be able to get a notification email when the Use% of a partition reaches certain value. If you could provide me an script would be just perfect.
Here's a blunt tool for you to accomplish the job.

your-script.sh:
Code:
#!/bin/sh

# author: your friends at LQ
# date:   2008-05-24

PATH=/bin:/usr/bin

PCTUSE=$(df | grep '/var' | awk '{ print $5 }' | tr -d '%')

UPPLIM=85

[ ${PCTUSE} -ge ${UPPLIM} ] && \
  echo "$(hostname): var filesystem usage exceeds ${UPPLIM} percent!" \
       "Check on it now!"

exit 0
Add this script as a cronjob. Check the user's mail (who you're running it as) or set up an alias so that it gets forwarded to your internet email address. Or instead of echoing output in the script, mail it to your internet email address. (For information on doing any of those, refer to the forum's search feature or google.)
 
Old 02-06-2009, 02:53 PM   #9
Jeff N
LQ Newbie
 
Registered: Feb 2009
Posts: 2

Rep: Reputation: 0
same problem

Anyone still around from this old string?

Since moving to a new server several months ago, this happens again and again where /var starts to fill up. Currently it's at 92%.

Here's some info requested earlier on this string to help diagnose probs:

root@sm4 [/etc/logrotate.d]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda5 7.8G 514M 6.9G 7% /
/dev/sda8 198G 71G 117G 38% /home
/dev/sda6 996M 35M 909M 4% /tmp
/dev/sda3 7.8G 4.6G 2.9G 62% /usr
/dev/sda2 9.7G 8.5G 752M 93% /var
/dev/sda1 122M 16M 100M 14% /boot
tmpfs 4.0G 0 4.0G 0% /dev/shm
root@sm4 [/etc/logrotate.d]#

and

root@sm4 [/etc/logrotate.d]# du -ks /var/* | sort -nr | head
7211812 /var/log
945504 /var/lib
198140 /var/netenberg
180852 /var/cpanel
113128 /var/cache
46136 /var/spool
9164 /var/named
1708 /var/tmp
1136 /var/www
460 /var/run
root@sm4 [/etc/logrotate.d]#

I"m seeing a big file at /var/log/mysqld.log 6273092

Any suggestions on how to set something up so that I'm not almost monthly having this problem? Thanks.
 
Old 02-06-2009, 03:41 PM   #10
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Debian, FreeBSD
Posts: 3,755
Blog Entries: 5

Rep: Reputation: Disabled
@Jeff_N: It would have been better to start a new thread (and reference this old one).

Anyway, /var/log is at 7GB, and mysqld.log is at ~6GB, so that's almost certainly the problem. I don't run MySQL, but surely there's a way to regularly rotate the log file. If not through logrotate, search MySQL's documentation and the 'net for pointers on doing so.
 
Old 02-06-2009, 11:11 PM   #11
Jeff N
LQ Newbie
 
Registered: Feb 2009
Posts: 2

Rep: Reputation: 0
Thanks, anomie. Yes, I blew it away and /var went from 93% to 27% full...

I'll find a way to rotate it. Thanks for the pointers.
 
Old 02-24-2009, 09:38 AM   #12
bernihard
LQ Newbie
 
Registered: Feb 2009
Location: Spain
Distribution: CentOS 5.2
Posts: 13

Rep: Reputation: 2
Logrotate can handle that log file.
Even you can add some pre and post scripts to start/stop mysqld or whatever you need.

Just create a file under /etc/logrotate.d/ with your apropiate configuration
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Red Hat 6.2 disk space error - "Freeing blocks not in datazone" richfink Linux - Software 2 08-26-2006 04:08 PM
Running out of disk space... clean up possible? donv2 Linux - Newbie 3 04-19-2005 02:48 AM
Disk space leak in Red Hat Linux 9? zeki709 Linux - General 3 11-21-2003 08:11 PM
REd hat linux 8.0 installation fail with error message "insufient disk space" drweirdow Linux - Newbie 1 07-16-2003 07:51 AM
Red Hat 7.1 Install error - insufficient disk space KIRKR Linux - Software 5 01-09-2002 04:56 PM


All times are GMT -5. The time now is 02:52 AM.

Main Menu
 
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration