]> git.ipfire.org Git - thirdparty/util-linux.git/blame - sys-utils/switch_root.8
script: add note about --log-in and passwords
[thirdparty/util-linux.git] / sys-utils / switch_root.8
CommitLineData
b39bd025 1.\" Karel Zak <kzak@redhat.com>
232dc924 2.TH SWITCH_ROOT 8 "June 2009" "util-linux" "System Administration"
b39bd025 3.SH NAME
232dc924 4switch_root \- switch to another filesystem as the root of the mount tree
b39bd025
KZ
5.SH SYNOPSIS
6.B switch_root
07de218c 7.RB [ \-hV ]
b39bd025
KZ
8.LP
9.B switch_root
10.I newroot
11.I init
07de218c 12.RI [ arg ...]
b39bd025
KZ
13.SH DESCRIPTION
14.B switch_root
8a3f29c3 15moves already mounted /proc, /dev, /sys and /run to
b39bd025
KZ
16.I newroot
17and makes
18.I newroot
19the new root filesystem and starts
20.I init
21process.
22
23.B WARNING: switch_root removes recursively all files and directories on the current root filesystem.
24
25.SH OPTIONS
26.IP "\fB\-h, \-\-help\fP"
b4362b6f 27Display help text and exit.
b39bd025 28.IP "\fB\-V, \-\-version\fP"
b4362b6f 29Display version information and exit.
b39bd025
KZ
30
31.SH RETURN VALUE
32.B switch_root
33returns 0 on success and 1 on failure.
34
63cb4b06
KZ
35.SH NOTES
36switch_root will fail to function if
37.B newroot
38is not the root of a mount. If you want to switch root into a directory that
39does not meet this requirement then you can first use a bind-mounting trick to
40turn any directory into a mount point:
41.sp
42.nf
43.RS
44mount --bind $DIR $DIR
45.RE
46.fi
47
b39bd025 48.SH "SEE ALSO"
66083665
MF
49.BR chroot (2),
50.BR init (8),
f053ff1e
MK
51.BR mkinitrd (8),
52.BR mount (8)
b39bd025
KZ
53.SH AUTHORS
54.nf
55Peter Jones <pjones@redhat.com>
56Jeremy Katz <katzj@redhat.com>
57Karel Zak <kzak@redhat.com>
58.fi
59.SH AVAILABILITY
601d12fb 60The switch_root command is part of the util-linux package and is available from
d673b74e 61https://www.kernel.org/pub/linux/utils/util-linux/.