HiveBrain v1.2.0
Get Started
← Back to all entries
snippetbashTip

switch_root — Use a different filesystem as the root of the mount tree. Note: `switch_root` will fail to function

Submitted by: @import:tldr-pages··
0
Viewed 0 times
thecommanduseclifilesystemrootdifferentswitch_root
linux

Problem

How to use the switch_root command: Use a different filesystem as the root of the mount tree. Note: switch_root will fail to function if the new root is not the root of a mount. Use bind-mounting as a workaround. See also: chroot, mount. More information: <https://manned.org/switch_root>.

Solution

switch_root — Use a different filesystem as the root of the mount tree. Note: switch_root will fail to function if the new root is not the root of a mount. Use bind-mounting as a workaround. See also: chroot, mount. More information: <https://manned.org/switch_root>.

Move /proc, /dev, /sys, and /run to the specified filesystem, use this filesystem as the new root and start the specified init process:
switch_root {{new_root}} {{/sbin/init}}


Display help:
switch_root {{[-h|--help]}}

Code Snippets

Move `/proc`, `/dev`, `/sys`, and `/run` to the specified filesystem, use this filesystem as the new root and start the specified init process

switch_root {{new_root}} {{/sbin/init}}

Display help

switch_root {{[-h|--help]}}

Context

tldr-pages: linux/switch_root

Revisions (0)

No revisions yet.