Wednesday, June 9, 2010

Processes keeping your device busy while Unmounting

Many a times, when you are trying to unmount your usb device, you find it busy and can't figure out what process is keeping it busy. Some of the commands which can help you in this matter are "fuser" and "lsof". fuser displays the PID of processes using specified files or file systems. lsof  list the open files.  Just observe the output of my lsof command:


[Wed Jun 09|swg@insane:intel]$ lsof |grep Transcend
bash       8619        swg  cwd       DIR       8,17     4096      470 /media/Transcend/intel
lsof      13006        swg  cwd       DIR       8,17     4096      470 /media/Transcend/intel
grep      13007        swg  cwd       DIR       8,17     4096      470 /media/Transcend/intel
lsof      13008        swg  cwd       DIR       8,17     4096      470 /media/Transcend/intel


Transcend is my usb device which I want to unmount and it is giving me a 'device busy' error. I find that "current working directory" is accessing the this device apart from the other two commands about which I am aware of.  Hence, I need to come out of this directory called "/media/Transcend/intel" and do an unmount on the usb device.

No comments: