Cpanel provide us a separate script to create the /tmp partition size using ‘ dd ‘ command but it will create only 512 MB of partition by default. I have noticed that 512 MB of /tmp space is not enough if you are running video streaming/hosting or any upload sites since it use to swap large files under the /tmp partition.
How do i increase the /tmp partition?
Before you start, you need to stop the httpd and mysql sercice to avoid any data corruption and also to unmount the /tmp drive easily (you will umount: /tmp: device is busy error if any other process running or using the /tmp partion). Use the lsof command to find out the process.
- # lsof /tmp
An example output below :
After stopping (or) killing the httpd, mysql and other service/pid which is using the /tmp partition, just run the lsof /tmp command once again to make sure no process is using the /tmp partition so that you can umount it.
- # umount /tmp
The above command will un-mount the /tmp partition (if you are getting ioctl: LOOP_CLR_FD: Device or resource busy try umount /tmp once again to unmount it) Next you need to edit the /scripts/securetmp script using vi or your favorite editor and then fine/locate to line (512000 is equalent to 500 MB)
- my $tmpdsksize = 512000; (Default)
Modify the 512000 to match your own size for example for 2.5GB you can increase it to 2512000, which may looks
- my $tmpdsksize = 2512000;
Save and exit and now remove the old tmp file
- # rm -f /usr/tmpDSK
Run the script again to create the partition (press ‘y‘ to confirm the secure and boot loading options)
- # /scripts/securetmp
Execute either mount or df -h command to list the mounted partition lists.