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