umounting /

Ian Dowse iedowse at maths.tcd.ie
Thu Dec 11 17:41:37 PST 2003


In message <200312111955.hBBJtM9b000916 at mist.nodomain>, Dan Strick writes:
>You can't unmount the root file system.  Even the mere notion makes
>me feel a little queasy.

There is an explicit test in the kernel that stops you from unmounting
the root file system, I guess as an anti foot shooting measure. If
you disable that test then forcibly unmounting / works fine, but
normally init will promptly die because the vnode containing its
executable has disappeared.

The only case I've come across where the ability to unmount / would
be useful is for some kind of rescue or install CD that starts off
as the root filesystem but wants to switch over to the real root
fs allowing the CD to be removed. I've got this to work before by
changing init so that it re-execs itself upon receipt of a special
signal. Then you can mount the new root directly over /, send the
signal to init, and finally forcibly unmount the underlying /. There
are some necessary bits for this that are only in 5.x, such as the
ability to unmount by filesystem ID rather than by path.

Ian


More information about the freebsd-questions mailing list