Introduction

By default, the size of the cPanel-generated /tmp filesystem is 4GB, or 5% of the /usr filesystem size, whichever is smaller. You may wish to increase the size of this filesystem so it can hold more data.

 

Caveats

  • We recommend this procedure only be performed by an advanced system administrator and only during a scheduled dedicated time since it requires temporarily stopping the services that write to /tmp.
  • This procedure only works on servers on which cPanel has generated /tmp. cPanel-generated /tmp filesystems have /dev/loop in their names, for example:
    [root@server]# df -h /tmp
    Filesystem      Size  Used Avail Use% Mounted on
    /dev/loop0      477M  2.4M  449M   1% /tmp

    If your server's current /tmp filesystem does not contain /dev/loop in its name, the filesystem was created outside by cPanel by the server's operating system or data center, and you will need to seek assistance from your data center with increasing the size of /tmp.

  • This procedure does not work on servers running in Virtuozzo or VZ environments. 

 

Procedure

1. Modify this line in /scripts/securetmp to set tmpdsksize to the desired size--for example, for 10 GB:

my $tmpdsksize = 10485760

2. Comment out this section of /scripts/securetmp:

my $five_percent_of_available = ( $available * 0.05 );
    if ( $five_percent_of_available > $tmpdsksize ) {
        $tmpdsksize = $five_percent_of_available;
    }

my $FOUR_GIG_k = ( 1024 * 1024 * 4 );
    if ( $tmpdsksize > $FOUR_GIG_k ) {
        $tmpdsksize = $FOUR_GIG_k;
  }

3. Check which services are currently using /tmp:

lsof | grep /tmp | grep -v deleted

4. Temporarily disable monitoring for the services using /tmp, for example:

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

5. Stop the services that use /tmp, for example:

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

6. Unmount /tmp and /var/tmp:

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

7. Move /usr/tmpDSK file to another location (in case you need to mount it elsewhere to preserve data):

mv /usr/tmpDSK /usr/tmpDSK_bak

8. Run this script to create the larger /tmp filesystem:

/scripts/securetmp

9. Restart the services you stopped previously, for example:

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

10. Re-enable monitoring for the services, for example:

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