I'm current looking for some example to understand CLONE_NEWNS in linux, so I did following experiments:
in shell1:
$ mkdir mnt
$ sudo unshare -m /bin/bash
# mount /dev/sda5 mnt/
# ls mnt
lost+found
where as in shell2:
$ ls mnt
lost+found
I'm expecting output in shell2 should be empty, because CLONE_NEWNS will create a new mount namespace as documents said.
firstly, I thought child's namespace mount will propagate to parents', so I do mount in parent, and child also see the mount!
and then, I create two separate child namespace from same parent, mount in one child will also affect the other.
I'm confused.
ps. in my first experiment in shell1:
# readlink /proc/$$/ns/mnt
mnt:[4026532353]
in shell2:
$ readlink /proc/$$/ns/mnt
mnt:[4026531840]
apparently, they are in different mount namespace.