As your server grows or you have some rather large tasks, you might find the default size of your /tmp partition to be too small, which can result in various errors from your services, the most common 4 being cPanel, Apache, LiteSpeed and MySQL.
For example:
[ERROR] mysqld: Can’t create/write to file ‘/tmp/zbLxFquF’ (Errcode: 28 “No space left on device”)
This could be the result of 1 of 2 issues, your /tmp partition is filling up from lots of usage and does not have enough space to more temp files, or, even if your /tmp partition is almost empty, the file trying to being written could be larger than the current maximum size of your /tmp partition.
Another thing to keep in mind, the initial size of your /tmp partition depends on how much total disk space was available during your cPanel/WHM installation. If you add more disk space afterwards, your /tmp partition does not automatically adjust, and may need to be manually increased to scale up with the server. Eg a 20GB disk server might get 512MB of /tmp, where as an 80GB server might get 4096MB of /tmp.
First, view the current parition sizes using the df command as seen below.
df -h
Filesystem Size Used Avail Use% Mounted on/dev/vda1 30G 21G 10G67% /devtmpfs2.9G02.9G0% /devtmpfs3.0G03.0G0% /dev/shmtmpfs3.0G 49M2.9G2% /runtmpfs3.0G03.0G0% /sys/fs/cgroup/dev/loop0 516M 45M 445M10% /tmptmpfs 597M0597M0% /run/user/0
CentOS 5 / CentOS 6
service httpd stopservice lsws stopservice mysql stopservice cpanel stop
CentOS 7
systemctl stop httpdsystemctl stop lswssystemctl stop mysqlsystemctl stop cpanel
cp -rfp /tmp /tmp_backup
umount /tmp
rm -rf /usr/tmpDSK
vi /scripts/securetmp
my $tmpdsksize =512000; # Must be larger than250000
/scripts/securetmp
Would you like to secure /tmp & /var/tmp at boot time? (y/n) yWould you like to secure /tmp & /var/tmp now? (y/n) y
Next, let’s verify the /tmp partition is mounted and has the new expected size.
df -h
Filesystem Size Used Avail Use% Mounted on/dev/vda1 30G 20G 11G66% /devtmpfs2.9G02.9G0% /devtmpfs3.0G03.0G0% /dev/shmtmpfs3.0G 49M2.9G2% /runtmpfs3.0G03.0G0% /sys/fs/cgroup/dev/loop0 516M 45M 445M10% /var/tmptmpfs 597M0597M0% /run/user/0/dev/loop11.9G3.3M1.8G1% /tmp
CentOS 5/CentOS 6
service httpd startservice lsws startservice mysql startservice cpanel start
CentOS 7
systemctl start httpdsystemctl start lswssystemctl start mysqlsystemctl start cpanel
rm -rf /tmp_backup/
