System Administration
cancel
Showing results for 
Search instead for 
Did you mean: 

Re: I can not delete a file (System says "busy")

 
SOLVED
Go to solution
Regular Advisor

I can not delete a file (System says "busy")

System gives me that file was busy.From this reason I can not delete that file.

How can I learn which process is holding that file.

Is it enought to kill that process to unlock the file?

thanks?
6 REPLIES 6
Honored Contributor

Re: I can not delete a file (System says "busy")

Hi,
if you know which process and you are ceratin you do not need that data, yes.

I would recommend lsof:

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

to identify the process for certain.

Please also read:
http://forums1.itrc.hp.com/service/forums/helptips.do?#33 on how to reward any useful answers given to your questions.
Honored Contributor

Re: I can not delete a file (System says "busy")

Use fuser command to see what is process. Another options is lsof http://hpux.cs.utah.edu/hppd/hpux/Sysadmin/lsof-4.77/


regards,

ivan
Trusted Contributor
Solution

Re: I can not delete a file (System says "busy")

fuser /filename

then check man on fuser because it offers certain switches to kill the process however you can run various ps commands on the output from fuser:

fuser /
23450c

ps -ef |grep 23450

etc

check out the man pages.
hello
Acclaimed Contributor

Re: I can not delete a file (System says "busy")

You can use fuser or lsof.
Yes, once you kill the process the file shouldn't be busy.

Note if the file is an executable or shared lib, ps(1) will show who is running that program.

If the file is being executed, you can "move" it aside, without killing the process(es):
(Assuming you want to replace the file:
$ cp /path-to-new-file/file file.new
$ ln file file.old
$ ln -f file.new file
$ rm -f file.new
Honored Contributor

Re: I can not delete a file (System says "busy")

I think the only time you get this message is when the file in question is an executable that is running (or possibly a library file), in which case it should be easy to spot the name in the 'ps -ef' listing.

For ordinary files that are in use, you can 'rm' them, and when the last process using the file dies, the space is freed; you don't get a message about the file being busy.

What's the filename, the actual command you are running, and the exact error message?

Andrew
Regular Advisor

Re: I can not delete a file (System says "busy")

HI

Check process id using
ps -ef|grep file name

then use kill command like
kill -9 id

and Remove file by using rm command


Khalid