Off-Topic Question: Check if filesystem is in use

Alexander Kriegisch Alexander at Kriegisch.name
Fri Mar 29 09:29:34 UTC 2013


Maybe you will find lsof helpful, e.g.

lsof +D /my/mountpoint

Regards
Alexander Kriegisch


Am 29.03.2013 um 06:45 schrieb Harald Becker <ralda at gmx.de>:

> Hi,
> 
> as here are several experts, and not so much traffic at the moment, I
> throw in an off-topic question (which may still be of interest for
> other system managers):
> 
> In a shell script I like to check if a mounted filesystem is still in
> use by any other process in the system. If there is no more process
> using the filesystem some cleanup actions has to be done and
> afterwards the filesystem is unmounted. As the filesystem is only a
> temporary filesystem it's contents is lost after the unmount, so the
> cleanup action has to be done before the umount. And that cleanup shall
> only be done when there are no more processes actively using the
> filesystem. As I do not know which processes got forked off and are
> still using the filesystem I'm not able to check for existence of
> specific processes. So I'm in need of a test to determine if there is
> any process using a filesystem (that is the filesystem is busy).
> 
> What do you think is the best way to achieve this?
> 
> Many thx for suggestions
> Harald
> _______________________________________________
> busybox mailing list
> busybox at busybox.net
> http://lists.busybox.net/mailman/listinfo/busybox


More information about the busybox mailing list