You are not logged in.

#1 2012-01-31 07:04:38

seiichiro0185
Member
From: Leipzig/Germany
Registered: 2009-04-09
Posts: 226
Website

read-only bind mounts not working properly

Hello,

I discovered a strange behavior regarding mount --bind on my system. In the past I could create read-only bind mounts using first a mount --bind /source /dest and after that mount -o remount,ro /dest. But since some kernel update (not sure which) this procedure results in the complete filesystem of the source being remounted read-only, not only the /dest mountpoint. I also saw that bind-mounts are not shown as such in the outbput of mount:

the mountpoint was created using

mount --bind /mnt/data/Backup/vserver/Daten /mnt/data/homes/vserver/Daten

and results in the following output of mount:

/dev/mapper/data on /mnt/data/homes/vserver/Daten type ext4 (rw,noatime,nodiratime,user_xattr,acl,barrier=1,stripe=64,data=ordered)

so its reported as if i mounted the parent fs (/dev/mapper/data on /mnt/data) to the directory.

Does anyone know what caused this behavior, and how to get read-only bind-mounts back to a working condition?

Thanks in advance,
seiichiro0185


My System: Dell XPS 13 | i7-7560U | 16GB RAM | 512GB SSD | FHD Screen | Arch Linux
My Workstation/Server: Supermicro X11SSZ-F | Xeon E3-1245 v6 | 64GB RAM | 1TB SSD Raid 1 + 6TB HDD ZFS Raid Z1 | Proxmox VE
My Stuff at Github: github
My Homepage: Seiichiros HP

Offline

#2 2012-01-31 10:10:43

R00KIE
Forum Fellow
From: Between a computer and a chair
Registered: 2008-09-14
Posts: 4,734

Re: read-only bind mounts not working properly

You could use the "alternative" way of doing it, which is exemplified in the manual page: '

mount --bind olddir newdir
mount -o remount,ro,bind olddir newdir

Here I can reproduce your problem but the "alternative" way seems to work fine.


R00KIE
Tm90aGluZyB0byBzZWUgaGVyZSwgbW92ZSBhbG9uZy4K

Offline

#3 2012-01-31 10:38:14

seiichiro0185
Member
From: Leipzig/Germany
Registered: 2009-04-09
Posts: 226
Website

Re: read-only bind mounts not working properly

Thanks, that seems to work.
According to the man page, there should be a "bind flag" in /etc/mtab (which is now linked to /proc/self/mounts). But it seems that this flag is missing and causes the wrong behavior.

Actually it seems from the /proc/self/mount and kernel point of view it is the right way, at least according to the information found here, so the "alternative" way actually should be the right one. But from a user perspective its kind of confusing...


My System: Dell XPS 13 | i7-7560U | 16GB RAM | 512GB SSD | FHD Screen | Arch Linux
My Workstation/Server: Supermicro X11SSZ-F | Xeon E3-1245 v6 | 64GB RAM | 1TB SSD Raid 1 + 6TB HDD ZFS Raid Z1 | Proxmox VE
My Stuff at Github: github
My Homepage: Seiichiros HP

Offline

#4 2012-01-31 13:31:44

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: read-only bind mounts not working properly

R00KIE wrote:

You could use the "alternative" way of doing it, which is exemplified in the manual page: '

mount --bind olddir newdir
mount -o remount,ro,bind olddir newdir

Here I can reproduce your problem but the "alternative" way seems to work fine.

That's not the alternative way, that's the only way. Though, you don't need to specify both the source and dest on the remount -- just the dest.

Last edited by falconindy (2012-01-31 13:32:12)

Offline

Board footer

Powered by FluxBB