{
    "content": [
        {
            "type": "text",
            "text": "# switch_root (man)\n\n## NAME\n\nswitchroot - switch to another filesystem as the root of the mount tree\n\n## SYNOPSIS\n\nswitchroot [-hV]\nswitchroot newroot init [arg...]\n\n## DESCRIPTION\n\nswitchroot moves already mounted /proc, /dev, /sys and /run to newroot and makes newroot the\nnew root filesystem and starts init process.\n\n## TLDR\n\n> Use a different filesystem as the root of the mount tree.\n\n- Move `/proc`, `/dev`, `/sys`, and `/run` to the specified filesystem, use this filesystem as the new root and start the specified init process:\n  `switch_root {{new_root}} {{/sbin/init}}`\n- Display help:\n  `switch_root {{-h|--help}}`\n\n*Source: tldr-pages*\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION** (2 subsections)\n- **OPTIONS** (2 subsections)\n- **EXIT STATUS**\n- **NOTES**\n- **AUTHORS**\n- **SEE ALSO**\n- **REPORTING BUGS**\n- **AVAILABILITY**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "switch_root",
        "section": "",
        "mode": "man",
        "summary": "switchroot - switch to another filesystem as the root of the mount tree",
        "synopsis": "switchroot [-hV]\nswitchroot newroot init [arg...]",
        "tldr_summary": "Use a different filesystem as the root of the mount tree.",
        "tldr_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}}"
            }
        ],
        "tldr_source": "official",
        "flags": [
            {
                "flag": "-h",
                "long": "--help",
                "arg": null,
                "description": "Display help text and exit."
            },
            {
                "flag": "-V",
                "long": "--version",
                "arg": null,
                "description": "Print version 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"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 4,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 3,
                "subsections": [
                    {
                        "name": "WARNING: switch_root removes recursively all files and directories on the current root",
                        "lines": 1
                    },
                    {
                        "name": "filesystem.",
                        "lines": 1
                    }
                ]
            },
            {
                "name": "OPTIONS",
                "lines": 1,
                "subsections": [
                    {
                        "name": "-h --help",
                        "lines": 2,
                        "flag": "-h",
                        "long": "--help"
                    },
                    {
                        "name": "-V --version",
                        "lines": 2,
                        "flag": "-V",
                        "long": "--version"
                    }
                ]
            },
            {
                "name": "EXIT STATUS",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "NOTES",
                "lines": 6,
                "subsections": []
            },
            {
                "name": "AUTHORS",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "REPORTING BUGS",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "AVAILABILITY",
                "lines": 4,
                "subsections": []
            }
        ],
        "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",
                "subsections": [
                    {
                        "name": "WARNING: switch_root removes recursively all files and directories on the current root",
                        "content": ""
                    },
                    {
                        "name": "filesystem.",
                        "content": ""
                    }
                ]
            },
            "OPTIONS": {
                "content": "",
                "subsections": [
                    {
                        "name": "-h --help",
                        "content": "Display help text and exit.\n",
                        "flag": "-h",
                        "long": "--help"
                    },
                    {
                        "name": "-V --version",
                        "content": "Print version and exit.\n",
                        "flag": "-V",
                        "long": "--version"
                    }
                ]
            },
            "EXIT STATUS": {
                "content": "switchroot returns 1 on failure, it never returns on success.\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": "\u001b[34mPeter Jones \u001b[0m<pjones@redhat.com>, \u001b[34mJeremy Katz \u001b[0m<katzj@redhat.com>, \u001b[34mKarel Zak \u001b[0m<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 \u001b[34mhttps://github.com/util-linux/util-linux/issues\u001b[0m.\n",
                "subsections": []
            },
            "AVAILABILITY": {
                "content": "The switchroot command is part of the util-linux package which can be downloaded from \u001b[34mLinux\u001b[0m\n\u001b[34mKernel Archive \u001b[0m<https://www.kernel.org/pub/linux/utils/util-linux/>.\n\nutil-linux 2.39.3                            2023-10-23                               SWITCHROOT(8)",
                "subsections": []
            }
        }
    }
}