Introduction to watch folder

Watch folder is an IBM Spectrum Scale feature that allows you to monitor folders, filesets, and inode spaces for file accesses.

By monitoring file accesses, the user is able to act in response to file access events. For example, an administrator can set up a watch on an independent fileset and have every file CLOSE event within the fileset be logged into an output file. The log file can then be parsed periodically and a migration policy can be set to move the files that were closed to another data pool.

Watch folder is designed to emulate Linux inotify, but it has the following significant advantages:
  • It is designed for IBM Spectrum Scale, which is a distributed file system. This means that a watch that is set up on any of the IBM Spectrum Scale nodes receives file access event notifications even if the watched folder, fileset, or inode space is accessed from another node.
  • You can watch subfolders with inode spaces and filesets by only watching the root of those constructs. In contrast, if you needed to watch subfolders using Linux inotify, you would have to install one watch on each of the subfolders.
    Note: For more information, see Watch folder API.
The following events are supported:
Table 1. File access events that are supported by watch folder
File access event Notes
IN_ACCESS A file was accessed (read or executed).
IN_ATTRIB Metadata was changed (for example, chmod, chown, setxattr etc.).
IN_CLOSE_WRITE A file that was opened for writing was closed.
IN_CLOSE_NOWRITE A file or folder that was not opened for writing was closed.
IN_CREATE A file or folder was created in a watched folder.
IN_DELETE A file or folder was deleted from a watched folder.
IN_DELETE_SELF A watched file or folder was deleted.
IN_MODIFY A file was modified (for example, write or truncate).
IN_MOVE_SELF A folder that was being watched was moved.
IN_MOVED_FROM A file within the watched folder was renamed.
IN_MOVED_TO A file was moved or renamed to this folder.
IN_OPEN A file or folder was opened.