I wish to make the following mount permanent:
[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 ~]$
I created this mount using the following:
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
My /etc/fstab
currently looks like the following.
I expected that I should just add /home/michael/testing/gateway/repo /home/jail/home/public/repo xfs ro,relatime,attr2,inode64,noquota 0 0
to /etc/fstab
, but upon doing so, my server chokes and I have to go in emergency mode to remove this line from /etc/fstab
. What is the proper way to permanently bind mount a directory for read-only access?
[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 ~]$
bind
option in your fstab's line... Take a look here: serverfault.com/a/613184 – setevoy Dec 30 '17 at 16:26findmnt
output when it comes to/etc//fstab
! You think optionsbind,ro
? Also, usenone
for the filesystem per your referenced link orxfs
perfindmnt
s output? Lastly, the tailing0 0
not needed, right? – user1032531 Dec 30 '17 at 16:40/etc/fstab
entry should look like as follows./home/michael/testing/gateway/repo /home/jail/home/public/repo none bind,ro 0 0
. – Thomas Dec 30 '17 at 19:50