summaryrefslogtreecommitdiffstats
path: root/sys-utils/unshare.1
diff options
context:
space:
mode:
authorKarel Zak2016-02-24 13:28:19 +0100
committerKarel Zak2016-02-24 13:28:19 +0100
commit249fc8fe899f51fad1eda05e97b38633ea78119f (patch)
treea2a41bc6fd4867068f15c1cc717af097495c2b88 /sys-utils/unshare.1
parentchrt: restore removed ifdef SCHED_RESET_ON_FORK (diff)
downloadkernel-qcow2-util-linux-249fc8fe899f51fad1eda05e97b38633ea78119f.tar.gz
kernel-qcow2-util-linux-249fc8fe899f51fad1eda05e97b38633ea78119f.tar.xz
kernel-qcow2-util-linux-249fc8fe899f51fad1eda05e97b38633ea78119f.zip
unshare: add example for persistent mount namespace
References: https://github.com/karelzak/util-linux/issues/289 Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'sys-utils/unshare.1')
-rw-r--r--sys-utils/unshare.119
1 files changed, 18 insertions, 1 deletions
diff --git a/sys-utils/unshare.1 b/sys-utils/unshare.1
index 71a0a3676..264f13969 100644
--- a/sys-utils/unshare.1
+++ b/sys-utils/unshare.1
@@ -62,7 +62,9 @@ by bind mount.
.TP
.BR \-m , " \-\-mount"[=\fIfile\fP]
Unshare the mount namespace. If \fIfile\fP is specified then persistent namespace is created
-by bind mount.
+by bind mount. Note that \fIfile\fP has to be located on filesystem with
+propagation flag set to \fBprivate\fP. Use command \fBfindmnt -o+PROPAGATION\fP
+if not sure about the current setting. See also examples below.
.TP
.BR \-n , " \-\-net"[=\fIfile\fP]
Unshare the network namespace. If \fIfile\fP is specified then persistent namespace is created
@@ -153,6 +155,21 @@ FOO
.br
Establish a persistent UTS namespace, modify hostname. The namespace maybe later entered
by nsenter. The namespace is destroyed by umount the bind reference.
+
+.TP
+.TQ
+.B # mount --bind /root/namespaces /root/namespaces
+.TQ
+.B # mount --make-private /root/namespaces
+.TQ
+.B # touch /root/namespaces/mnt
+.TQ
+.B # unshare --mount=/root/namespaces/mnt
+.br
+Establish a persistent mount namespace referenced by the bind mount
+/root/namespaces/mnt. This example provides portable solution, because it makes
+sure that the bind mount is created on shared filesystem.
+
.SH SEE ALSO
.BR unshare (2),
.BR clone (2),