Home
Main website
Display Sidebar
Hide Ads
Recent Changes
View Source:
pivot_root(8)
Edit
PageHistory
Diff
Info
LikePages
PIVOT_ROOT !!!PIVOT_ROOT NAME SYNOPSIS DESCRIPTION EXAMPLES SEE ALSO ---- !!NAME pivot_root - change the root file system !!SYNOPSIS __pivot_root__ ''new_root put_old'' !!DESCRIPTION __pivot_root__ moves the root file system of the current process to the directory ''put_old'' and makes ''new_root'' the new root file system. Since __pivot_root(8)__ simply calls __pivot_root(2)__, we refer to the man page of the latter for further details. Note that, depending on the implementation of __pivot_root__, root and cwd of the caller may or may not change. The following is a sequence for invoking __pivot_root__ that works in either case, assuming that __pivot_root__ and __chroot__ are in the current __PATH__: cd ''new_root'' pivot_root . ''put_old'' exec chroot . ''command'' Note that __chroot__ must be available under the old root and under the new root, because __pivot_root__ may or may not have implicitly changed the root directory of the shell. Note that __exec chroot__ changes the running executable, which is necessary if the old root directory should be unmounted afterwards. Also note that standard input, output, and error may still point to a device on the old root file system, keeping it busy. They can easily be changed when invoking __chroot__ (see below; note the absence of leading slashes to make it work whether __pivot_root__ has changed the shell's root or not). !!EXAMPLES Change the root file system to /dev/hda1 from an interactive shell: mount /dev/hda1 /new-root cd /new-root pivot_root . old-root exec chroot . sh Mount the new root file system over NFS from 10.0.0.1:/my_root and run __init__: ifconfig lo 127.0.0.1 up # for portmap # configure Ethernet or such portmap # for lockd (implicitly started by mount) mount -o ro 10.0.0.1:/my_root /mnt killall portmap # portmap keeps old root busy cd /mnt pivot_root . old_root exec chroot . sh -c 'umount /old_root; exec /sbin/init' \ !!SEE ALSO __chroot(1), mount(8), pivot_root(2), umount(8)__ ----
2 pages link to
pivot_root(8)
:
Man8p
pivot_root(2)
This page is a man page (or other imported legacy content). We are unable to automatically determine the license status of this page.