I use mount --bind
to "overlay" a file from one ext4,rw
filesystem onto another file in ext4,ro
filesystem. For example, /etc/hosts
is on a read-only /
partition, but I have another partition where /rw/etc/hosts
is writable. So when I do
# mount --bind /rw/etc/hosts /etc/hosts
any writes to /etc/hosts
will go to /rw/etc/hosts
This worked fine in
CentOS 6.3
.
# mount -o ro /dev/sdc1 /ro
# mount -o rw /dev/sdc2 /rw
# mount --bind rw/test ro/test
# echo 1 > rw/test
# cat ro/test
1
# echo 2 > ro/test # [1]
# cat rw/test
2
But I cannot get it to work in CentOS 6.4
I repeat the steps from above, but I get an error when trying to write to ro/test
:
# echo 2 > ro/test # [1]
-bash: ro/test: Read-only file system
SELinux
is disabled. Any ideas what could cause this to stop working?
CentOS 6.3 kernel: 2.6.32-279.22.1.el6.x86_64
CentOS 6.4 kernel: 2.6.32-358.el6.x86_64
and 2.6.32-358.2.1.el6.x86_64
mount -o remount,rw
your test? – mikeserv Mar 23 '14 at 20:47