linux – 使用fstab绑定挂载只读?

前端之家收集整理的这篇文章主要介绍了linux – 使用fstab绑定挂载只读?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在使用mount –bind将某个目录附加到另一个路径下(它是一个系统的一部分,它包含多个镜像副本,其中一些副本与其他副本略有不同,但我不希望某些部分被复制,例如作为ISO).

问题是我真的希望绑定挂载是只读的,但是当我在/ etc / fstab中写入这些挂载有选项ro,bind并发出mount -a时,我得到这个:

mount: warning: /some/target/path seems to be mounted read-write.

确实是 – 看起来ro选项被忽略了,警告可能是因为mount在完成后重新检查了mount.

根据mount man页面

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

并且给出的解决方案是发出mount命令,然后发出mount -o remount,ro – 在使用/ etc / fstab进行安装时效果不佳.任何想法如何解决

解决方法

我找到了对debian有用的答案.来自于:

http://www.sagui.org/~gustavo/blog/fedora/read-only-bind-mount.html

/source/dir            /destination/dir    none  bind            0 0
/source/dir            /destination/dir    none  remount,bind,ro 0 0

如果这不起作用,您可以将mount命令放在rc.local中.这很难看.

原文链接:https://www.f2er.com/linux/399099.html

猜你在找的Linux相关文章