Monday, December 2, 2013

Killing a file handled process

You may have faced the problem which a dead/unreferenced process is holding a file descriptor to a file, so that you cant delete it using rm command, and giving an error message like below:


Cannot delete folder with rm -rf. Error: device or resource busy


Here what you have to do is to identify the process been hanged and kill it.

lsof +D

this will give you a list of process which are accessing files in the given folder.

kill that session using:

kill

if you still couldn't kill it use below.

kill -s SEGV


'via Blog this'