From owner-freebsd-arch Wed May 22 5:36:13 2002 Delivered-To: freebsd-arch@freebsd.org Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by hub.freebsd.org (Postfix) with ESMTP id A66D237B40F for ; Wed, 22 May 2002 05:36:10 -0700 (PDT) Received: by elvis.mu.org (Postfix, from userid 1920) id 80FA3AE1CA; Wed, 22 May 2002 05:36:10 -0700 (PDT) Date: Wed, 22 May 2002 05:36:10 -0700 From: Maxime Henrion To: arch@FreeBSD.org Cc: Peter Wemm Subject: Re: a virtual fs to allow root mounting of any fs without special code Message-ID: <20020522123610.GL496@elvis.mu.org> References: <20020520212459.GH496@elvis.mu.org> <20020522004153.CDF5B3A9A@overcee.wemm.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20020522004153.CDF5B3A9A@overcee.wemm.org> User-Agent: Mutt/1.3.27i Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Peter Wemm wrote: > Maxime Henrion wrote: > > I've written a small virtual filesystem called rootfs which solves the > > chicken and egg problem of root mounting quite nicely. Currently, we > > need special code in each filesystem to allow root mounting. The reason > > for this is that the VFS_MOUNT operations of the filesystems generally > > need to do a lookup to get a device file (e.g. /dev/ad0s1a), so they > > need devfs to be there, and they need lookups to work. > > > > rootfs is nothing more than a 3-vnodes filesystem (/, /dev and /root). > > To mount the root filesystem with rootfs, I do the following : > > > > - initialize rootfs > > - mount devfs on /dev (on top of rootfs) > > - mount the real fs on /root > > - umount devfs from /dev > > - translate vnodes so that / is now the /root > > - remount devfs on /dev (on top of the real fs) > > - terminate rootfs > > You know, this sounds an awful lot like what linux does with their > 'initrd' ramdisk and pivot_root(2). The main difference is that instead > of the rootfs being a synthetic file system, it is a real file system > that is read/write mounted and you can have init etc living in there. > > One thing you didn't clarify above, where does starting init live > in the sequence of events above? Or is this all pre-exec-init stage? > It would be nice to be able to fsck/remount the /root fs while we have the > devfs nodes available. All this is pre-exec-init stage. Cheers, Maxime To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message