Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 05 Jan 2002 11:34:10 -0500
From:      "Louis A. Mamakos" <louie@TransSys.COM>
To:        Doug White <dwhite@resnet.uoregon.edu>
Cc:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: what slice did I boot from? 
Message-ID:  <200201051634.g05GYA798375@whizzo.transsys.com>
In-Reply-To: Your message of "Sat, 05 Jan 2002 01:07:57 PST." <20020105010254.T5794-100000@resnet.uoregon.edu> 
References:  <20020105010254.T5794-100000@resnet.uoregon.edu> 

next in thread | previous in thread | raw e-mail | index | archive | help
> On Fri, 4 Jan 2002, Louis A. Mamakos wrote:
> 
> > I've got one of the litle soekris net4501 boards that I use as a
> > router/firewall/NAT box, and it works really good.  I have a stripped
> > down FreeBSD system that I run in a 16MB partition on an 32MB Compact
> > Flash card plugged into the net4501.  Actually, I have two 16MB
> > slices, and my goal is to be running from one, and installing
> > the "next" version into the second slice.  That way, if the new one
> > distribution screws up, I can back-out to the older on on the other
> > partition.
> 
> I've actually been monkeying with this and ran into a bigger problem ..
> boot2 only knows how to handle one FreeBSD slice. You have to play
> loader(8) tricks to boot the second slice.
> 
> Specifically...
> . abort the kernel load
> . 'set currdev=disk1s2a:'
> . 'load /boot/kernel/kernel' (and so forth)
> 
> Particularly if you are running -CURRENT you must compile in your device
> hints, otherwise everything gets confused.

Hmm.. I'm running a 4.4-STABLE based system on the hardware, and
don't seem to have any problem booting off the other slice.  Right
now, it's runnong on the second slice of ATA Compact Flash disk:

# kenv
LINES="24"
console="vidconsole"
currdev="disk0s2a:"
interpret="ok"
kernel="/kernel"
kernel_options=""
kernelname="/kernel"
loaddev="disk0s2a:"
root_disk_unit="0"
vfs.root.mountfrom="ufs:/dev/ad0s2a"
# 

The other slice is ad0s1.

And I checked, the kernel that's running actually did make it out of
that slice, and not the first one. 

> For picking the appropriate slice, you are up a creek all right.
> Assumably at some point you have to select a slice anyway, and you can use
> that to rewrite fstab.  Depending on the old compatibilty slice will
> certainly get you in hot water.

It would be just fine to have the boot0 boot manager be the mechanism
to do all this.  That's an easy toggle between the two alternatives,
though harder to do an automatic fallback, perhaps.

> I've been thinking about hacking up some forth to handle this switching
> programatically, so you get a nice menu to pick which FreeBSD slice to
> boot from if you enable the feature.

Where this mechanism might be useful is to detect abnormal shutdowns
(too many, too quickly) and use that to backup to the other partition.
I dunno, that might be more complicated and automagic than I need
for the moment, since the software seems fairly stable, and the hardware
is accessable for manual diddling if necessary.

I'm wondering if just generating the fstab on the fly might be
sufficient; I should be able to use kenv to get the vfs.root.mountfrom
loader variable (which strangely enough, isn't exported as a sysctl)
and go from there.

Hmm..

louie


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




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