Many of you might have come across situations where your /tmp gets filled very often either due to eaccelerator cache or due to session files or such temporary files. Cpanel by default creates /tmp with 512M size. You can always resize tmp to your choice. Here is the step by step details on how it can be done.
1) Stop mysql, apache and cpanel to prevent writing temporary files to /tmp.
/etc/init.d/chkservd stop
/etc/init.d/mysql stop
/etc/init.d/httpd stop
/etc/init.d/cpanel stop
2) Unmount tmp partition.
umount /var/tmp
umount /tmp
Sometimes you will receive errors stating that the device is busy or /tmp cannot be unmounted. Then find out all processes using /tmp and kill them.
lsof /tmp
The above command will list the process ids currently using /tmp. Kill the pids as follows.
kill -9 pid
eg: kill -9 3766
3) The cpanel /scripts/securetmp is the one which maintains the tmp size. You can edit the following line in it to change the size.
my $tmpdsksize = 512000;
Suppose you want to raise the partition size to 2G, you can also do it as follows.
sed -i -e ‘s/512000/2048000/g’ /scripts/securetmp
The above will replace 512000 with 2048000 in the file /scripts/securetmp
4) Remove the temp disk
rm /usr/tmpDSK
5) Now, run the following to recreate tmp
/scripts/securetmp –auto
6) Now go to /tmp and set the mysql socket file.
cd /tmp
ln -s /var/lib/mysql/mysql.sock
7) Restart all services
/etc/init.d/mysql start
/etc/init.d/httpd start
/etc/init.d/cpanel start
/etc/init.d/chkservd start
Now you can verify this using the df -h command.
No comments:
Post a Comment