Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 2 Dec 2003 00:14:15 -0800 (PST)
From:      Dan Strick <strick@covad.net>
To:        bj93542@yahoo.com
Cc:        dan@mist.nodomain
Subject:   Re: Solved [Re: delete first partition XP and reformat as ufs -> kernel not found]
Message-ID:  <200312020814.hB28EFTk000602@mist.nodomain>

next in thread | raw e-mail | index | archive | help
On Mon, 1 Dec 2003, Dorin H <bj93542@yahoo.com> 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200312020814.hB28EFTk000602>