[clug] Wiping a (running) system...

Francis Whittle fj.whittle at gmail.com
Tue Jul 27 19:39:23 MDT 2010


On Wed, 2010-07-28 at 07:06 +1000, Adam Baxter wrote:
> >        pivot_root /mnt/tmproot /mnt/tmproot
> 
> Interesting, what's pivot_root?

In this case, it's an executable wrapper around the system call of the
same name so that initrds using shell scripting for their set-up can use
aforementioned system call.  The two arguments it takes are the current
location of the future root and the future location of the current root,
respectively.  The call itself sort of moves all the mount points and
file descriptors around so that they point at the new root.  Or it might
just move the file descriptors.  It's kinda vague like that.

Much more descriptive information should be available with the commands
`man 2 pivot_root' and `man 8 pivot_root'.  One of the particularly
interesting bits is in the BUGS section of the man page for
pivot_root(2):

       Some of the more obscure uses of pivot_root() may quickly  lead
to insanity.

Although one could also argue that anyone attempting to use pivot_root
for anything other than the final stages of ramfs boot-up processes has
shot through the insanity barrier and is now floating in the mists
beyond.  I highly recommend fiddling with it in a VM for a while before
actually using it on a real system.



More information about the linux mailing list