On Centos 6.3 server I noticed that /tmp has no longer free space to store files.

[root@]# df -h
Filesystem            Size  Used Avail Use% Mounted on
                       99G   11G   84G  12% /
tmpfs                  16G     0   16G   0% /dev/shm
/dev/sda1             194M   65M  120M  35% /boot
                       97M   92M  704K 100% /tmp
/dev/mapper/vg1-lv0    50G  180M   47G   1% /mnt/ssd2

But there is nothing in /tmp at all

[root@]# ls -Sahl /tmp |more
total 10K
dr-xr-xr-x. 25 root root 4.0K Mar 16 04:29 ..
drwxrwxrwt.  3 root root 3.0K Mar 16 03:32 .
drwx------.  2 root root 1.0K Mar 16 04:28 mc-root

My question is: How could it be? By what /tmp mount space used? And how could I clean it?

  • df -h is telling you Used=0 ...
    – Brigo
    Mar 15 '13 at 12:55

You should use lsof /tmp to see currently opened file.

If you delete a file, while a software still have a lock on it, you won't see it anymore, but it will still have hd space assigned to it.

  • All /tmp space used by so many threats like: php-fpm 2186 nginx DEL REG 253,3 12 /tmp/apc.7mboJ4
    – Ken Tang
    Mar 15 '13 at 14:43
  • I have server with nginx+php-fpm+apc so it looks line the /tmp partition is not enough space at all...
    – Ken Tang
    Mar 15 '13 at 14:44
  • I've found apc.ini this line: ; The mktemp-style file_mask to pass to the mmap module. apc.mmap_file_mask=/tmp/apc.XXXXXX i think change this line to /var/tmp/apc.XXXXXX???
    – Ken Tang
    Mar 15 '13 at 14:47
  • 1
    When you check the LSOF result, the 'DEL' give you an idea of which file now only exist in memory. Restarting your software stack (ie: nginx, php, etc.) should clear the HD space issues. And you are right, 100MB is not enough Mar 15 '13 at 17:43
  • 1
    An alternative command to lsof /tmp is the command fuser -vm /tmp.
    – jdknight
    Mar 21 '15 at 1:02

That's a very small /tmp partition.

Show the output of lsof /tmp to see which processes have open files there. Stopping the relevant process should free the space.

  • <pre>[root@]# lsof /tmp COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME php-fpm 2185 root DEL REG 253,3 12 /tmp/apc.7mboJ4 php-fpm 2186 nginx DEL REG 253,3 12 /tmp/apc.7mboJ4 php-fpm 2187 nginx DEL REG 253,3 12 /tmp/apc.7mboJ4 php-fpm 2188 nginx DEL REG 253,3 12 /tmp/apc.7mboJ4 php-fpm 2189 nginx DEL REG 253,3 12 /tmp/apc.7mboJ4 php-fpm 2190 nginx DEL REG 253,3 12 /tmp/apc.7mboJ4 php-fpm 2253 nginx DEL REG 253,3 12 /tmp/apc.7mboJ4 ... </pre>
    – Ken Tang
    Mar 15 '13 at 14:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.