I need to remount one directory (/src) as readonly in another location (/dst). This can be done like this:
$ sudo mount --bind /src /dst
$ sudo mount -o remount,ro /dst
However, I would like to use /etc/fstab
to have the mount taking place at boot time and have seen different suggested solutions to this problem, e.g.
/src /dst none bind 0 0
/src /dst none remount,bind,ro 0 0
which unfortunately leaves the directory mounted read/write on my system and this
/src /dst none bind 0 0
/dst /dst none remount,bind,ro 0 0
which will issue an error when trying to mount /dst
:
mount: /dst not mounted already, or bad option
The above solutions supposedly works on different distros, but unfortunately not on Ubuntu 10.04.4 LTS (kernel 2.6.32-41-server).
Any ideas how to accomplish this apart from placing the mount
commands into /etc/rc.local
?