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
Open this file:
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:
umount -l /tmp
umount -l /var/tmp
rm -fv /usr/tmpDSK
Done. You can verify the size of the /tmp folder among others:
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.Read More