jackbwa

Member
May 1, 2010
11
0
51
Hello everybody

I want to increase the size of the tmp directory.
I searched and found this code to use in the SSH.

Code:
/etc/init.d/chkservd stop
/etc/init.d/mysql stop
umount /var/tmp
umount /tmp
sed -i -e 's/512000/2048000/g' /scripts/securetmp
rm /usr/tmpDSK
/scripts/securetmp --auto
cd /tmp
ln -s /var/lib/mysql/mysql.sock
/etc/init.d/mysql start
/etc/init.d/chkservd start
My concern that I afraid the hard drivers will be deleted after resizing the tmp directory. Could this happen? Is it safe to do this tmp resize process?

Also what is the best size for the tmp directory? If I need to change it to 10 GB, what do I need to change in the above code?
Thanks in advance
 

Infopro

Well-Known Member
May 20, 2003
17,075
524
613
Pennsylvania
cPanel Access Level
Root Administrator
Twitter
10GB might be overkill here.

In the file scripts/securetmp you'll find a section called # Global Variables with this line:
my $tmpdsksize = 512000; # Must be larger than 250000

You should be able to edit that line to the size you wish and save the file.

As root, via SSH run the script:

/scripts/securetmp

Here's an old thread that is related:
http://forums.cpanel.net/f5/how-resize-tmp-86345.html
 

twhiting9275

Well-Known Member
Sep 26, 2002
560
28
178
cPanel Access Level
Root Administrator
Twitter
Code:
/etc/init.d/chkservd stop
/etc/init.d/mysql stop
umount /var/tmp
umount /tmp
sed -i -e 's/512000/2048000/g' /scripts/securetmp
rm /usr/tmpDSK
/scripts/securetmp --auto
cd /tmp
ln -s /var/lib/mysql/mysql.sock
/etc/init.d/mysql start
/etc/init.d/chkservd start
This is a bit overkill, and probably won't work, because /tmp/ is a pain in the rear end to 'unmount'. There's a LOT that requires it intact.
The best way I've found to resize temp is to simply remove /usr/tmpDSK and reboot, AFTER changing the size of tmpDSk in /scripts/securetmp

My concern that I afraid the hard drivers will be deleted after resizing the tmp directory. Could this happen? Is it safe to do this tmp resize process?
No, the hard drives won't be deleted, if you do this right.
Also what is the best size for the tmp directory? If I need to change it to 10 GB, what do I need to change in the above code?
I would agree that 10GB is a bit much. Typically, I run a 3GB tmp partition which does just perfectly. To get this, you just need to change the size in /scripts/securetmp to:
Code:
my $tmpdsksize     = 3072000;    # Must be larger than 250000
This will put it off at just about 3G
 

garrettp

Well-Known Member
PartnerNOC
Jun 18, 2004
312
1
166
cPanel Access Level
DataCenter Provider
This is a bit overkill, and probably won't work, because /tmp/ is a pain in the rear end to 'unmount'. There's a LOT that requires it intact.
The best way I've found to resize temp is to simply remove /usr/tmpDSK and reboot, AFTER changing the size of tmpDSk in /scripts/securetmp


No, the hard drives won't be deleted, if you do this right.

I would agree that 10GB is a bit much. Typically, I run a 3GB tmp partition which does just perfectly. To get this, you just need to change the size in /scripts/securetmp to:
Code:
my $tmpdsksize     = 3072000;    # Must be larger than 250000
This will put it off at just about 3G
It's actually not too difficult. Instead of modifying cPanel's script, I wrote my own that will stop all processes using /tmp. Typically only MySQL & cPanel need to be stopped, and a reboot is a tad overkill.

What the OP posted is basically what the script does in it's entirely aside from some misc checking for sanity and successful /tmp & /var/tmp unmounts. To that end, what the OP posted is just fine to use IMO.
 

jackbwa

Member
May 1, 2010
11
0
51
Can someone help me how to edit the tmpdsksize, I have so basic knowledge in this.

When i type (as root, via SSH this):
/scripts/securetmp

I got these lines:
*** Notice *** No loop module detected
If the loopback block device is built as a module, try running `modprobe loop` as root via ssh and running this script again.
If the loopback block device is built into the kernel itself, you can ignore this message.
*** Notice *** No working loopback device files found. Try running `modprobe loop` as root via ssh and running this script again.
 

garrettp

Well-Known Member
PartnerNOC
Jun 18, 2004
312
1
166
cPanel Access Level
DataCenter Provider
Can someone help me how to edit the tmpdsksize, I have so basic knowledge in this.

When i type (as root, via SSH this):
/scripts/securetmp

I got these lines:
*** Notice *** No loop module detected
If the loopback block device is built as a module, try running `modprobe loop` as root via ssh and running this script again.
If the loopback block device is built into the kernel itself, you can ignore this message.
*** Notice *** No working loopback device files found. Try running `modprobe loop` as root via ssh and running this script again.
If you have a working /tmp mount now (one that is not a separate disk partition anyways) then it is safe to ignore that error. We get that on our VPS nodes as the loop module is built into our kernel as opposed to being a module.