For a long time after bind mounts were introduced, the kernel associated mount options with devices rather than mount points, end of story. When you ran mount --bind
, the kernel silently ignored all options since they couldn't be applied just to the bind mount.
Starting with kernel 2.6.26 (or earlier for distributions that patched the upstream kernel), bind mounts have a read-only status that is separate from the original mount. So read-only bind mounts do work. However, the support is not perfect, for example the kernel still ignores options passed to mount --bind
. You can make a read-only bind mount by making a bind mount and mounting it read-only. This introduces a security problem in some scenarios (there is a small window of time during which the bind mount is writable).
Debian lenny has a patched 2.6.26 kernel that makes mount --bind -r
create a read-only bind mount atomically. Ubuntu 10.04 doesn't include that patch.
The fuse filesystem bindfs
generalizes the effect of mount --bind
. It supports read-only bind mounts and many other permission and ownership changes. It is not fully equivalent to mount --bind
, however. For example, reading from a read-only bind mount never updates the access time of a file, but might for a bindfs -p a-w
fuse mount.
mount
says :>