From owner-freebsd-multimedia@FreeBSD.ORG Sun Feb 1 03:28:29 2004 Return-Path: Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 459AC16A4CE for ; Sun, 1 Feb 2004 03:28:29 -0800 (PST) Received: from fw.farid-hajji.net (fw.farid-hajji.net [213.146.115.42]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8341843D2F for ; Sun, 1 Feb 2004 03:28:26 -0800 (PST) (envelope-from cpghost@cordula.ws) Received: from fw.farid-hajji.net (localhost [127.0.0.1]) by fw.farid-hajji.net (Postfix) with ESMTP id 7785640826; Sun, 1 Feb 2004 12:27:47 +0100 (CET) From: Cordula's Web To: julian@elischer.org In-reply-to: (message from Julian Elischer on Sat, 31 Jan 2004 15:26:54 -0800 (PST)) X-Mailer: Emacs-21.3.1/FreeBSD-4.9-STABLE References: Message-Id: <20040201112747.7785640826@fw.farid-hajji.net> Date: Sun, 1 Feb 2004 12:27:47 +0100 (CET) cc: freebsd-multimedia@freebsd.org Subject: Re: Transferring the root filesystem to a ramdisk? X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: cpghost@cordula.ws List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Feb 2004 11:28:29 -0000 > > Now, all I need would be a syscall to switch the kernel's notion > > of the root device. > > > > Or is there a way to umount root, and remount it on the md drive? > > you could mount the replacement root device on '/' > > alternatively you could make init do the chroot (you have source no? :-) chroot()ing init looks like a good idea, but: 1. Isn't /sbin/init itself mmap()ed to the physical device which I'd like to turn off later? 2. Other processes, forked earlier from init will also be mmap()ed to the physical device, so they'll have to die? 1. means that chroot() can only happen before /sbin/init is created, somewhere around /usr/src/sys/kern/init_main.c:mi_startup() 2. means that all these processes will die, when the device is turned off. I'm not a kernel hacker, so the following is just a guess: * A new syscall foo(device_t) is needed. * foo() manipulates the vnode for "/", effectively mounting the memory device. * foo() creates a new process 1, but doesn't switch to it yet * foo() loads process 1 from /sbin/init, which is now on the memory device. * foo() removes all old processes (including the old init process) from the process table, cleans up vm etc... * foo() starts (the new) init process, effectively rebooting with a new root. That's way above and beyond my modest understanding of the kernel. It may be an easy task for kernel gurus though... Thanks, -cpghost. -- Cordula's Web. http://www.cordula.ws/