1752782 Members
5742 Online
108789 Solutions
New Discussion юеВ

Problem with open files

 
Manoj Misra
Advisor

Problem with open files

Hi All,

During the systen checkup (N class HP 11). I deleted some files to reduce the file system size but that didn't worked. I belive one of those files remained open even after deleating.

How can I find the process associated to that open file. Or which files are currently in open status(but not visible).
11 REPLIES 11
Trond Haugen
Honored Contributor

Re: Problem with open files

Generally rather than deleting a file you should trunkate it with '> file2trunkate'. This will "keep the file but set it to zero".
The best way out of it now is to reboot.

Regards,
Trond
Regards,
Trond Haugen
LinkedIn
James R. Ferguson
Acclaimed Contributor

Re: Problem with open files

Hi:

An open file can be deleted but the space that it occupied will *not* be returned until all processes using the file finish.

Regards!

...JRF...

Manoj Misra
Advisor

Re: Problem with open files

Is there any way to findout what all the files are open.
Or which processes are using those files.???

Regards
Manoj
harry d brown jr
Honored Contributor

Re: Problem with open files


Yes,

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


live free or die
harry
Live Free or Die
Rich Wright
Trusted Contributor

Re: Problem with open files

If you have Glance+ you can try to find them process by process.
First on the global screen, look for suspicious processes. High CPU, High I/O, etc.
Then select "s" option and enter the PID.
Then select the "F" option to see it's open files.

Rich
Paula J Frazer-Campbell
Honored Contributor

Re: Problem with open files

Hi

Cd to dir

fuser -u *

list list all

fuser -u
will do the named file

fuser -k

Will kill the connection.

See man fuser

Ps must be root to run fuser

HTH

Paula
If you can spell SysAdmin then you is one - anon
Judy Traynor
Valued Contributor

Re: Problem with open files

fuser filename will list the pid associated with open files.

fuser */* works to see which files are open 2 levels down.

The result will be the filename with the pid, once you get pid you can ps -ef it.
Sail With the Wind
Paula J Frazer-Campbell
Honored Contributor

Re: Problem with open files

Hi

I missed the file not being visable.

cd to the dir immediatly under where the files were/are

then fuser -u

This will return PIDs - do a ps -ef and trace each one until you find it.

If the dir should not be in use then an fuser -k can be used - BUT be 100% sure.

Paula
If you can spell SysAdmin then you is one - anon
Bill Thorsteinson
Honored Contributor

Re: Problem with open files

If you where killing off log files, then try sending a HUP
signal to the daemon that had the file open. This should
cause it to close and reopen its log files. For /var/adm
this is likely the syslog
daemon.

To find the PID
ps -ef | grep sys

To kill the daemon
kill -HUP _pid_

Consider installing logrotate
to rotate logs on a reasonable
frequency. It can be set to compress old log files.