{
    "mode": "man",
    "parameter": "switch_root",
    "section": "8",
    "url": "https://www.chedong.com/phpMan.php/man/switch_root/8/json",
    "generated": "2026-06-02T21:26:07Z",
    "synopsis": "switchroot [-hV]\nswitchroot newroot init [arg...]",
    "sections": {
        "NAME": {
            "content": "switchroot - switch to another filesystem as the root of the mount tree\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "switchroot [-hV]\n\nswitchroot newroot init [arg...]\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "switchroot moves already mounted /proc, /dev, /sys and /run to newroot and makes newroot the\nnew root filesystem and starts init process.\n\nWARNING: switchroot removes recursively all files and directories on the current root",
            "subsections": [
                {
                    "name": "filesystem.",
                    "content": ""
                }
            ]
        },
        "OPTIONS": {
            "content": "",
            "subsections": [
                {
                    "name": "-h, --help",
                    "content": "Display help text and exit.\n",
                    "flag": "-h",
                    "long": "--help"
                },
                {
                    "name": "-V, --version",
                    "content": "Display version information and exit.\n",
                    "flag": "-V",
                    "long": "--version"
                }
            ]
        },
        "EXIT STATUS": {
            "content": "switchroot returns 0 on success and 1 on failure.\n",
            "subsections": []
        },
        "NOTES": {
            "content": "switchroot will fail to function if newroot is not the root of a mount. If you want to\nswitch root into a directory that does not meet this requirement then you can first use a\nbind-mounting trick to turn any directory into a mount point:\n\nmount --bind $DIR $DIR\n",
            "subsections": []
        },
        "AUTHORS": {
            "content": "Peter Jones <pjones@redhat.com>, Jeremy Katz <katzj@redhat.com>, Karel Zak <kzak@redhat.com>\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "chroot(2), init(8), mkinitrd(8), mount(8)\n",
            "subsections": []
        },
        "REPORTING BUGS": {
            "content": "For bug reports, use the issue tracker at https://github.com/karelzak/util-linux/issues.\n",
            "subsections": []
        },
        "AVAILABILITY": {
            "content": "The switchroot command is part of the util-linux package which can be downloaded from Linux\nKernel Archive <https://www.kernel.org/pub/linux/utils/util-linux/>.\n\n\n\nutil-linux 2.37.2                            2021-06-02                               SWITCHROOT(8)",
            "subsections": []
        }
    },
    "summary": "switchroot - switch to another filesystem as the root of the mount tree",
    "flags": [
        {
            "flag": "-h",
            "long": "--help",
            "arg": null,
            "description": "Display help text and exit."
        },
        {
            "flag": "-V",
            "long": "--version",
            "arg": null,
            "description": "Display version information and exit."
        }
    ],
    "examples": [],
    "see_also": [
        {
            "name": "chroot",
            "section": "2",
            "url": "https://www.chedong.com/phpMan.php/man/chroot/2/json"
        },
        {
            "name": "init",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/init/8/json"
        },
        {
            "name": "mkinitrd",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/mkinitrd/8/json"
        },
        {
            "name": "mount",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/mount/8/json"
        }
    ],
    "tldr": {
        "source": "official",
        "description": "Use a different filesystem as the root of the mount tree.",
        "examples": [
            {
                "description": "Move `/proc`, `/dev`, `/sys`, and `/run` to the specified filesystem, use this filesystem as the new root and start the specified init process",
                "command": "switch_root {{new_root}} {{/sbin/init}}"
            },
            {
                "description": "Display help",
                "command": "switch_root {{-h|--help}}"
            }
        ]
    }
}