man-pages/man8/switch_root.8.html
2021-03-31 01:06:50 +01:00

129 lines
3.0 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of SWITCH_ROOT</TITLE>
</HEAD><BODY>
<H1>SWITCH_ROOT</H1>
Section: System Administration (8)<BR>Updated: June 2009<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
switch_root - switch to another filesystem as the root of the mount tree
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<B>switch_root</B>
[<B>-hV</B>]
<P>
<B>switch_root</B>
<I>newroot</I>
<I>init</I>
[<I>arg</I>...]
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
<B>switch_root</B>
moves already mounted /proc, /dev, /sys and /run to
<I>newroot</I>
and makes
<I>newroot</I>
the new root filesystem and starts
<I>init</I>
process.
<P>
<B>WARNING: switch_root removes recursively all files and directories on the current root filesystem.</B>
<P>
<A NAME="lbAE">&nbsp;</A>
<H2>OPTIONS</H2>
<DL COMPACT>
<DT id="1"><B>-h, --help</B><DD>
Display help text and exit.
<DT id="2"><B>-V, --version</B><DD>
Display version information and exit.
<P>
</DL>
<A NAME="lbAF">&nbsp;</A>
<H2>RETURN VALUE</H2>
<B>switch_root</B>
returns 0 on success and 1 on failure.
<P>
<A NAME="lbAG">&nbsp;</A>
<H2>NOTES</H2>
switch_root will fail to function if
<B>newroot</B>
is not the root of a mount. If you want to switch root into a directory that
does not meet this requirement then you can first use a bind-mounting trick to
turn any directory into a mount point:
<P>
<PRE>
<DL COMPACT><DT id="3"><DD>mount --bind $DIR $DIR
</DL>
</PRE>
<P>
<A NAME="lbAH">&nbsp;</A>
<H2>SEE ALSO</H2>
<B><A HREF="/cgi-bin/man/man2html?2+chroot">chroot</A></B>(2),
<B><A HREF="/cgi-bin/man/man2html?8+init">init</A></B>(8),
<B><A HREF="/cgi-bin/man/man2html?8+mkinitrd">mkinitrd</A></B>(8),
<B><A HREF="/cgi-bin/man/man2html?8+mount">mount</A></B>(8)
<A NAME="lbAI">&nbsp;</A>
<H2>AUTHORS</H2>
<PRE>
Peter Jones &lt;<A HREF="mailto:pjones@redhat.com">pjones@redhat.com</A>&gt;
Jeremy Katz &lt;<A HREF="mailto:katzj@redhat.com">katzj@redhat.com</A>&gt;
Karel Zak &lt;<A HREF="mailto:kzak@redhat.com">kzak@redhat.com</A>&gt;
</PRE>
<A NAME="lbAJ">&nbsp;</A>
<H2>AVAILABILITY</H2>
The switch_root command is part of the util-linux package and is available from
<A HREF="https://www.kernel.org/pub/linux/utils/util-linux/.">https://www.kernel.org/pub/linux/utils/util-linux/.</A>
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="4"><A HREF="#lbAB">NAME</A><DD>
<DT id="5"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="6"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT id="7"><A HREF="#lbAE">OPTIONS</A><DD>
<DT id="8"><A HREF="#lbAF">RETURN VALUE</A><DD>
<DT id="9"><A HREF="#lbAG">NOTES</A><DD>
<DT id="10"><A HREF="#lbAH">SEE ALSO</A><DD>
<DT id="11"><A HREF="#lbAI">AUTHORS</A><DD>
<DT id="12"><A HREF="#lbAJ">AVAILABILITY</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:06:16 GMT, March 31, 2021
</BODY>
</HTML>