← 返回命令列表

Linux command

pivot_root 命令

安全

权限或系统影响较大,执行前请核对目标。

常用示例

Example

sudo pivot_root [/new_root] [/new_root/old_root]

Example

pivot_root -h

说明

pivot_root changes the root filesystem to a new directory and moves the current root to a subdirectory of the new root. This is commonly used during system boot in initramfs to switch from the initial RAM filesystem to the real root filesystem. The operation is atomic and affects the entire system. After pivot_root, the old root remains accessible at the specified put_old location until it's unmounted.

参数

new_root
Directory that becomes the new root filesystem
put_old
Directory under new_root where old root will be mounted
-h, --help
Display help information

FAQ

What is the pivot_root command used for?

pivot_root changes the root filesystem to a new directory and moves the current root to a subdirectory of the new root. This is commonly used during system boot in initramfs to switch from the initial RAM filesystem to the real root filesystem. The operation is atomic and affects the entire system. After pivot_root, the old root remains accessible at the specified put_old location until it's unmounted.

How do I run a basic pivot_root example?

Run `sudo pivot_root [/new_root] [/new_root/old_root]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does new_root do in pivot_root?

Directory that becomes the new root filesystem