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
1 2 3 |
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
1 2 3 |
/scripts/restartsrv_cpsrvd --stop /scripts/restartsrv_mysql --stop /scripts/restartsrv_httpd --stop |
Unmout current /tmp folder
1 |
umount /tmp |
Rename tmp file
1 |
mv /usr/tmpDSK /usr/tmpDSK.old |
Create a new file
1 2 |
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
1 |
mount -a |
Or
1 |
mount -o loop,noexec,nosuid,rw /usr/tmpDSK /tmp |
Start the services
1 2 3 |
/scripts/restartsrv_cpsrvd --start /scripts/restartsrv_mysql --start /scripts/restartsrv_httpd --start |
Enable monitoring
1 2 3 |
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
1 |
/usr/tmpDSK /tmp ext3 defaults,noauto 0 0 |
If you want the default size, that works for most, you can use Cpanel provided script.
1 |
/scripts/securetmp |
Running this script will auto-create /tmp folder with 4 GB size.
Back to Cpanel Server