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