Operating System - HP-UX
1835647 Members
2956 Online
110081 Solutions
New Discussion

/tmp not shrinking in size after files are removed...

 
Houston Kemper
Occasional Advisor

/tmp not shrinking in size after files are removed...

All,

I've cleaned out my /tmp filesystem (with the exception of lost+found) and have noticed that bdf shows the filesystem to still be at 100%. The filesystem has been clean for roughly one hour and the '% free' has yet to drop even 1%

Thoughts anyone??

Thanks
8 REPLIES 8
Sridhar Bhaskarla
Honored Contributor

Re: /tmp not shrinking in size after files are removed...

Hi Houston,

This may be because the processes that are accessing the deleted files are still active. Use lsof command to get the processes and open files on /tmp and then check the processes.

You can get lsof from


http://hpux.cs.utah.edu/hppd/hpux/Sysadmin/lsof-4.55/

It's very handy and is a must to have tool on the systems.


#lsof /tmp > lsoftmp.out

To find out the files that are bigger than 50MB being accessed by the processes, you can use the command

#awk '$7 > 50000000 {print $0}' lsoftmp.out

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Jim Turner
HPE Pro

Re: /tmp not shrinking in size after files are removed...

Hi,

Apparently one or more procs still have the files in question open (even though you've rm'ed them). bdf will not reflect the freed space until every last proc using said file(s) dies.

If you need to nix big files and see the effects immediately with bdf, always redirect nothing (or /dev/null) to the file(s) like so:
> /tmp/somefile
cat /dev/null > /tmp/somefile

You can use "du -kxs /tmp" to get a true picture of what is used/available in /tmp.

Cheers,
Jim
Santosh Nair_1
Honored Contributor

Re: /tmp not shrinking in size after files are removed...

This usually happens because some process has a file open in /tmp and hasn't closed the file. Since the file is still open, even though you've deleted the file, it still takes up space. So basically you have to determine the process that was holding the file and kill/restart it.

You can use the fuser command to find all the executable the has files open in /tmp, i.e.

fuser -cu /tmp

You can also use lsof if you have that on your system.

Hope this helps.

-Santosh
Life is what's happening while you're busy making other plans
Eugen Cocalea
Respected Contributor

Re: /tmp not shrinking in size after files are removed...

Hi,

Some programs still have space allocated in /tmp. This is the explanation.

Do a lsof /tmp, kill the processes that have opened files there, umount the partition and mount it again.

In addition, read this thread:

http://forums.itrc.hp.com/cm/QuestionAnswer/1,11866,0x1cbfcf38d6bdd5118ff10090279cd0f9,00.html

E.
To Live Is To Learn
John Bolene
Honored Contributor

Re: /tmp not shrinking in size after files are removed...

You may have a logfile of some sort that is still being accessed by a process.
It is always a good day when you are launching rockets! http://tripolioklahoma.org, Mostly Missiles http://mostlymissiles.com
Scott_14
Regular Advisor

Re: /tmp not shrinking in size after files are removed...

I have seen this on an R class running 10.2,

after cleaning up the file system it still reported full, umount it and re-mount it and it should give you the correct bdf then.

may have to use what others had said fuser -k

hope this helps

scott
Craig Rants
Honored Contributor

Re: /tmp not shrinking in size after files are removed...

Houston,
I would go with Santosh's action plan.
fuser -cu /tmp

You may have to use fuser anyway even if you kill the processes so why not cut out the middle man.

Good Luck,
C
"In theory, there is no difference between theory and practice. But, in practice, there is. " Jan L.A. van de Snepscheut
Houston Kemper
Occasional Advisor

Re: /tmp not shrinking in size after files are removed...

Great information. Thanks all!