How to increasing the Size of tmpDSK (/tmp) in cPanel ?

How to increasing the Size of tmpDSK (/tmp) in cPanel ?

You may have noticed that cPanel’s default partition size for /tmp is 512 MB. There may be some cases where you have a problem with the partition /tmp is too small while Linux server setup. Sometimes this is very annoying because if there is the service that requires /tmp and found the partition /tmp is full so the service cannot run normally.

By default on most servers, /tmp is the temporary dumping place for many things, for example:
  • PHP session files
  • PHP temporary file uploads
  • MySQL temporary files
  • Cache files for certain Apache modules
Most software that uses temporary files or sessions will automatically prefer to use /tmp – this folder is usually set to 777 permissions that means every user can read, write or append in these files on the server. When your /tmp partition fills up then we have to increase the size of /tmp partition on your Linux server. There are some following steps to increase the size of tmpDSK:

1. Stop cpanel, apache, mysql services and other webserver service.

/etc/init.d/cpanel stop
/etc/init.d/mysql stop
/etc/init.d/httpd stop

2. Try to Umount /tmp and /var/tmp

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

3. Move /usr/tmpDSK file to another location (just in case you’ll need to mount it somewhere else to preserve data):

mv /usr/tmpDSK /usr/tmpDSK_back

4. Modify /scripts/securetmp to set tmpdsksize. For example 2G size

vi /scripts/securetmp
$tmpdsksize = 2048000

5. Run:


6. Once this process is completed, restart all the service.

/etc/init.d/cpanel start
/etc/init.d/httpd start
/etc/init.d/mysql start

There is an another way to increase /tmp partition size directly without scripts.

Stop all the service.

# /etc/init.d/mysql stop

# cp -af /var/tmp /var/tmp.bak

# umount /var/tmp

# umount /tmp

# mv /usr/tmpDSK /usr/tmpDSK_bak

Increase /tmp partition size to 2GB

# dd if=/dev/zero of=/usr/tmpDSK bs=1024 count=2097195

# mkfs /usr/tmpDSK

# tune2fs -j /usr/tmpDSK

# mount -t ext3 -o nosuid,noexec,loop /usr/tmpDSK /tmp

# mount -o bind,noexec,nosuid /tmp /var/tmp

# cp -a /var/tmp.bak/* /tmp/

# rm -rf /var/tmp.bak

# chmod 1777 /tmp

Start all the service.
First release
Last update
0.00 star(s) 0 ratings

More resources from bhawanisingh