3
$ ls /dev/pts
0  1  ptmx
$ sudo mount --bind /dev /mnt
$ ls /dev/pts
0  1  ptmx
$ sudo mount --bind /dev /mnt
$ ls /dev/pts
$ 

I run on Debian 9 with Linux 4.14.13 kernel.

illiterate
  • 953
  • 7
  • 22
  • 2
    fwiw **a**) it's a `systemd` thing; until I (or someone else) get all things in order for a proper explanation you can **b**) `mount --rbind /dev /mntpoint` (and maybe add the `-o private` option too). –  Feb 22 '19 at 08:43

1 Answers1

1
  1. /tmp/dev/pts/ is empty after the first mount, because you used mount --bind, as opposed to mount --rbind.

    /dev/pts/ is one of a number of other filesystems, which are commonly mounted in sub-directories of /dev/.

  2. /dev/pts/ becomes empty after the second mount, because of mount propagation.

    When you add the second bind mount of the /dev/ filesystem, that bind mount is propagated back to /dev/.

    There is one Q & A about this behaviour here: Mounting new filesystem affects non-recursive bind mounts?

sourcejedi
  • 48,311
  • 17
  • 143
  • 296