Increase tmp Partition Size in Whm/Cpanel Server

How to Increase tmp Partition size (/tmp) in cPanel Server

Sometimes we have default configured /tmp directory space is very less and not fulfilling our requirement. When we use magento or other CMS there is some configuration to write temporary data in /tmp directory as this is different mounted directory which makes faster execution so we need to increase tmp partition size. But what happen when we have less amount of space in /tmp directory, in that case server will hang up and also our site performance will goes down.

There is a need to increase tmp partition  /tmp directory space. Below steps by executing one by one will increase /tmp directory space and set it to new value.

1. First we need to stop Cpanel,apache, Mysql service as these services writing into /tmp directory and these service block /tmp directory so we will not able to unmount /tmp directory.

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

2. Umount /tmp and /var/tmp

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

3.Now we will move /usr/tmpDSK file to another location (just in case you’ll need to mount it somewhere else to preserve data):

mv /usr/tmpDSK /usr/tmpDSK_back

4. Now we will change the size of tmp directory and set it as per requirement.

vi /scripts/securetmp
$tmpdsksize = 2048000
// For greater than 4 Gb need to edit the script9

5. The above code will set 2G space for /tmp directory which is enough in normal situation. Now we need to configure it for /tmp by executing below command.

/scripts/securetmp

6. Once completed above command we need to restart all stopped services in 1st step.

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

7 Verify /tmp directory space using below command

df -h

 

Balvinder Singh

Hello, I am Balvinder Singh - DevOps Engineer with 2.5+ year of working experience with different server environments. Tag Line:-Linux | AWS| WHM |Monitoring | Virtualization | Optimization | Performance | Security | Release & Deployment. I love helping companies / clients to deploy their code / applicateions to well managed, optimized, secure server and can go extra mile to satisfy.

You may also like...

1 Response

  1. Mohit says:

    You have mentioned that “For greater than 4 Gb need to edit the script9”. Is that a seperate file that needs to be accessed/changed instead of securetmp??

Leave a Reply to Mohit Cancel reply

Your email address will not be published.