How to Increase size of /tmp on cpanel server

To increase the size of /tmp folder, first, stop monitoring services, so it won’t get auto started while we resize /tmp folder

whmapi1 configureservice service=cpsrvd enabled=1 monitored=0
whmapi1 configureservice service=mysql enabled=1 monitored=0
whmapi1 configureservice service=httpd enabled=1 monitored=0

Now stop Cpanel, MySQL and Apache services

/scripts/restartsrv_cpsrvd --stop
/scripts/restartsrv_mysql --stop
/scripts/restartsrv_httpd --stop

Unmout current /tmp folder

umount /tmp

Rename tmp file

mv /usr/tmpDSK /usr/tmpDSK.old

Create a new file

dd if=/dev/zero of=/usr/tmpDSK bs=1024 count=10000000
mkfs.ext3 /usr/tmpDSK

This will create a 10 GB /tmp folder. If you need to change the size, adjust “count=10000000”.

Now you can mount the /tmp folder with the command

mount -a

Or

mount -o loop,noexec,nosuid,rw /usr/tmpDSK /tmp

Start the services

/scripts/restartsrv_cpsrvd --start
/scripts/restartsrv_mysql --start
/scripts/restartsrv_httpd --start

Enable monitoring

whmapi1 configureservice service=cpsrvd enabled=1 monitored=1
whmapi1 configureservice service=mysql enabled=1 monitored=1
whmapi1 configureservice service=httpd enabled=1 monitored=1

Your /etc/fstab will have the following entry for /tmp folder

/usr/tmpDSK             /tmp                    ext3    defaults,noauto        0 0

If you want the default size, that works for most, you can use Cpanel provided script.

/scripts/securetmp

Running this script will auto-create /tmp folder with 4 GB size.

Back to Cpanel Server

Need help with Linux Server or WordPress? We can help!

Leave a Reply

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