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.

/tmp maxing out 100%

Discussion in 'General Discussion' started by cz1179, Jan 12, 2005.

  1. cz1179

    cz1179 BANNED

    Joined:
    Dec 27, 2004
    Messages:
    105
    Likes Received:
    0
    Trophy Points:
    0
    I'm having trouble with /tmp maxing out at 100% every 2nd or 3rd day suddenly from 1%.

    I followed this guideline her for securing it (after trying /secure/tmp which I believe caused the /tmp problem)
    (guideline found at http://eth0.us/?q=node/11)

    The first step is to check if /tmp is already secure. Some datacenters do not create a /tmp partition while others do.
    -----command-----
    df -h |grep tmp
    -----command-----


    If that displays nothing then go below to create a tmp partition. If you do have a tmp partition you need to see if it mounted with noexec.
    -----command-----
    cat /etc/fstab |grep tmp
    -----command-----

    If there is a line that includes /tmp and noexec then it is already mounted as non-executable. If not follow the instructions below to create one without having to physically format your disk. Idealy you would make a real partition when the disk was originally formated, that being said I have not had any trouble create a /tmp partition using the following method.


    Create a 190Mb partition
    -----command-----
    cd /dev/; dd if=/dev/zero of=tmpMnt bs=1024 count=200000
    -----command-----

    Format the partion
    -----command-----
    mke2fs /dev/tmpMnt
    -----command-----
    When it asks about not being a block special device press Y


    Make a backup of the old data
    -----command-----
    cp -Rp /tmp /tmp_backup
    -----command-----

    Mount the temp filesystem
    -----command-----
    mount -o loop,noexec,nosuid,rw /dev/tmpMnt /tmp
    -----command-----

    Set the permissions
    -----command-----
    chmod 0777 /tmp
    -----command-----

    Copy the old files back
    -----command-----
    cp -Rp /tmp_backup/* /tmp/
    -----command-----

    Once you do that go ahead and restart mysql and make sure it works ok. We do this because mysql places the mysql.sock in /tmp which neeeds to be moved. If not it migth have trouble starting. If it does you can add this line to the bottom of the /etc/fstab to automatically have it mounted:

    Open the file in pico:
    -----command-----
    pico -w /etc/fstab
    -----command-----
    Now add this single line at the bottom:

    /dev/tmpMnt /tmp ext2 loop,noexec,nosuid,rw 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.
    -----command-----
    umount /dev/shm
    mount /dev/shm
    -----command-----

    Next delete the old /var/tmp and create a link to /tmp
    -----command-----
    rm -rf /var/tmp/
    ln -s /tmp/ /var/
    -----command-----

    If everything still works fine you can go ahead and delete the /tmp_backup directory.
    -----command-----
    rm -rf /tmp_backup
    -----command-----



    My problem in this process isroot@server [/dev]# rm -rf /var/tmp/
    rm: cannot remove directory `/var/tmp/': Device or resource busy

    How do I correct this?

    root@server [/dev]# ln -s /tmp/ /var/
    ln: `/var//tmp': cannot overwrite directory

    var/tmp is empty

    I rebooted the server as that site owner said. He said to do
    shutdown -r now (what exactly does that shutdown, and how to restart)?

    I used to have 243MB tmp before this guideline (even though I got stuck halfway through and did not complete). Now I have 379MB. The /tmp area that causes this to happen is one of the logwatch directories.

    root@server [/tmp]# cd logwatch.OJp30518
    root@server [/tmp/logwatch.OJp30518]# dir
    (null) ./
    (null) ../
    (null) autorpm
    (null) clam-update
    (null) cron
    (null) exim
    (null) http
    (null) maillog
    (null) messages
    (null) pureftp
    (null) rt314
    (null) samba
    (null) secure
    (null) tac_acc
    (null) up2date
    (null) vsftpd
    (null) xferlog
    (null) yum


    Please someone help me here. Thank you.
     
  2. haze

    haze Well-Known Member

    Joined:
    Dec 21, 2001
    Messages:
    1,550
    Likes Received:
    3
    Trophy Points:
    38
    You mention you've had a tmp partition then you went ahead and created another one. Why ?

    Honestly, if you don't understand the tutorial or what it does, you shouldn't use it. Hire someone to help you out, be it someone that provides your server or a pro system admin.

    What is the output of:
    cat /etc/fstab
    cat /etc/mtab
    df -h
     
  3. cz1179

    cz1179 BANNED

    Joined:
    Dec 27, 2004
    Messages:
    105
    Likes Received:
    0
    Trophy Points:
    0
    /etc/fstab

    LABEL=/ / ext3 defaults,usrquota 1 1
    LABEL=/boot /boot ext3 defaults 1 2
    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/hda3 swap swap defaults 0 0
    /dev/hdb1 /extra ext3 defaults 1 1
    /dev/tmpMnt /tmp ext2 loop,noexec,nosuid,rw 0 0


    /etc/mtab

    /dev/hda2 / ext3 rw,usrquota 0 0
    none /proc proc rw 0 0
    none /sys sysfs rw 0 0
    none /dev/pts devpts rw,gid=5,mode=620 0 0
    /dev/hda1 /boot ext3 rw 0 0
    none /dev/shm tmpfs rw,noexec,nosuid 0 0
    /dev/hdb1 /extra ext3 rw 0 0
    /dev/tmpMnt /tmp ext2 rw,noexec,nosuid,loop=/dev/loop0 0 0
    /tmp /var/tmp none rw,noexec,nosuid,bind 0 0


    df -h

    Filesystem Size Used Avail Use% Mounted on
    /dev/hda2 228G 65G 152G 30% /
    /dev/hda1 145M 47M 91M 34% /boot
    none 1014M 0 1014M 0% /dev/shm
    /dev/hdb1 230G 17G 202G 8% /extra
    /dev/tmpMnt 379M 45K 359M 1% /tmp
    /tmp 379M 45K 359M 1% /var/tmp
     
  4. alteredsanity

    alteredsanity Member

    Joined:
    Mar 23, 2004
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    1
    Logwatch causing /tmp to fill 100%

    I have same problem with the /tmp, whats happening is my logwatch is reporting a broken pipe when it runs and then immediately fills the /tmp 100%.
     
  5. pavemen

    pavemen Active Member

    Joined:
    Oct 8, 2003
    Messages:
    27
    Likes Received:
    0
    Trophy Points:
    1
    my logwatch started showing 101% in my /tmp partition as well. df -h shows 101%, but when I ls the tmp folder, i only see 212k of stuff and its got a 788mb partition size. yes, this is looking as root.

    SIM is reporting /tmp is out of space (i assume its using df -h)

    when i try to run logwatch via ssh, i get an error about mktemp not supporting -d, it does, but now /tmp is not letting me write to it.
     
  6. Alexandre Duran

    Alexandre Duran Well-Known Member

    Joined:
    May 6, 2003
    Messages:
    61
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Rio de Janeiro - BRAZIL
  7. pavemen

    pavemen Active Member

    Joined:
    Oct 8, 2003
    Messages:
    27
    Likes Received:
    0
    Trophy Points:
    1
    Does not help me. thanks though.

    when I am in /tmp and "du -hs" I get 272K

    when I do "df -h" I get 794MB

    if I "ls -hsl" /tmp I get the 272K

    when I run logwatch I get can not make tmp, does your mktemp support -d option

    i have editted the logwatch.conf to use another location for now.
     
  8. pavemen

    pavemen Active Member

    Joined:
    Oct 8, 2003
    Messages:
    27
    Likes Received:
    0
    Trophy Points:
    1
    actually i feel kind of stupid for getting the fields out of order, but this is what df -h is returning for /tmp (cleaned up for security)

    Filesystem Size Used Avail Use% Mounted on
    xxxxxxxx 788M -64Z 794M 101% /tmp

    notice the Used is listed as -64Z what is that all about?
     
  9. Sinewy

    Sinewy Well-Known Member

    Joined:
    May 15, 2004
    Messages:
    367
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Sydney, Australia
    cPanel Access Level:
    DataCenter Provider
    If you have 2 files called aquota.user and quota.user in /tmp, remove those and run /scripts/fixquotas

    I recommend cleaning /tmp by removing anything called cpanel.TMP.* and sess_*
     
  10. thehostinghut

    thehostinghut Well-Known Member

    Joined:
    Jan 5, 2005
    Messages:
    232
    Likes Received:
    0
    Trophy Points:
    16
    TMP at 101%

    I am having this same issue. Has anyone got a fix for this problem? It is not filled up.

    16 ./lost+found
    4 ./.iroha_unix
    4 ./.ICE-unix
    4 ./.font-unix
    4 ./spamd-21529-init/.spamassassin
    8 ./spamd-21529-init
    288 .
    root@xxxxxxxxxx [/tmp]# df -h
    Filesystem Size Used Avail Use% Mounted on
    /dev/hda6 1012M 302M 659M 32% /
    /dev/hda1 99M 34M 61M 36% /boot
    /dev/hda5 53G 16G 35G 31% /home
    none 502M 0 502M 0% /dev/shm
    /dev/hda7 1012M -64Z 1.1G 101% /tmp
    /dev/hda2 9.9G 4.1G 5.3G 44% /usr
    /dev/hda3 6.9G 946M 5.7G 15% /var

    I guess I will keep looking for an answer. ls -hsl say about 208k

    Tracy
     
  11. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
    What makes you think it's not filled up? You need the following to list all the files:

    ls -laR /tmp
     
  12. thehostinghut

    thehostinghut Well-Known Member

    Joined:
    Jan 5, 2005
    Messages:
    232
    Likes Received:
    0
    Trophy Points:
    16
    /tmp:
    total 260
    drwxrwxrwx 7 root root 208896 Jun 6 18:30 ./
    drwxr-xr-x 24 root root 4096 Jun 6 14:56 ../
    -rwxr--r-- 1 root root 6144 Jun 6 11:59 aquota.user*
    drwxrwxrwt 2 xfs xfs 4096 Jun 5 00:00 .font-unix/
    -rw-r--r-- 1 cpanel cpanel 1692 Jun 5 15:43 horde_32001.log
    drwxrwxrwt 2 root root 4096 Jun 4 23:59 .ICE-unix/
    drwxrwxrwx 2 bin bin 4096 Jun 5 00:00 .iroha_unix/
    drwx------ 2 root root 16384 Jan 4 14:14 lost+found/
    lrwxrwxrwx 1 root root 27 Jun 4 21:04 mysql.sock -> ../var/lib/mysql/mysql.sock=
    -rwxr--r-- 1 root root 32 Jun 6 11:59 quota.user*
    drwx------ 3 root root 4096 Mar 18 05:24 spamd-21529-init/

    /tmp/.font-unix:
    total 212
    drwxrwxrwt 2 xfs xfs 4096 Jun 5 00:00 ./
    drwxrwxrwx 7 root root 208896 Jun 6 18:30 ../
    srwxrwxrwx 1 xfs xfs 0 Jun 5 00:00 fs7100=

    /tmp/.ICE-unix:
    total 212
    drwxrwxrwt 2 root root 4096 Jun 4 23:59 ./
    drwxrwxrwx 7 root root 208896 Jun 6 18:30 ../

    /tmp/.iroha_unix:
    total 212
    drwxrwxrwx 2 bin bin 4096 Jun 5 00:00 ./
    drwxrwxrwx 7 root root 208896 Jun 6 18:30 ../
    srwxrwxrwx 1 bin bin 0 Jun 5 00:00 IROHA=

    /tmp/lost+found:
    total 224
    drwx------ 2 root root 16384 Jan 4 14:14 ./
    drwxrwxrwx 7 root root 208896 Jun 6 18:30 ../

    /tmp/spamd-21529-init:
    total 216
    drwx------ 3 root root 4096 Mar 18 05:24 ./
    drwxrwxrwx 7 root root 208896 Jun 6 18:30 ../
    drwx------ 2 root root 4096 Mar 18 05:24 .spamassassin/

    /tmp/spamd-21529-init/.spamassassin:
    total 8
    drwx------ 2 root root 4096 Mar 18 05:24 ./
    drwx------ 3 root root 4096 Mar 18 05:24 ../
     
  13. thehostinghut

    thehostinghut Well-Known Member

    Joined:
    Jan 5, 2005
    Messages:
    232
    Likes Received:
    0
    Trophy Points:
    16
    I just umounted and reformated it. That was about the only thing that seemed to help.

    We will see if that really helps.

    Tracy
     
  14. vishwas

    vishwas Well-Known Member

    Joined:
    Feb 9, 2004
    Messages:
    61
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Front of PC
    I am also having same problem even i deleted file name starts from cpanel and sess still df -h shows me 90 % disk full when the du -sh shows me only 4.8M. when

    /dev/tmpMnt 379M 322M 38M 90% /tmp
    /tmp 379M 322M 38M 90% /var/tmp

    Please advice,
     
  15. quadrahost

    quadrahost Active Member

    Joined:
    Jul 17, 2003
    Messages:
    44
    Likes Received:
    0
    Trophy Points:
    6
    I have the same issue. I have to delete everything in tmp at least once a day because it fills up 100%
     
  16. thehostinghut

    thehostinghut Well-Known Member

    Joined:
    Jan 5, 2005
    Messages:
    232
    Likes Received:
    0
    Trophy Points:
    16
    Have you tried to umount it and reformat the /tmp dir. That was about the only thing that would fix my issue. I have not had any issues after doing that.

    Just mount it a noexe and all that when you do or if you do.

    Tracy
     
Loading...

Share This Page