Containers · Course contents
Machine not started
30 min·Intermediate

Give mounts a private view

Separate mount tables and prevent mount events from propagating.

Jump to code and terminal ↓

A directory is a mount point

A mount replaces the filesystem visible at a path. In a shared mount namespace that replacement affects every process using the same mount table. Our parent directory contains a file called parent-marker.

Propagation is a second relationship

A new mount namespace copies the mount table. Shared mounts can still propagate new mount events across namespaces. Make the root recursively private before mounting your tmpfs. The course starts the parent root as a shared mount so this propagation boundary is observable.

unshare -m …
mount --make-rprivate /

Your change

The launcher receives a shell command. Prepare its isolated mount view, then execute that command. Tests inspect the kernel mount table, visibility, and the parent after the child exits.

Your goal

Mount a tmpfs inside a new, recursively private mount namespace while keeping the parent directory intact.

What the tests observe

  • Separate mount table
  • Private propagation
  • Parent files remain visible outside

Need a nudge?

Hint 1

Use unshare -m to create the mount namespace.

Hint 2

Inside it, run mount --make-rprivate / before mount -t tmpfs tmpfs /tmp/lab-mount.

Hint 3

Forward the command as a quoted positional argument to the inner shell.

What happens inside Linux

The same path resolves to different filesystems in the two mount namespaces. The child mount disappears when its namespace loses its last process; the parent directory never moved.

Optional account sync. Exercises work without an account.

sh/work/mounts.shLoading local work…
Restoring your workspace…
⌘ / Ctrl ↵
TerminalRISC-V 64 · root · /work

Your Linux machine is ready to start.

Boot a disposable environment in this browser. You’ll get a real root shell, with no remote server or account required.

Isolation checks

Observed inside Linux

Run tests to inspect namespace identities, process visibility, and the hostname. Each check reports the behavior your program produced.