0

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?

6

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.

3

The tool you need is "lsof" (list open files) using this without any options shows you a list of all open resources including files, sockets and so on.

  • So you mean, going into the mounted partition and executing "lsof" works as a process explorer. Thanks. Is there any way to do the same on a single file? – kingsmasher1 Jun 25 '13 at 14:28
  • it is not relevant where you exec it. it shows you all ressources that are open. if you want to filter out a specific one you can use lsof | grep whatever – Pascal Schmiel Jun 25 '13 at 14:34
  • Seems like fuser suggested above helps. – kingsmasher1 Jun 25 '13 at 14:35
2
$ fuser -m /mnt/point

or

$ lsof | grep mount_point|grep -vi grep |grep -vi lsof

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.