views:

354

answers:

2

Hi, my partition /tmp is full... and its empty at the same time. So the partition is full. Check the directory:

# du -sh /tmp
28K /tmp

What? It is empty... And it is really empty... just two empty directories are located in /tmp

Checking partition details:

# df -h
Filesystem           Size  Used Avail Use% Mounted on
/dev/cciss/c0d0p9   1012M  961M     0 100% /tmp

It is full! But why is used + available != size?

Checking Inodes:

# df -i
Filesystem            Inodes   IUsed   IFree IUse% Mounted on
/dev/cciss/c0d0p9     131616      17  131599    1% /tmp

So what happens here?

+4  A: 

In unix/linux, after you remove a file, it remains on the disk until the last program using it closes it. So in your case, you might have a deleted file that is filling up /tmp, and a zombie program that is holding it open.

Update: I'm going to echo @Vinko's suggestion that you can use lsof to find that zombie, using

lsof +D /tmp
Paul Tomblin
Zombies! If it's not files, it's brains!
Mitch Wheat
Here here - the man page says "du - estimate file space usage"
toolkit
@toolkit: The key there is "estimate". Paul Tomblin is right; if you a process still has a handle open to a deleted file the space isn't released. It doesn't even have to be a zombie process.
janm
janm - I was agreeing with Paul. 'Here here' means I agree :-)
toolkit
Suggestion thief! :)
Vinko Vrsalovic
Actually, I should have said 'Hear hear' - http://en.wikipedia.org/wiki/Hear_hear
toolkit
Thank you for correcting yourself and saving me the trouble. :)
Dave Sherohman
+4  A: 

Use lsof to find out which process is holding the file open

$ lsof /usr/bin/python
COMMAND  PID  USER  FD   TYPE DEVICE    SIZE   NODE NAME
python  5020 hplip mem    REG    8,2 1158612 623041 /usr/bin/python2.5
python  6795 vinko txt    REG    8,2 1158612 623041 /usr/bin/python2.5
Vinko Vrsalovic
I stole your suggestion, but I voted you up. Are we even? :-)
Paul Tomblin
Not until I get to steal one of yours and vote you up.
Vinko Vrsalovic