mount --bind to attach a certain directory under another path (it is part of a system that holds multiple copies of mirrors where some copies are slightly different then others but I don't want some parts to be duplicated, such as ISOs).
The problem is that I would really like the bind mounts to be read-only, but when I write in
/etc/fstab that these mounts have the options
ro,bind and issue
mount -a, I get this:
mount: warning: /some/target/path seems to be mounted read-write.
And indeed it is - it looks like the
ro option is being ignored and the warning is probably because mount rechecks the mount after its done.
According to the mount man page:
Note that the filesystem mount options will remain the same as those on the original mount point, and cannot be changed by passing the -o option along with --bind/--rbind. The mount options can be changed by a separate remount command
And the solution given is to issue the
mount command followed by
mount -o remount,ro - which doesn't work well when using
/etc/fstab for mounting. Any ideas how to work around that?