Friday, March 22, 2013

How to increase Size of /tmp partitions in Linux

Here is How to increase the size of /var/tmp and /tmp partition
You need to have root access to your server. If not, you can’t increase the size of /tmp and /var/tmp partition directory, sorry.

Shutdown httpd and mysql using these commands

service httpd stop
service mysql stop

First, you need to edit the file securetmp in /usr/local/cpanel/scripts/ folder. You can download the file using WinSCP, edit it and then upload it to the server.

In /usr/local/cpanel/scripts/securetmp file, look for a line like this:
my $tmpdsksize     = 512000;    # Must be larger than 250000

and change it to

my $tmpdsksize     = 2097152;    # Must be larger than 250000

This will allow us to allot 2GB of space size for the tmp partition.

Now, you need to log in to SSH using root account to make the changes. Once you are in, run these commands one by one.

umount -l /tmp
umount -l /var/tmp
rm -fv /usr/tmpDSK
/usr/local/cpanel/scripts/securetmp

Depending on your server configuration, the commands may take some time to execute properly. When you are done, restart the server.

restart

Now when the server is fully restarted, you can check the partitions using the following command.

df -h

 df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_server-lv_root
                       50G   33G   14G  71% /
tmpfs                 3.9G     0  3.9G   0% /dev/shm
/dev/sda1             485M  157M  303M  35% /boot
/dev/mapper/vg_server-lv_home
                       44G   19G   23G  46% /home
/usr/tmpDSK           2.0G   68M  1.9G   4% /tmp

No comments:

Post a Comment