The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Resize tmp directory need help

Discussion in 'Workarounds and Optimization' started by jackbwa, Dec 28, 2010.

  1. jackbwa

    jackbwa Member

    Joined:
    May 1, 2010
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    Hello everybody

    I want to increase the size of the tmp directory.
    I searched and found this code to use in the SSH.

    Code:
    /etc/init.d/chkservd stop
    /etc/init.d/mysql stop
    umount /var/tmp
    umount /tmp
    sed -i -e 's/512000/2048000/g' /scripts/securetmp
    rm /usr/tmpDSK
    /scripts/securetmp --auto
    cd /tmp
    ln -s /var/lib/mysql/mysql.sock
    /etc/init.d/mysql start
    /etc/init.d/chkservd start
    My concern that I afraid the hard drivers will be deleted after resizing the tmp directory. Could this happen? Is it safe to do this tmp resize process?

    Also what is the best size for the tmp directory? If I need to change it to 10 GB, what do I need to change in the above code?
    Thanks in advance
     
  2. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,453
    Likes Received:
    195
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    10GB might be overkill here.

    In the file scripts/securetmp you'll find a section called # Global Variables with this line:
    my $tmpdsksize = 512000; # Must be larger than 250000

    You should be able to edit that line to the size you wish and save the file.

    As root, via SSH run the script:

    /scripts/securetmp

    Here's an old thread that is related:
    http://forums.cpanel.net/f5/how-resize-tmp-86345.html
     
  3. twhiting9275

    twhiting9275 Well-Known Member

    Joined:
    Sep 26, 2002
    Messages:
    538
    Likes Received:
    15
    Trophy Points:
    18
    cPanel Access Level:
    Root Administrator
    Twitter:
    This is a bit overkill, and probably won't work, because /tmp/ is a pain in the rear end to 'unmount'. There's a LOT that requires it intact.
    The best way I've found to resize temp is to simply remove /usr/tmpDSK and reboot, AFTER changing the size of tmpDSk in /scripts/securetmp

    No, the hard drives won't be deleted, if you do this right.
    I would agree that 10GB is a bit much. Typically, I run a 3GB tmp partition which does just perfectly. To get this, you just need to change the size in /scripts/securetmp to:
    Code:
    my $tmpdsksize     = 3072000;    # Must be larger than 250000
    
    This will put it off at just about 3G
     
  4. garrettp

    garrettp Well-Known Member
    PartnerNOC

    Joined:
    Jun 18, 2004
    Messages:
    312
    Likes Received:
    0
    Trophy Points:
    16
    cPanel Access Level:
    DataCenter Provider
    It's actually not too difficult. Instead of modifying cPanel's script, I wrote my own that will stop all processes using /tmp. Typically only MySQL & cPanel need to be stopped, and a reboot is a tad overkill.

    What the OP posted is basically what the script does in it's entirely aside from some misc checking for sanity and successful /tmp & /var/tmp unmounts. To that end, what the OP posted is just fine to use IMO.
     
  5. jackbwa

    jackbwa Member

    Joined:
    May 1, 2010
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    Thanks very much for your answers, I will try to resize the tmp directory to 2 GB.
     
  6. jackbwa

    jackbwa Member

    Joined:
    May 1, 2010
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    Can someone help me how to edit the tmpdsksize, I have so basic knowledge in this.

    When i type (as root, via SSH this):
    /scripts/securetmp

    I got these lines:
    *** Notice *** No loop module detected
    If the loopback block device is built as a module, try running `modprobe loop` as root via ssh and running this script again.
    If the loopback block device is built into the kernel itself, you can ignore this message.
    *** Notice *** No working loopback device files found. Try running `modprobe loop` as root via ssh and running this script again.
     
  7. garrettp

    garrettp Well-Known Member
    PartnerNOC

    Joined:
    Jun 18, 2004
    Messages:
    312
    Likes Received:
    0
    Trophy Points:
    16
    cPanel Access Level:
    DataCenter Provider
    If you have a working /tmp mount now (one that is not a separate disk partition anyways) then it is safe to ignore that error. We get that on our VPS nodes as the loop module is built into our kernel as opposed to being a module.
     
Loading...
Similar Threads - Resize tmp directory
  1. thorny23
    Replies:
    2
    Views:
    429

Share This Page