Operating System - HP-UX
1833852 Members
1849 Online
110063 Solutions
New Discussion

Display File Filling /tmp

 
SOLVED
Go to solution
MikeL_4
Super Advisor

Display File Filling /tmp

I have a server that someone is running a job on during the day that fills up /tmp, than after about 15 minutes /tmp is back to it's normal 3% Full...

As root I've done an ls -al on /tmp but it does not show any file that is being written to /tmp that is filling it up...

Is there a way to find out what file is being written to /tmp and then deleted afterwards so I can get the developer to cease or at least use there own file system for this temporary file ??
7 REPLIES 7
James R. Ferguson
Acclaimed Contributor
Solution

Re: Display File Filling /tmp

Hi:

This sounds as if a process is creating a temporary file and immediately unlinking (removing) it while using it (keeping it open). This is a common technique. The advantage is that when the process terminates, the programmer doesn't need to perform any other actions to remove the file. The fact that the file's link count is zero, means that the disk blocks used are returned to the system.

You can use 'lsof' to see the files with a link count of zero (0):

# lsof +L1 +D /tmp

Regards!

...JRF...
James R. Ferguson
Acclaimed Contributor

Re: Display File Filling /tmp

Hi (again):

If you don't have 'lsof' installed (and you should!), fetch and install it (no reboot required) from here:

http://hpux.connect.org.uk/hppd/hpux/Sysadmin/lsof-4.80/

Regards!

...JRF...
Paul Sperry
Honored Contributor

Re: Display File Filling /tmp

If it were me I'd make a tmp directory in his home directory then set the tmp env in his .profile.

export TMP=/home/username/tmp

That way he could shoot himself in the foot.
Dennis Handly
Acclaimed Contributor

Re: Display File Filling /tmp

>fills up /tmp,

Is this /tmp or /var/tmp?
The latter is what users should be using.

>Paul: tmp env in his .profile.
>export TMP=/home/username/tmp

The official variable is TMPDIR for tempnam(3).
I'm not sure if tmpfile(3) removes the file at the start or at the end?
Prashanth Waugh
Esteemed Contributor

Re: Display File Filling /tmp

Hi,

you can find the user or process which is the culprit for creating the filw in /tmp

Check who is using the /tmp using
1) fuser -cu /tmp
then u will get the pid

2)ps -ef |grep
you will get the idea which is processess and which user is resoponsible for it

Regards
Atul


For success, attitude is equally as important as ability
Anka
Trusted Contributor

Re: Display File Filling /tmp

With the following command you can determine which files grow in /tmp:

#du -akx /tmp | sort -nr > output1.txt

then execute the same after a while...

#du -akx /tmp | sort -nr > output2.txt

and compare the both files to see what grows:

#diff output1.txt output2.txt

MikeL_4
Super Advisor

Re: Display File Filling /tmp

Thanks