Subject: Re: feature request: root file system change
To: Lubomir Sedlacik <salo@Xtrmntr.org>
From: None <tlaronde@polynum.com>
List: tech-kern
Date: 04/16/2005 21:23:46
--HlL+5n6rz5pIUxbD
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Sat, Apr 16, 2005 at 08:16:39PM +0200, Lubomir Sedlacik wrote:
> hi,
>=20
> background: i'd like to have the whole hard drive on my laptop
> reside on cgd(4), including / file system.  the idea is quite simple:
> build a kernel with md(4) file system including cgdconfig(8) and cgd
> layout configuration, boot from e.g., usb disk-on-key, configure cgd(4)
> devices, continue booting from the real / file system.
>=20
> the problem is that there is no clear solution to achieve the last step.
>=20
> there are couple of hackish workarounds, such as chrooting to the newly
> mounted filesystem, insane amount of symlinks or nullmounts.  i'd like
> to avoid them all.
>=20
> linux solved this issue with boot memory disks (initrd) with
> pivot_root(2)/pivot_root(8) combo,
>=20
>  http://www.annodex.net/cgi-bin/man/man2html?pivot_root+2
>  http://www.annodex.net/cgi-bin/man/man2html?pivot_root+8
>=20
> what do you think about adding similar syscall to NetBSD?

IMHO `pivot_root' is not the correct solution, and it has been
specifically designed as a hack to allow to "pull the carpet under the
kernel threads foot".

A process is always associated with a root dir.
Logically, kernel threads (real problem is here) could be associated
with the `real', `incore' kernel root, and the "external" (whether in
memory or on a device) rootfs would be a `userland' root mounted on the
kernel root, allowing to umount userland root at will, while kernel=20
threads are still associated with incore kernel root (not unmountable
of course since it is a hard part of the kernel).
Today, kernfs appears on `userland' rootfs. This could be the inverse:
`userland' is mounted on kernfs, whether masking it, or appearing with
it (union mount).
This could allow to have too a `kernel root' password in the kernel
(only two user at this step: root or non root), distinct from an
administrative root (associated with a `userland' rootfs put on some
external device---mdsetimage makes the distinction a bit fuzzy).

If there is something to consider, my feeling is that Linux pivot_root
is not the way to go. I'm not a kernel dev---as the above comment may
unfortunately show...---but my intuition is that the Linux solution is
logically unsatisfactory.

My 2 cents.
--=20
Thierry Laronde (Alceste) <tlaronde +AT+ polynum +dot+ com>
http://www.kergis.org/  |  http://www.kergis.com/
Key fingerprint =3D 0FF7 E906 FBAF FE95 FD89  250D 52B1 AE95 6006 F40C

--HlL+5n6rz5pIUxbD
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (NetBSD)

iD8DBQFCYWZCUrGulWAG9AwRAk6YAJ0QHYVdjkN5e2W0e07grw1lvOMalACghKUL
HLJbo9VLXpwmt2wlv+cyWXQ=
=s5wx
-----END PGP SIGNATURE-----

--HlL+5n6rz5pIUxbD--