By default, cPanel sets up a paltry <512MB /tmp disk. This isn't nearly large enough for large file uploads or other disk-intensive purposes. While it's better to use RAM for temporary storage, sometimes you need a place to dump huge files (such as uploads). Luckily, raising the /tmp disk size has been fairly simple. cPanel's script to secure the /tmp partition against drop-in hacks by making it noexec can also resize the /tmp directory.
The file we'll be modifying is:
Until recently, modifying one variable was enough to change this, but it seems like there was a change recently that has caused that method to no longer remount /tmp properly. Luckily, the fix for this is two additional small changes to the file.
Let's open up /scripts/securetmp in your favorite editor:
First, we're going to modify line 49:
my $auto = 1
If this isn't already set to 1, set it. Just makes things easier. Next, let's set the /tmp size, line 148:
my $tmpdsksize = 2097152;
This size is in KB - 2GB aught to do it. Now, to fix the issue of mounting /tmp, line 289:
system 'mount', '-o', $mountkeyword . ',loop,noexec,nosuid', $tmpmnt, '/tmp';
We're adding "loop," to the options passed to the mount command to ensure that the system understands /tmp is a loopback device being created on /usr/tmpDSK. Save and exit your file.
Next, we need to shut off anything using /tmp:
And unmount it and /var/tmp:
If you get errors, retry a few times, it'll usually unmount after the 2nd or 3rd try. If you're still getting errors, make sure nothing is open in /tmp:
lsof | grep /tmp
Shut it down or delete it. Next, we need to remove the existing /tmp partition file:
rm -f /usr/tmpDSK
And finally, create the new device:
Depending on the size of your partition, this may take up to 15-20 minutes. After you're done, start everything back up and ensure /tmp is mounted and the right size with a simple: