How to increase /tmp partition size on cPanel

Yesterday we published a security tutorial called: Secure /tmp partition on cPanel. While that way to secure the /tmp partition is fine, the script used by cPanel (/scripts/securetmp) has a problem that often affects many system administrators and developers.

The problem is simple: cPanel allocates a small space size for the /tmp operations, and lot of times you will find that your /tmp is getting filled quickly, and that your basic www services like Apache and MySQL stopped working.

How can I increase /tmp partition size on cPanel?

Login into your dedicated server or vps shell as root.

Stop the services using /tmp partition, those usually are cpanel, mysql and httpd. Run this commands:

/etc/init.d/cpanel stop
/etc/init.d/httpd stop
/etc/init.d/mysql stop

Now, umount /tmp and /var/tmp, run this commands:

umount -l /tmp
umount -l /var/tmp

Backup your current /usr/tmpDKS directory

mv /usr/tmpDSK /usr/tmpDSK.back

Modify /scripts/securetmp and set the desired size for the /tmp partition:

nano -w /scripts/securetmp

Press CTRL + W and search for this variable: tmpdsksize, you should see something like:

my $tmpdsksize   = 512000

Then incrase the /tmp partiiton size as you need, this example is for 2GB partition:

$tmpdsksize = 2048000

Re-create the /tmp partition by running:

/scripts/securetmp

Start your http, cpanel and mysql services again:

/etc/init.d/cpanel start
/etc/init.d/httpd start
/etc/init.d/mysql start

That’s all, at this point you should have your /tmp partition working with an increase size and all your web services like Apache, MySQL and cPanel should be working fine.

Let us know if you had any troubles while trying to increase /tmp partition size on cPanel.

About the Author: Martin Keler

Leave a Reply

Your email address will not be published. Required fields are marked *