From owner-freebsd-questions@FreeBSD.ORG Tue Dec 2 00:14:25 2003 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 33ADB16A4CF for ; Tue, 2 Dec 2003 00:14:25 -0800 (PST) Received: from smtp.covadmail.net (mx05.covadmail.net [63.65.120.65]) by mx1.FreeBSD.org (Postfix) with SMTP id 9634A43FDD for ; Tue, 2 Dec 2003 00:14:22 -0800 (PST) (envelope-from strick@covad.net) Received: (covad.net 19032 invoked from network); 2 Dec 2003 08:14:17 -0000 Received: from unknown (HELO mist.nodomain) (68.164.174.200) by sun-qmail02 with SMTP; 2 Dec 2003 08:14:16 -0000 Received: from mist.nodomain (localhost [127.0.0.1]) by mist.nodomain (8.12.9p2/8.12.9) with ESMTP id hB28EFhI000603; Tue, 2 Dec 2003 00:14:16 -0800 (PST) (envelope-from dan@mist.nodomain) Received: (from dan@localhost) by mist.nodomain (8.12.9p2/8.12.9/Submit) id hB28EFTk000602; Tue, 2 Dec 2003 00:14:15 -0800 (PST) (envelope-from dan) Date: Tue, 2 Dec 2003 00:14:15 -0800 (PST) From: Dan Strick Message-Id: <200312020814.hB28EFTk000602@mist.nodomain> To: bj93542@yahoo.com cc: freebsd-questions@freebsd.org cc: dan@mist.nodomain Subject: Re: Solved [Re: delete first partition XP and reformat as ufs -> kernel not found] X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Dec 2003 08:14:25 -0000 On Mon, 1 Dec 2003, Dorin H wrote: >> > To finish, I was wondering if I can specify in boot2 > prompt which is the correct slice&partition to use for > booting. > > If my assumptions are correct, in expression > > 0:ad(0,a)/kernel > ^ ^ ^ ^ ^ > | | | | | > | | | | - the path inside the partition > | | | | > | | | - partition in slice > | | | > | | - ??? is this the slice #, drive # ??? > | - refers to driver > - refers to the disk unit > > If no RTFM is available, point me to the source files. > I am not familiar with the FreeBSD kernel sources, but > I'll have no problem reading some code. >> This may not be exactly correct. See the section 8 man page for boot. (i.e. Do "man boot".) The source is in /usr/src/sys/boot/i386. >> > PS2. Does anybody has a clue why the FreeBSD > associates the slice # 2 (i.e. ad0s2) for the PT entry > 4? > Initially, I had > MBR PT: > ad0s1 XP > - not used, reserved space > - not used, reserved space > ad0s2 FreeBSD (swap, /) > > I have installed Debian swap and / in entries 2 and 3, > and the FreeBSD associated the (correct) numbers: > > ad0s1 XP > ad0s2 Debian swap > ad0s3 Debian / > ad0s4 FreeBSD (swap, /) > ^^ > > This made the FreeBSD boot process to fail until I > "fixit" the /etc/fstab to mount the correct root > partition. At that time, I was also unable to specify > in boot2 prompt (?) where my / is. > > My opinion is that if the PT entry # corresponding to > the PT entry were used in the first place, this > problem will be avoid. Probably this reflects a > superficial view, but for a simple HDD configuration > this make sense to me. Thanks again for any > opinions/suggestions. >> If I understand this and your previous emails on this subject, you began with this MBR partition/slice table arrangement: ad0s1 XP ad0s2 FreeBSD and everything worked fine. Then you changed the MBR partitions to: ad0s1 XP ad0s2 Debian swap ad0s3 Debian / ad0s4 FreeBSD and FreeBSD would not boot correctly because the file /etc/fstab, created during the initial FreeBSD installation process, still had "/dev/ad0s2" where it now needed to have "/dev/ad0s4" because you renumbered its MBR partition. Then you fixed that and everything seemed to work fine until you decided to reuse the XP partition for more FreeBSD disk space. So you changed your MBR partition table to: ad0s1 FreeBSD (addtitional file system space) ad0s2 Debian swap ad0s3 Debian / ad0s4 FreeBSD (the operating system) and FreeBSD would no longer boot. This might be due to boot1 confusion. Each partition in the MBR has a flag byte and a type byte. The 0x80 bit in the flag byte marks the partition as "active". Normally at most one partition has the active bit set. A non-interactive MBR bootstrap program typically boots whichever partition has the active bit set. The FreeBSD boot1 program, the program loaded by the MBR bootstrap, is not hardwired with the number of the MBR partition in which it was installed (perhaps it ought to be). Instead it uses the first MBR partition of FreeBSD type with the active bit set. If no FreeBSD MBR partition has the active bit set, the boot1 program chooses the first FreeBSD MBR partition. This normally works correctly even if you have more than one bootable FreeBSD MBR partition because the FreeBSD boot0 MBR program normally rewrites the MBR record with the appropriate active bit set before it invokes the FreeBSD boot1 program. You say that you are using Debian lilo for your MBR bootstrap program rather than the FreeBSD boot0 program. I don't know much about lilo, but I am guessing that it does not set the active partition in the MBR partition table before it boots a partition. Then the boot1 program tries to load the boot2 program from ad0s1 instead of ad0s4. Workaround: you can make ad0s4 the only active FreeBSD partition with the fdisk program. If nothing else changes that, boot1 will correctly boot ad0s4. Dan Strick strick@covad.net