我希望永久安装以下挂载:
[michael@devserver ~]$ findmnt | grep public
└─/home/jail/home/public/repo /dev/mapper/centos-root[/home/michael/testing/gateway/repo] xfs ro,relatime,attr2,inode64,noquota
[michael@devserver ~]$
我使用以下内容创建了这个安装:
sudo mkdir /home/jail/home/public/repo
sudo mount --bind /home/michael/testing/gateway/repo /home/jail/home/public/repo
sudo mount -o remount,ro,bind /home/jail/home/public/repo
我/etc/fstab
目前的样子如下。我希望我应该只添加/home/michael/testing/gateway/repo /home/jail/home/public/repo xfs ro,relatime,attr2,inode64,noquota 0 0
到/etc/fstab
,但是这样做后,我的服务器阻塞,我必须进入紧急模式才能从/etc/fstab
. 永久绑定挂载目录以进行只读访问的正确方法是什么?
[michael@devserver ~]$ cat /etc/fstab
#
# /etc/fstab
# Created by anaconda on Fri Apr 8 14:15:42 2016
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/centos-root / xfs defaults 1 1
UUID=362355d4-e5da-44de-bf5c-5ce92cf43888 /boot xfs defaults 1 2
/dev/mapper/centos-swap swap swap defaults 0 0
[michael@devserver ~]$
好吧,您的
/etc/fstab
文件似乎没有bind
配置挂载点。请善待并添加以下行:/home/michael/testing/gateway/repo /home/jail/home/public/repo none bind,ro 0 0.
然后,我将键入以下命令来验证 mountpount 是否持久且有效。
mount /home/jail/home/public/repo
之后,您可以重新启动系统。