Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

Website and Server Administration Forum


You are currently viewing our Website and Server Administration Forum as a guest. Please register to participate.
Login



Closed Thread
How to resize a /tmp partition
Old 07-10-2008, 03:53 PM How to resize a /tmp partition
SPS
Novice Talker

Posts: 6
Trades: 0
I know this is a lot to ask but I am in need of some fast help. If anyone has a step by step guide?

I need to re-size my tmp partition because it is kind of small and it is filling up.

From all of the searching I have done I have also come to believe that I may have a corrupt usr/tmpDSK and would like to delete and repair this first.

The problem I am having is my tmp directory is filling up to fast and I have been doing all I can to keep it down but each day it just keeps getting bigger. I have tried to follow so many tutorials but it seems many of the SSH commands just don't work. An example would be from one tutorial:

Quote:
1. Unmount and Mount
service chkservd stop
service httpd stop
service mysql stop
unmount /tmp (not sure about this one)
rm -rf /usr/tmpDSK
/scripts/securetmp
service httpd start
service mysql start
service chkservd start
check if /var/tmp shows up in df, if it does, umount that as well).
2. Delete /usr/tmpDSK
3. Run /scripts/securetmp
But none of the service commands work for my server so I believe this to be an old tutorial. However I have found that my server would use these commands:
Quote:
1. Cpanel chkservd
/etc/rc.d/init.d/chkservd stop
/etc/rc.d/init.d/chkservd start
And they work fine.

I am running:
PHP 5.2.6
MySQL 5.0.51a-community-log
Apache version2.2.9 (Unix)

The /tmp size right now is 485M and I would like to bring it up to at least 1G.

I am not sure what other information you might need.
SPS is offline
View Public Profile
 
 
Register now for full access!
Old 08-03-2008, 08:17 AM Re: How to resize a /tmp partition
Super Talker

Posts: 110
Trades: 1
For stuff like this it is so much easier to use Webmin. It takes the hassle out of using the command line for server admin stuff.

Also you need to find out why your /tmp is filling up with so much stuff. It can't be right if that is happening as it means your disk is going to slow you down.

Can you add more ram - it's so cheap now. Can you tune apache and mysql?
Frank Rizzo is offline
View Public Profile Visit Frank Rizzo's homepage!
 
Old 08-03-2008, 04:17 PM Re: How to resize a /tmp partition
SPS
Novice Talker

Posts: 6
Trades: 0
Thanks for the info I will look into the webmin.

I found that the partition tmpDSK was corrupt and that the partition was to small for the websites I am hosting along with some poorly written scripts that are not killing of the sessions they are opening.

So what I have done is changed the time for the kill session and resized the tmp partition.

For anyone else interested in how to resize the tmp partition this is how I did it someone else please comment if I have put something in the wrong order as it was a little while back that I did this and I am not double checking myself at the time of this post.

1. Cpanel chkservd
/etc/rc.d/init.d/chkservd stop

2. Apache
/etc/init.d/httpd stop

3. stop mysql server:
# /etc/init.d/mysqld stop

4. umount -l /tmp
umount -l /var/tmp

5. Then remove the corrupt partition file:
rm -fv /usr/tmpDSK

6. Then create a nice new one:
/scripts/securetmp

7. Restart Apache
/scripts/restartsrv_httpd

8. restart mysql server
# /etc/init.d/mysqld restart

9. Cpanel chkservd
/etc/rc.d/init.d/chkservd start
SPS is offline
View Public Profile
 
Old 08-03-2008, 04:33 PM Re: How to resize a /tmp partition
SPS
Novice Talker

Posts: 6
Trades: 0
O I did forget to mention If you want to increase your tmp dir size above normal, edit the /scripts/securetmp file and look for the line:

Code:
my $tmpdsksize =512000;
Increase the value here to as large as you would like tmp to be. Note, though, that you don't want to make it too large.

This I found on the cpanel forums


A much better practice is to clean out tmp regularly using a script like tmpwatch to keep it to a controllable size. Here's a script (in /scripts/cleantmp) that runs via cron every so often to weed out useless and older tmp files:
Code:
# This script cleans out /tmp of empty, root, cpanel and nobody session files in /tmp

# if --test is passed, we just show the results
if [ "$1" == "--test" ]
then
        CMD="-exec ls -la"
        echo "$0: test mode"
else
        CMD="-exec rm -rf"
fi

# remove empty session files that are over 2 hours old
find /tmp -name "sess*" -empty -mmin +120 -maxdepth 1 $CMD {}  \;

# remove root owned session files
find /tmp -name "sess*" -user root -maxdepth 1 $CMD {} \;

# remove nobody session files
find /tmp -name "*sess*" -user nobody -maxdepth 1 $CMD {} \;

# remove cpanel owned session files
find /tmp -name "sess*" -user cpanel -maxdepth 1 $CMD {} \;

# remove any session file over 4 hours old
find /tmp -name "sess*" -mmin +240 -maxdepth 1 $CMD {} \;

# remove any spamassassin file over 4 hours old
find /tmp -name ".spamassassin*" -mmin +240 -maxdepth 1 $CMD {} \;
Run it with "--test" after and it will just show you all the files it would delete when running for real. This will give you an idea of what it's cleaning out. The comments show you what line does what within the script. Hope this helps!
SPS is offline
View Public Profile
 
Closed Thread     « Reply to How to resize a /tmp partition
 

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 On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.14156 seconds with 12 queries