0

I have been trying to follow instructions on how to increase the tmp directory on our VPS from 512mb to 3gb. I successfully modified the tmpdsksize variable in securetmp to 3072000 and saved it using the vi editor and then I entered these lines into the command line:

/etc/init.d/cpanel stop
/etc/init.d/httpd stop
/etc/init.d/lsws stop
/etc/init.d/mysql stop
umount -l /tmp
umount -l /var/tmp
mv /usr/tmpDSK /usr/tmpDSK_back
/scripts/securetmp
/etc/init.d/cpanel start
/etc/init.d/httpd start
/etc/init.d/lsws start
/etc/init.d/mysql start

This is meant to recreate your tmp directory on the VPA.

However this did not work and I now have no tmp directory. The VPS is working and the problem that led me to try increase the tmp directory size has now been fixed. The original problem was running a large select query on the database. But I am concerned about the lack of the tmp directory as this was not my intention. Is it ok to run without one?

The problem with it not creating one seems to come down to running /scripts/securetmp.

Basically when I run this I get errors so my tmp directory is not recreated. The errors I get are these:

root [~]# /scripts/securetmp
/scripts/securetmp: line 1: !/usr/bin/perl: No such file or directory
/scripts/securetmp: line 7: syntax error near unexpected token `}'
/scripts/securetmp: line 7: `BEGIN { unshift @INC, '/usr/local/cpanel'; }'
root [~]# /scripts/securetmp: line 7: syntax error near unexpected token `}'

Any ideas where I am going wrong? I don't have a ton of Linux experience, it's a case of Google and learn. I am accessing the VPS remotely using Putty. I have Googled around lots but can't find much info on /scripts/securetmp errors. Everywhere that talks about increasing tmp directory size just acts like running that line will work. I did not modify lines 1 and 7 when changing the tmp directory size.

The VPS is running Cent OS 6.3.

Xenor
  • 3
  • 3

1 Answers1

1

Running scripts/securetmp to increase my tmpDSK size didn't work for me either: That script simply deleted the partition so I was left with no tmpDSK!

This is on an Xen VPS server with WHM/cpanel.

After many hours of persistence, I found this post: How to increase the size of disk space /tmp (/usr/tmpDSK) partition in linux server

Only thing I had to change was:

1.) Stop MySql service and process kill the tailwatchd process.
[root@server ~]# /etc/init.d/mysqld stop
[root@server ~]# kill -9 2522

To:

1.) Stop MySql service and process kill the tailwatchd process.

[root@server ~]# /etc/init.d/cpanel stop
[root@server ~]# /etc/init.d/mysql stop

(To start these services again when you've finnished, change the stop to start)

Also at step No. 11

11.)Edit the fstab and replace /tmp entry line with :-
/usr/tmpDSK /tmp ext3 loop,noexec,nosuid,rw 0 0

Here is how to access and edit that pesky etc/fstab with SSH:


To make sure this partition is mounted automatically after every reboot, edit the /etc/fstab and replace /tmp entry line with the following one. /usr/temp-disk /tmp ext3 rw,noexec,nosuid,loop 0 0

[root@server ~]# pico -w /etc/fstab

You should see something like this: code:

/dev/hda3 / ext3 defaults,usrquota 1 1 
 /dev/hda1 /boot ext3 defaults 1 2    
 none /dev/pts devpts gid=5,mode=620 0 0    
 none /proc proc defaults 0 0    
 none /dev/shm tmpfs defaults 0 0    
 /dev/hda2 swap swap defaults 0 0    

At the bottom add code:

/usr/temp-disk /tmp ext3 rw,noexec,nosuid,loop 0 0  

While we are at it we are going to secure /dev/shm. Look for the mount line for /dev/shm and change it to the following:
none /dev/shm tmpfs noexec,nosuid 0 0

Umount and remount /dev/shm for the changes to take effect.

[root@server ~]# umount /dev/shm 
[root@server ~]# /dev/shm  

Hit: Ctrl + x to exit, y to save


Well I didn't quite do that either.

Here is my etc/fstab:

/dev/sda1 / ext3 defaults,usrquota,grpquota 1 1
none /dev/pts devpts gid=5,mode=620 0 0
none /dev/shm tmpfs noexec,nosuid 0 0
none /proc proc defaults 0 0
none /sys sysfs defaults 0 0
/dev/sda2 swap swap defaults 0 0
/usr/tmpDSK /tmp ext3 loop,noexec,nosuid,rw 0 0
/tmp /var/tmp ext3 defaults,bind,noauto 0 0

I already had the /usr/tmpDSK line, so I just replaced that line with the one recommended, leaving the bottom /tmp line intact.

Everything now works great. My 1G tmpDSK which was 85% full, has now been increased to 2G, and only 7% full.

I also didn't restore the contents of my tmp backup (it was over-full of crudd). Best to check first though that everything is still working OK - you might have something in that previous tmp file that's needed.

Community
  • 1
  • 1
Lusan
  • 11
  • 2