Thursday, October 16, 2008

Finding Processes, which are Accessing a File System

After completing every task related to CD/DVD/USB, you might find it annoying to unmount/eject CD/DVD/USB, while it is being used by some unknown/stuck process. Therefore I am providing a solution (fuser). Suppose your were accessing CDROM mounted at /mnt/cd/.

To view which files (of CD) are being accessed by whom :
$ fuser -mu /mnt/cd/*

If you are sure that, the processes are stuck/hang. Then you can kill all those processes :
$ fuser -kmu /mnt/cd/*


Warning!!!: If you are using writable medium (like USB stick), please give following command before killing processes:
$ sudo sync

No comments: