LinuxCommandLibrary

pivot_root

Switch the root filesystem mount point

TLDR

Change root to new directory
$ sudo pivot_root [/new_root] [/new_root/old_root]
copy
Display help
$ pivot_root -h
copy

SYNOPSIS

pivot_root [-h|--help] newroot putold

DESCRIPTION

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 pivotroot, the old root remains accessible at the specified putold location until it's unmounted.

PARAMETERS

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

CAVEATS

Requires root privileges. The newroot must be a mount point. The current working directory of the process calling pivotroot is not changed. Used primarily in system initialization scripts.

HISTORY

pivot_root was added to the Linux kernel to provide a clean way to switch root filesystems during boot. It replaced older methods that used chroot with various mount manipulations.

SEE ALSO

chroot(8), mount(8), switch_root(8)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard