Blog

Resize /tmp loopback partition on a cPanel server

Tags: /tmpdeviceloopbackresize

Published on: July 17, 2009 by George K.

Resize /tmp loopback partition on a cPanel server

Scenario:

Usually big hosting firms, who have a proper sys-admin department in house, will have a proper cPanel 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/

Category : cPanel, General, Howtos

George K.

George K.

George started his career in web hosting and Linux technical support in the year 2004 and is with SupportSages since 2009. He has keen interest in server optimizations, custom security solutions, hacked server recovery, cyber forensic and high availability fail over system design and implementation. George loves long drives and is passionate about art and literature.

You may also read:

Comments

Add new commentSIGN IN

Let's Connect

Get new updates

Categories

$0.000 items