How to clean up disk space on /var partition RED HAT
Red HatThis forum is for the discussion of Red Hat Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
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.
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.
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.
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.
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.)
@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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.