It works fine for me to monitor the InnoDB tablespace:
$ inotifywatch -v -t 60 -r /var/lib/mysql/data/*
. . .
Finished establishing watches, now collecting statistics.
Will listen for events for 60 seconds.
total access modify close_nowrite open filename
21 12 0 4 5 /var/lib/mysql/data/test/
3 1 0 1 1 /var/lib/mysql/data/imdb/
3 1 0 1 1 /var/lib/mysql/data/performance_schema/
2 0 2 0 0 /var/lib/mysql/data/ibdata1
2 0 2 0 0 /var/lib/mysql/data/ib_logfile0
1 0 1 0 0 /var/lib/mysql/data/mysqld-bin.000017
I did some more tests and it seems that when I have innodb_flush_method=O_DIRECT
, and I use some DML like INSERT to change data, inotify doesn't report it.
But when I disable O_DIRECT and allow InnoDB I/O to go through the filesystem buffer, inotify does report DML changes to .ibd files.
Other details:
Linux distro: CentOS 6.5
Linux kernel version: 2.6.32
inotify version: 3.14
Filesystem for MySQL datadir: xfs