Skip to content

Conversation

@zhb4
Copy link
Collaborator

@zhb4 zhb4 commented Nov 28, 2025

Checklist

  • The page(s) are in the correct platform directories: common, linux, osx, windows, sunos, android, etc.
  • The page description(s) have links to documentation or a homepage.
  • The page(s) follow the content guidelines.
  • The page(s) follow the style guide.
  • The PR contains at most 5 new pages.
  • The PR is authored by me, or has been human-reviewed if it was created with AI or machine translation software.
  • The PR title conforms to the recommended templates.
  • Version of the command being documented (if known):
  • Reference issue: #

@github-actions github-actions bot added new command Issues requesting creation of a new page or PRs adding a new page for a command. review needed Prioritized PRs marked for reviews from maintainers. labels Nov 28, 2025
@tldr-bot
Copy link

The build for this PR failed with the following error(s) at commit
5127e246682da92d80f0e0fbec698f3e281c5528:

pages/linux/pivot_root.md:6: TLDR011 Page never contains more than a single empty line

Please fix the error(s) and push again.

@Managor Managor changed the title Create pivot_root.md pivot_root: add page Nov 28, 2025
- Move the current root to `/old_root` and make `/new_root` the new root:

`sudo pivot_root /new_root /new_root/old_root`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you give me an example on how this should look like in a real world scenario?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you give me an example on how this should look like in a real world scenario?

This usage can all be found online, and there are many detailed cases explaining its application
mkdir -p /mnt/newroot/old_root

cd /mnt/newroot

pivot_root . old_root

umount -l /old_root

Copy link
Member

@Managor Managor Dec 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
`sudo pivot_root /new_root /new_root/old_root`
`sudo pivot_root {{path/to/new_root}} {{path/to/new_root/old_root}}`

Thanks, I just needed an example before I suggest any changes.

@Managor
Copy link
Member

Managor commented Dec 1, 2025

Also, how does this command differ from chroot? Is this a deprecated form of the same thing or something else?

@zhb4
Copy link
Collaborator Author

zhb4 commented Dec 5, 2025

Also, how does this command differ from chroot? Is this a deprecated form of the same thing or something else?

This usage can all be found online. There are many detailed examples of its application that can all be found

@zhb4
Copy link
Collaborator Author

zhb4 commented Dec 5, 2025

Also, how does this command differ from chroot? Is this a deprecated form of the same thing or something else?

For the usage of this command, I suggest you search online. You can basically understand it. It's the same as ordinary linux commands

@@ -0,0 +1,13 @@
# pivot_root

> Change the root filesystem to a new directory and move the current root to another location.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
> Change the root filesystem to a new directory and move the current root to another location.
> Change the root filesystem to a new directory and move the current root to a subdirectory of the new root.

> Commonly used during system initialization (e.g., in initramfs) to switch from a temporary root to the real root filesystem.
> More information: <https://manned.org/pivot_root.8>.
- Move the current root to `/old_root` and make `/new_root` the new root:
Copy link
Member

@Managor Managor Dec 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Move the current root to `/old_root` and make `/new_root` the new root:
- Make `/new_root` the new root (`/`) and move current root to a subdirectory of it:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new command Issues requesting creation of a new page or PRs adding a new page for a command. review needed Prioritized PRs marked for reviews from maintainers.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants