Warning: The disk usage for one or more of your partitions is running low

blog

Verified User
Joined
Jan 28, 2011
Messages
131
Hi

This is an automated message notifying you that the following partition(s) have exceeded the 75% threshold:

75% - /tmp


I have this message how fix it? also how automatic empty tmp with cornjob or other solution?

Thank you.
 
Hello

Use tmpwatch

Code:
# rpm -qa | grep tmpwatch
tmpwatch-2.9.7-1.1.el5.5

Code:
# cat /etc/cron.daily/tmpwatch
/usr/sbin/tmpwatch -x /tmp/.X11-unix -x /tmp/.XIM-unix -x /tmp/.font-unix -x /tmp/.ICE-unix -x /tmp/.Test-unix 12 /tmp
for d in /var/{cache/man,catman}/{cat?,X11R6/cat?,local/cat?}; do
    if [ -d "" ]; then
        /usr/sbin/tmpwatch -f 12
    fi
done

to clean daily files older than 12 hours.
 
Mine is a bit different:

Code:
flags=-umc
/usr/sbin/tmpwatch "$flags" -x /tmp/.X11-unix -x /tmp/.XIM-unix \
        -x /tmp/.font-unix -x /tmp/.ICE-unix -x /tmp/.Test-unix \
        -X '/tmp/hsperfdata_*' 240 /tmp
/usr/sbin/tmpwatch "$flags" 720 /var/tmp
for d in /var/{cache/man,catman}/{cat?,X11R6/cat?,local/cat?}; do
    if [ -d "$d" ]; then
        /usr/sbin/tmpwatch "$flags" -f 720 "$d"
    fi
done

There is a valid reason to keep those file for 720 hour??

Regards
 
You're on your own to change time, depending on how much your /var and /tmp are, and how quick are they going out of free space.
 
Thats not a problem:

Code:
/dev/sda3             2,0G   39M  1,8G   3% /tmp

what i meant is have any senso to keep those file longer or not ^^
 
You should decide. I don't know anything about what scripts and cms you host there.
I've seen examples when /tmp directory with size of 2-4Gb could be filled extremely quick, with tmp files generated by imagemagick. Was it a badly written PHP script, which did not erase temporary files or not, I can't say for now.
 
Thanks but where i should use it? sorry i am beginner

I have centos 5.5 and tmpwatch is installed on my server
 
Edit this file /etc/cron.daily/tmpwatch

and check if contain something like this:

Code:
/usr/sbin/tmpwatch -x /tmp/.X11-unix -x /tmp/.XIM-unix -x /tmp/.font-unix -x /tmp/.ICE-unix -x /tmp/.Test-unix 12 /tmp
for d in /var/{cache/man,catman}/{cat?,X11R6/cat?,local/cat?}; do
    if [ -d "" ]; then
        /usr/sbin/tmpwatch -f 12
    fi
done
 
my file:

flags=-umc
/usr/sbin/tmpwatch "$flags" -x /tmp/.X11-unix -x /tmp/.XIM-unix \
-x /tmp/.font-unix -x /tmp/.ICE-unix -x /tmp/.Test-unix \
-X '/tmp/hsperfdata_*' 240 /tmp
/usr/sbin/tmpwatch "$flags" 720 /var/tmp
for d in /var/{cache/man,catman}/{cat?,X11R6/cat?,local/cat?}; do
if [ -d "$d" ]; then
/usr/sbin/tmpwatch "$flags" -f 720 "$d"
fi
done

I should change it to?

/usr/sbin/tmpwatch -x /tmp/.X11-unix -x /tmp/.XIM-unix -x /tmp/.font-unix -x /tmp/.ICE-unix -x /tmp/.Test-unix 12 /tmp
for d in /var/{cache/man,catman}/{cat?,X11R6/cat?,local/cat?}; do
if [ -d "" ]; then
/usr/sbin/tmpwatch -f 12
fi
done
 
Last edited:
my tmp isn't empty ?

h9PWG.gif
 
Do I look like a fortune-teller? Nobody knows, but you. If you hire me, I'll be able to answer your question. But if you want to get free help you should do most of work yourself, and do some investigation:

1. Is cron installed and running?
2. Was the task executed?
3. How old are files in your /tmp?
4. What result you get if you run /etc/cron.daily/tmpwatch manually?
 
1. Is cron installed and running? Yes
2. Was the task executed? how i should check it?
3. How old are files in your /tmp? 12-18 hours
4. What result you get if you run /etc/cron.daily/tmpwatch manually? clean my tmp it is now %11 used

I have added via directadmin cronjob

0 */2 * * * /usr/sbin/tmpwatch -maf 8 /tmp
 
Actually i think that root have to execute that command.

Put that line in /etc/crontab in this format:

Code:
0 */2 * * * root /usr/sbin/tmpwatch -maf 8 /tmp

Regards
 
Make sure you've got /etc/crontab with following content (or something similar):

Code:
# cat /etc/crontab
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/

# run-parts
1 * * * * root run-parts /etc/cron.hourly
42 0 * * * root run-parts /etc/cron.daily
49 0 * * 0 root run-parts /etc/cron.weekly
10 2 3 * * root run-parts /etc/cron.monthly

The last 4 lines are the most important.

how i should check it?

Read /var/log/cron
 
Back
Top