Linux: How to know which process(s) are accessing the files

linuxprocess

I have a mounted partition, which I tried umounting and it's giving me an error. There is a chance that some process is accessing some files in that mounted partition.

How do I know, which process is accessing it, and which files?

Or better, another way to ask this question: How to know all the processes that are accessing a resource? Such as a file?

Best Answer

Run lsof /partitionname where "partitionname" is the name of the partition you're trying to unmount.

You can also use the fuser command for your more general question.