I've been looking for a way to list bind mounts or at least determine if a particular mount is a bind mount. Several answers on this website say that because it is a parameter of a mount operation it will not appear in files like /proc/mounts
or in the output of mounts
. If the device node /dev/sda1
is mounted at /
and the directory /etc
is bind mounted at /etcetera
, then the output from mount will look like:
/dev/sda1 / <some other stuff>
/dev/sda1 /etcetera <some other stuff>
But the kernel must have some knowledge of a bind mount, otherwise it would not be able to bind one directory to another and keep a record of that particular directory being bound to some other directory. Any thoughts on this?
UPDATE: I am not asking about how to find bind mounts. I am asking how the kernel can possibly know about them.