pivot_root
Swap OLD and NEW filesystems (as if by simultaneous mount --move), and move all processes with chdir or chroot under OLD into NEW (including kernel threads) so OLD may be unmounted. toybox
On Linux
Linux
Swap OLD and NEW filesystems (as if by simultaneous mount --move), and move all processes with chdir or chroot under OLD into NEW (including kernel threads) so OLD may be unmounted. The directory NEW must exist under OLD. This doesn't work on initramfs, which can't be moved (about the same way PID 1 can't be killed; see switch_root instead).
pivot_root OLD NEW
Linux
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.
Make /new_root the new root (/) and move current root to a subdirectory of it
sudo pivot_root path/to/new_root path/to/new_root/old_rootIdentifyDisplay help
pivot_root --helpIdentify