Warner Losh
2016-Oct-21 14:41 UTC
boot0cfg on does not set default selection on gmirror device
On Fri, Oct 21, 2016 at 5:39 AM, Patrick M. Hausen <hausen at punkt.de> wrote:> Hi, all, > > we are repeatedly bitten by the following misbehaviour of boot0cfg: > > root at hd45:/usr/local # boot0cfg -s 1 mirror/m0 > root at hd45:/usr/local # boot0cfg -v mirror/m0 > # flag start chs type end chs offset size > 1 0x80 1: 0: 1 0xa5 1022:254:63 16065 16418430 > 2 0x00 1023: 0: 1 0xa5 1020:254:63 16434495 16418430 > 3 0x00 1021: 0: 1 0xa5 768:254:63 32852925 1920667140 > > version=1.0 drive=0x80 mask=0xf ticks=182 bell= (0x7) > options=packet,update,nosetdrv > default_selection=F2 (Slice 2) > > So, while it should have set the default to slice 1, it simply didn't. > > gpart on the other hand works as expected: > > root at hd45:/usr/local # gpart set -a active -i 1 mirror/m0 > active set on mirror/m0s1 > root at hd45:/usr/local # gpart show mirror/m0 > => 63 1953525104 mirror/m0 MBR (932G) > 63 16002 - free - (7.8M) > 16065 16418430 1 freebsd [active] (7.8G) > 16434495 16418430 2 freebsd (7.8G) > 32852925 1920667140 3 freebsd (916G) > 1953520065 5102 - free - (2.5M) > > But the "active" flag alone is not enough to convince boot0 to actually boot that partition. > > Additional info: > > root at hd45:/usr/local # uname -a > FreeBSD hd45.hosting.punkt.de 10.3-RELEASE-p10 FreeBSD 10.3-RELEASE-p10 #0 r306942: Mon Oct 10 10:29:14 UTC 2016 root@:/usr/obj/nanobsd.hosting/usr/src/sys/GENERIC amd64 > root at hd45:/usr/local # gmirror status > Name Status Components > mirror/m0 COMPLETE ada0 (ACTIVE) > ada1 (ACTIVE) > > > The only way to actually switch the boot0 default selection is: > > root at hd45:/usr/local # sysctl kern.geom.debugflags=16 > kern.geom.debugflags: 0 -> 16 > root at hd45:/usr/local # boot0cfg -s 1 ada0 > root at hd45:/usr/local # boot0cfg -s 1 ada1 > root at hd45:/usr/local # boot0cfg -v mirror/m0 > # flag start chs type end chs offset size > 1 0x80 1: 0: 1 0xa5 1022:254:63 16065 16418430 > 2 0x00 1023: 0: 1 0xa5 1020:254:63 16434495 16418430 > 3 0x00 1021: 0: 1 0xa5 768:254:63 32852925 1920667140 > > version=1.0 drive=0x80 mask=0xf ticks=182 bell= (0x7) > options=packet,update,nosetdrv > default_selection=F1 (Slice 1) > > > Any hints what's going on, here? Obviously it is possible to manipulate > the MBR of a gmirror device - as gpart proves. The boot0cfg pops up > since FreeBSD 8 when we started using a mirrored NanoBSD setup.Any chance you can migrate to using gpart? Is boot0cfg still referenced in NanoBSD somewhere? Warner
Arrigo Marchiori
2016-Oct-21 14:55 UTC
boot0cfg on does not set default selection on gmirror device
Hello all, On Fri, Oct 21, 2016 at 08:41:33AM -0600, Warner Losh wrote:> On Fri, Oct 21, 2016 at 5:39 AM, Patrick M. Hausen <hausen at punkt.de> wrote: > > Hi, all, > > > > we are repeatedly bitten by the following misbehaviour of boot0cfg: > > > > root at hd45:/usr/local # boot0cfg -s 1 mirror/m0 > > root at hd45:/usr/local # boot0cfg -v mirror/m0 > > # flag start chs type end chs offset size > > 1 0x80 1: 0: 1 0xa5 1022:254:63 16065 16418430 > > 2 0x00 1023: 0: 1 0xa5 1020:254:63 16434495 16418430 > > 3 0x00 1021: 0: 1 0xa5 768:254:63 32852925 1920667140 > > > > version=1.0 drive=0x80 mask=0xf ticks=182 bell= (0x7) > > options=packet,update,nosetdrv > > default_selection=F2 (Slice 2) > > > > So, while it should have set the default to slice 1, it simply didn't. > > > > gpart on the other hand works as expected: > > > > root at hd45:/usr/local # gpart set -a active -i 1 mirror/m0 > > active set on mirror/m0s1 > > root at hd45:/usr/local # gpart show mirror/m0 > > => 63 1953525104 mirror/m0 MBR (932G) > > 63 16002 - free - (7.8M) > > 16065 16418430 1 freebsd [active] (7.8G) > > 16434495 16418430 2 freebsd (7.8G) > > 32852925 1920667140 3 freebsd (916G) > > 1953520065 5102 - free - (2.5M) > > > > But the "active" flag alone is not enough to convince boot0 to actually boot that partition. > > > > Additional info: > > > > root at hd45:/usr/local # uname -a > > FreeBSD hd45.hosting.punkt.de 10.3-RELEASE-p10 FreeBSD 10.3-RELEASE-p10 #0 r306942: Mon Oct 10 10:29:14 UTC 2016 root@:/usr/obj/nanobsd.hosting/usr/src/sys/GENERIC amd64 > > root at hd45:/usr/local # gmirror status > > Name Status Components > > mirror/m0 COMPLETE ada0 (ACTIVE) > > ada1 (ACTIVE) > > > > > > The only way to actually switch the boot0 default selection is: > > > > root at hd45:/usr/local # sysctl kern.geom.debugflags=16 > > kern.geom.debugflags: 0 -> 16 > > root at hd45:/usr/local # boot0cfg -s 1 ada0 > > root at hd45:/usr/local # boot0cfg -s 1 ada1 > > root at hd45:/usr/local # boot0cfg -v mirror/m0 > > # flag start chs type end chs offset size > > 1 0x80 1: 0: 1 0xa5 1022:254:63 16065 16418430 > > 2 0x00 1023: 0: 1 0xa5 1020:254:63 16434495 16418430 > > 3 0x00 1021: 0: 1 0xa5 768:254:63 32852925 1920667140 > > > > version=1.0 drive=0x80 mask=0xf ticks=182 bell= (0x7) > > options=packet,update,nosetdrv > > default_selection=F1 (Slice 1) > > > > > > Any hints what's going on, here? Obviously it is possible to manipulate > > the MBR of a gmirror device - as gpart proves. The boot0cfg pops up > > since FreeBSD 8 when we started using a mirrored NanoBSD setup. > > Any chance you can migrate to using gpart? Is boot0cfg still > referenced in NanoBSD somewhere?Ahem... For what it's worth... I cannot help not pointing this old PR out: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=186030 Best regards, -- rigo http://rigo.altervista.org
Patrick M. Hausen
2016-Oct-21 17:57 UTC
boot0cfg on does not set default selection on gmirror device
Hi, all,> Am 21.10.2016 um 16:41 schrieb Warner Losh <imp at bsdimp.com>: > Any chance you can migrate to using gpart? Is boot0cfg still > referenced in NanoBSD somewhere?Not in NanoBSD but how would you configure boot0's default slice with gpart? It doesn't pay attention to the "active" flag. See Miroslav's mails for all the details. gpart would only be an option if we did not use the FreeBSD boot manager. But we need the "F1 ..., F2 ..." prompt, because being able to roll back to the last known-good system via the console is the entire point of using this NanoBSD setup. There's a presentation on the EuroBSDCon 2010 page about motivation and setup. Wonder who did that talk ... :-))) BTW: thanks, Miroslav. As for your question: it does work on the only two systems that use hardware RAID, yet have a gmirror built of only a single component to get consistent device names accross all servers. I'm not quite sure if it works from time to time, I've come to accept the "kern.geom.debugflags" dance. I had opened a similar discussion years ago for 7.x/8.x and I was told that geom was to provide an API for fdisk, boot0cfg and friends to manipulate the MBR. Because back in the days boot0cfg and fdisk both threw an error message when trying to work on a whole-disk mirror. I thought that was long solved - at least no error, anymore. But it's still not working in 10.x. Thanks to all and take care, Patrick -- punkt.de GmbH * Kaiserallee 13a * 76133 Karlsruhe Tel. 0721 9109 0 * Fax 0721 9109 100 info at punkt.de http://www.punkt.de Gf: J?rgen Egeling AG Mannheim 108285