FS#26631 - Strange mount --bind behaviour on archiso.
Attached to Project:
Arch Linux
Opened by John H. (darkenergy) - Wednesday, 26 October 2011, 09:21 GMT
Last edited by Jan de Groot (JGC) - Wednesday, 26 October 2011, 20:32 GMT
Opened by John H. (darkenergy) - Wednesday, 26 October 2011, 09:21 GMT
Last edited by Jan de Groot (JGC) - Wednesday, 26 October 2011, 20:32 GMT
|
Details
I built an archiso image as described in the wiki
https://wiki.archlinux.org/index.php/Archiso
.
When performing a bind mount, strange things happen. Firstly, the "mount" command produces information about the bind mount as if it were a real, physical disk. Secondly, when remounting the bind mount read-only, the "parent" mount is also affected. See below. I have only included the relevant parts from the output of the "mount" command. root ~ # pacman -Q linux linux 3.0.7-1 root ~ # mount proc on /proc type proc (rw,nosuid,nodev,noexec,relatime) sys on /sys type sysfs (rw,nosuid,nodev,noexec,relatime) udev on /dev type devtmpfs (rw,nosuid,relatime,size=10240k,nr_inodes=78273,mode=755) run on /run type tmpfs (rw,nosuid,nodev,relatime,size=10240k,mode=755) /dev/mapper/arch_root-image on / type ext4 (rw,relatime,user_xattr,acl,barrier=1) /dev/mapper/arch_lib-modules on /lib/modules type ext4 (rw,relatime,user_xattr,acl,barrier=1) /dev/mapper/arch_usr-share on /usr/share type ext4 (rw,relatime,user_xattr,acl,barrier=1) /dev/disk/by-label/ARCH_201110 on /bootmnt type iso9660 (ro,relatime) devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000) shm on /dev/shm type tmpfs (rw,nosuid,nodev,relatime) tmpfs on /tmp type tmpfs (rw,nosuid,nodev,relatime) root ~ # mount /dev/sda1 /home/ root ~ # mount ... /dev/sda1 on /home type ext4 (ro,relatime,user_xattr,acl,barrier=1,data=ordered) root ~ # mkdir /home/test_1 /home/test_1/sub_1 root ~ # ls /home/test_1/ sub_1 root ~ # mkdir /mnt/bindmount root ~ # ls /mnt/ bindmount root ~ # mount --bind /home/test_1/ /mnt/bindmount/ root ~ # mount ... /dev/sda1 on /home type ext4 (rw,relatime,user_xattr,acl,barrier=1,data=ordered) /dev/sda1 on /mnt/bindmount type ext4 (rw,relatime,user_xattr,acl,barrier=1,data=ordered) # ERROR: Here, it should report: # /home/test_1 on /mnt/bindmount type none (rw,bind) root ~ # ls /mnt/bindmount/ sub_1 root ~ # mount /mnt/bindmount/ -o remount,ro root ~ # mount ... /dev/sda1 on /home type ext4 (ro,relatime,user_xattr,acl,barrier=1,data=ordered) /dev/sda1 on /mnt/bindmount type ext4 (ro,relatime,user_xattr,acl,barrier=1,data=ordered) |
This task depends upon
Use findmnt, it will look at /proc/self/mountinfo
But it doesn't explain why "mount /mnt/bindmount/ -o remount,ro" causes the "parent" (in my case /home) to be mounted read-only.
If you want a nice explanation see: http://karelzak.blogspot.com/2011/04/bind-mounts-mtab-and-read-only.html