Quantcast
Channel: Sniptools » Unix
Viewing all articles
Browse latest Browse all 2

Increase size of /tmp folder on CentOS Linux under Cpanel

$
0
0

Any dedicated server hosting some websites that get meaningful traffic will quickly ourgrow Cpanel's default /tmp folder size of 512MB. It houses PHP session files, temporary file uploads, your database temporary files, your web server's cache including the one from caches such as APC or eAccelerator, and other such stuff.

With the tmp partition full, the server will experience many random issues such as server crashes. Your sites will quickly go down and leave you head-scratching.

Fortunately, it's quite easy to resize the /tmp partition on cPanel servers — especially if it is the default one created by cPanel installs. There's a handy script at /scripts/securetmp.

Open this file:

pico /scripts/securetmp

And find this line:

my $tmpdsksize = 512000; # Must be larger than 250000

Change it to a larger number than 512 MB. Say you want it to be 2 GB:

my $tmpdsksize = 2097152; # 2GB for the /tmp folder

Now close and save the file.

We need to stop all services that may be using this folder. For me, this includes MySQL, Apache and Nginx.

service mysql stop
service nginx stop
service httpd stop

Now we will simply unmount the /tmp folder and recreate it. Here's the sequence of commands to create it:

lsof /tmp
umount -l /tmp
umount -l /var/tmp
rm -fv /usr/tmpDSK
/scripts/securetmp

Done. You can verify the size of the /tmp folder among others:

df -h

This should show you something like this:

...
/usr/tmpDSK ext3 2.0G 996M 1.1G 51% /tmp
...

NOTE: If you have any problems, for instance, the size of the recreated /tmp folder is not really 2GB despite that code in the /scripts/securetmp we changed, it may be because of some settings you have in the /etc/fstab file. Take a look at it and comment out any lines that interfere with the LABEL for /tmp mount.

The post Increase size of /tmp folder on CentOS Linux under Cpanel appeared first on Sniptools.


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images