How could I detect when a directory is mounted with inotify?

后端 未结 5 1674
栀梦
栀梦 2021-02-06 01:58

I\'m using Linux Inotify to detect FS events on my program.

How could I be notified when a device is mounted on a monitored directory?

5条回答
  •  野的像风
    2021-02-06 02:43

    If you don't mind lots of false alarms, you might be able to watch for close_nowrite on /etc/fstab. . Watching /etc/mtab, /proc/mounts, etc. doesn't work for me.

提交回复
热议问题