Resize /tmp loopback partition on a cPanel server which doesn’t have a separate /tmp in the partitioning scheme

Usually big hosting firms, who have a proper sys-admin department in house, will have a proper partitioning scheme as well. But some players in the industry goes with the default partitioning scheme, diskdruid presents i.e /, /boot, and swap. While installing cPanel it uses a script to provide a loopback device to make /tmp, nosuid and noexec set . But the script never asks for the size of /tmp partition and instead creates a default 512MB /tmp partition.

Situations may arise which asks for increasing the /tmp partition in such cases and this is how it is done.

/etc/init.d/chkservd stop
/etc/init.d/httpd stop
/etc/init.d/mysql stop
/etc/init.d/postgresql stop
/etc/init.d/exim stop

umount /tmp
umount /var/tmp

If you get the error “ioctl: LOOP_CLR_FD: Device or resource busy” while doing umount, do the umount /tmp again. If it still says resource busy, it’s time to approach your sysadmin. Or else system may stop responding on further actions.

replace “512000″ “2048000″ — /scripts/securetmp

If you don’t want to edit /scripts/securetmp directly, you can use the below script. Create a file, paste the small script below, and then run “sh file_name_you_created”
#!/bin/bash
echo -n "How many GB you want the /tmp to be ? "
read GB
echo "Editing /scripts/securetmp file to have tmp size to $GB GB"
replace "512000" "$((GB*1024000))" -- /scripts/securetmp
/usr/bin/chattr +i /scripts/securetmp

rm /usr/tmpDSK

/scripts/securetmp

cd /tmp

/etc/init.d/chkservd start
/etc/init.d/httpd start
/etc/init.d/mysql start
/etc/init.d/postgresql start
/etc/init.d/exim start
/etc/init.d/securetmp start

A df -h after that should show the increased size. If for any reason your machine hangs, we are not responsible :)

/etc/init.d/

Post to Twitter Tweet This Post

Related posts:

  1. How to upgrade MySQL 5.0 to MySQL 5.1 in a cPanel server
  2. Postgresql issues with a cPanel server
  3. Internal server errors while accessing Fantastico and phpmyadmin in cPanel & WHM
  4. How would I see the available versions of cPanel and Apache in a cPanel installed server ?
  5. Howto move horde specific settings especially calendar, address box, notepad settings etc when moved from one cPanel server to another

Comment Form

About this blog

This blog, acts as a knowledge repository for the world and is unofficial! Anything we find interesting in the cyber world will go here. Most cases, this blog will reflect the happiness of our staff in reaching successful solution to an issue (s)he worked on. A reference for other fellow SAGEs who come across similar issues later