SWITCH_ROOT(8)

๐Ÿ’… switch_root (section 8, bestie) ๐Ÿ’…

okay so this is a page from the System Administration corner of the manual, and it's called switch_root. it's giving "I'm the one who hands the whole system over to a new filesystem and doesn't even blink". main character energy fr.


โœจ NAME โœจ

switch_root โ€” switch to another filesystem as the root of the mount tree ๐Ÿฆ‹


๐ŸŒธ SYNOPSIS ๐ŸŒธ

switch_root [-hV]

switch_root newroot init [arg...]

๐Ÿ’– DESCRIPTION ๐Ÿ’–

okay so picture this. switch_root takes the stuff that's already mounted โ€” /proc, /dev, /sys and /run โ€” and moves all of it over to newroot. then it makes newroot the new root filesystem, and kicks off the init process. like, it literally relocates the whole vibe and then hands the aux cord to init. ๐Ÿ‘‘

โš ๏ธ WARNING: switch_root recursively removes all files and directories on the current root filesystem. not "some of them". not "the ones it doesn't like". ALL of them. it is not playing around, and it is not asking for permission. read that twice, bestie. ๐Ÿ˜ญ๐Ÿ’€

๐ŸŽ€ OPTIONS ๐ŸŽ€

  • -h, --help โ€” shows you the help text and then dips. ๐Ÿซถ
  • -V, --version โ€” shows you the version and then dips. ๐Ÿ’…

โญ EXIT STATUS โญ

switch_root returns 1 on failure. and on success? it never returns at all. it doesn't come back. it's not ghosting you on purpose, it just literally cannot return once it's done. the switch is that serious. โœจ


๐Ÿฆ‹ NOTES ๐Ÿฆ‹

heads up: switch_root will fail to function if newroot is not the root of a mount. like, that's the requirement, no negotiating. ๐Ÿ™ˆ

but if you want to switch root into a directory that does not meet that requirement? no worries, there's a little bind-mounting trick that turns literally any directory into a mount point. lowkey iconic:

mount --bind $DIR $DIR

and now your random directory is a mount point. slay. ๐Ÿงš


๐Ÿ’œ AUTHORS ๐Ÿ’œ

Peter Jones <pjones@redhat.com>, Jeremy Katz <katzj@redhat.com>, Karel Zak <kzak@redhat.com>

three legends, one page. we love to see it. ๐Ÿซถ


๐ŸŒˆ SEE ALSO ๐ŸŒˆ

chroot(2), init(8), mkinitrd(8), mount(8)

go read those too, iykyk. ๐Ÿ“š


๐Ÿ› REPORTING BUGS ๐Ÿ›

found a bug? for bug reports, use the issue tracker <https://github.com/util-linux/util-linux/issues>. don't suffer in silence, bestie, tell the maintainers. ๐Ÿ’–


๐Ÿ“ AVAILABILITY ๐Ÿ“

the switch_root command is part of the util-linux package, which can be downloaded from the Linux Kernel Archive <https://www.kernel.org/pub/linux/utils/util-linux/>. go get it. โญ


okay that's the whole page, no cap. this one's from util-linux 2.42.4, dated 2026-09-21, and it's filed under SWITCH_ROOT(8). mwah. ๐Ÿ’…๐Ÿ’–โœจ

๐Ÿ“ฆ where this page comes from
  • arch rolling: util-linux 2.42.4-1 ยท BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause-UC AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND ISC AND LGPL-2.1-or-later AND LicenseRef-PublicDomain
  • ๐Ÿ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms