10

I am working on external server - just doing some web-api there. Today when I wanted to use api php returned following error:

Unknown: write failed: No space left on device (28)

So I figured out that tmp is full:

~# df -h /tmp
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1       102G   97G     0 100% /

So I guess I have to clear some trash in tmp - but first of all I would like to know what is causing the problem, I mean what takes so much memory in tmp? Maybe something is flooding tmp dir somehow? I am not expert in system administration I just write web-api... Is it normal that tmp size is exeeded? Maybe it just happens from time to time?

The command result:

du -sh /tmp/* | sort -h
0       /tmp/tmpEZIyDT
0       /tmp/unity_support_test.0
4.0K    /tmp/amazoncookie.txt
4.0K    /tmp/at-spi2
4.0K    /tmp/filewhHOLH
4.0K    /tmp/keyring-b3ZOTY
4.0K    /tmp/mc-domator
4.0K    /tmp/mc-root
4.0K    /tmp/pulse-2L9K88eMlGn7
4.0K    /tmp/pulse-PKdhtXMmr18n
4.0K    /tmp/ssh-thimUVhk2748
8.0K    /tmp/pulse-5N1YM8s2cT0i

Strange - as I understand not much things in tmp dir... maybe something else is taking so much disk space - how I can check it?

Alan Shutko
  • 4,238
user166241
  • 125
  • 1
  • 2
  • 7

4 Answers4

13

The first command indicates that /tmp is actually on the same filesystem as / (ie, everything else). If your root partition is full, it could be that other stuff (such as /var/log) is taking up space.

A decent way of finding things is to do

du -sc * .[^.]* | sort -n

to find what directories are big. Then you can continue to cd into lower directories and rerun the command to narrow things down.

Alan Shutko
  • 4,238
5

Check if you didnt run out of inodes.

# df -i
Filesystem            Inodes   IUsed   IFree IUse% Mounted on
/dev/sda3            1236992 1236992       0  100% /
tmpfs                1007716       1 1007715    1% /dev/shm
/dev/sda1              38456      45   38411    1% /boot
karel
  • 13,706
Zuzu
  • 51
4

On a recent distro :

du -sh /tmp/* | sort -h

On a older distro :

du -csm /tmp/* | sort -n
Gilles Quénot
  • 4,475
  • 1
  • 30
  • 28
0

This is what I have in my bashrc. Will give you a good idea of what is "big" and you can then investigate from there. Use it when we have users who like to use the systems /tmp instead of our shared tmp space.

function get_big_usage () {
    echo -e "\n"
    du -ks /tmp/* | sort -nr | head
    echo -e "\n"
    du -ks /var/* | sort -nr | head
    echo -e "\n"
    du -ks /home/* | sort -nr | head
}