Search code examples
linuxfilesystemsvirtual

Howto determine pure system filesystems?


I'm writing notifyfs (for linux only for now), which is:

  • a fsevent notifier, which should work with fuse and network filesystems, like fuse.sshfs, cifs and nfs.

  • a cache of entries gui clients can use to build their views

There must be a way for notifyfs to determine the filesystem, as reported in /proc/self/mountinfo, is a system related filesystem, or a "real" filesystem. For example cpuset, cgroup, devtmpfs and sysfs are what I call system filesystems, and ext2, ext3 and tmpfs, vfat and nfs, cifs are "real" filesystems.

A difference between system and real filesystems are that real filesystems are watchable via inotify, system ones are not. Place a inotify watch on a "file" in /proc, and you'll see that is does not work.

When looking at /proc/filesystems the only extra info is "nodev", which says that the mountsource is a blockdevice or not. When it's a blockdevice, then it's not a system filesystem. But when it's not a blockdevice (and nodev is specified) it's not always a system filesystem, for example the network filesystems cifs and nfs, or tmpfs and ramfs.

Is there a way to determine that a "nodev" filesystem behaves like a real filesystem, eg is watchable via inotify?

Thanks in advance,

Stef


Solution

  • Does df (disk free) only show the the filesystems you call "real"? If yes, you could have a look into the source code of it.