Date: Wed, 3 Dec 2014 23:31:14 +1100 (EST) From: Bruce Evans <brde@optusnet.com.au> To: =?utf-8?Q?Jos=C3=A9_Mar=C3=ADa_Alcaide?= <josemaria.alcaide@ehu.es> Cc: freebsd-fs@freebsd.org Subject: Re: Using boot0 to redirect booting to another disk? Message-ID: <20141203223116.J43917@besplex.bde.org> In-Reply-To: <27E65CD9-4C97-4528-B218-A01EDB1B8CB1@ehu.es> References: <27E65CD9-4C97-4528-B218-A01EDB1B8CB1@ehu.es>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 3 Dec 2014, [utf-8] Jos=C3=A9 Mar=C3=ADa Alcaide wrote: > I have an HP Proliant Microserver Gen8. Nice machine but picky BIOS. When= its hard disk controller is configured in SATA AHCI mode, there is no way = to choose the boot disk among those connected to the SATA ports. I have fou= r HDD attached to the backplane, and another drive connected to a fifth SAT= A port originally intended for an optical drive. The four HDD are arranged = in a RAIDZ. Currently the machine is booting from an USB flash device, but = I would like to boot the FreeBSD installed on fifth drive. The disk control= ler sees and reports the five disks just fine, but as I said above, there i= s no way to choose the fifth disk as a boot device. > > I wondered whether I could use boot0 to redirect the boot from a USB flas= h device (pendrive or, still better, a microSD) to the fifth drive. The ide= a comes from the fact that boot0 shows a "F5 - Drive 2" option when it dete= cts more than one drive. I tried to understand how boot0 works reading its = source code, and I experimented with the boot0cfg's "-d disk" and "-o setdr= v" options, to no avail. So I decided to ask for help. :) > > Is that possible? Any help will be greatly appreciated. boot0 wants to chain to the next drive by loading the boot block (which contains the new boot program and partition table). Loading a new boot program is usually exactly what is not wanted. It means that to boot from the fifth drive (Drive 4 (?)) starting from the first drive (Drive 0 (?)), you not only have to hit F5 4 times, but you must put a FreeBSD boot0 on all disks chained through. Even when you know this, it is easy to forget it and chain to nowhere (a data disk with a dummy boot block on it), or better yet, to a disk with a Windows boot loader on it that forcinly boots Windows). The BIOS must support all the disks chained through and the final boot disk of course. Your best chance using boot0 is to get the BIOS to boot from the 4th drive so that the 5th drive is only 1 chaining step away. Removable drives probably wouldn't work well for this. They might be numbered after the 5 fixed drives so they would be even further away. Perhaps the BIOS renumbers all the drives, especially when you don't want it to. I don't see how -d drive can work for removable or renumbered drives. It just allows (when -o setdrv is also configured) overriding the default drive number. There is no standard way to determine to current drive number and it is sometimes misguessed. -d drive -o setdrv gives a way to force a fixed number. But when the drive is removable or renumbered, no fixed number can work. -d is also useless for booting from the 5th drive starting from another drive, except possibly using hacks like giving the drives the same partition table -- then the current partition table is correct for the new drive and lieing to the BIOS about the current drive number makes it load the next boot block (normally boot2) from the new drive. This bug is partly due to boot0 being optimized for space. It uses almost identical code to chain to the next drive as it does to chain to a boot block on the current drive. More practically, don't use boot0 for this. Boot as far as boot2 from some drive supported for booting by the BIOS, then go from there to the final drive. This requires a tiny FreeBSD file system on the boot drive to hold /boot.config. Bruce From owner-freebsd-fs@FreeBSD.ORG Wed Dec 3 13:37:33 2014 Return-Path: <owner-freebsd-fs@FreeBSD.ORG> Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7F7682CB for <freebsd-fs@freebsd.org>; Wed, 3 Dec 2014 13:37:33 +0000 (UTC) Received: from smtp.ehu.es (smtp.lg.ehu.es [158.227.0.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 05B118B9 for <freebsd-fs@freebsd.org>; Wed, 3 Dec 2014 13:37:32 +0000 (UTC) Received: from smtp.ehu.es (localhost.localdomain [127.0.0.1]) by postfix.imss71 (Postfix) with ESMTP id 037A88B8A; Wed, 3 Dec 2014 14:37:29 +0100 (CET) Received: from ncc-1701.we.lc.ehu.es (ncc-1701.we.lc.ehu.es [158.227.6.85]) by smtp2 (Postfix) with ESMTPSA id D74708B55; Wed, 3 Dec 2014 14:37:28 +0100 (CET) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 8.1 \(1993\)) Subject: Re: Using boot0 to redirect booting to another disk? From: =?utf-8?Q?Jos=C3=A9_Mar=C3=ADa_Alcaide?= <josemaria.alcaide@ehu.es> In-Reply-To: <20141203223116.J43917@besplex.bde.org> Date: Wed, 3 Dec 2014 14:37:28 +0100 Content-Transfer-Encoding: quoted-printable Message-Id: <C19CB436-7C2D-467A-A43F-2E4DE1339577@ehu.es> References: <27E65CD9-4C97-4528-B218-A01EDB1B8CB1@ehu.es> <20141203223116.J43917@besplex.bde.org> To: Bruce Evans <brde@optusnet.com.au> X-Mailer: Apple Mail (2.1993) X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4 (smtp2); Wed, 03 Dec 2014 14:37:28 +0100 (CET) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4 (postfix.imss71); Wed, 03 Dec 2014 14:37:29 +0100 (CET) Cc: freebsd-fs@freebsd.org X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Filesystems <freebsd-fs.freebsd.org> List-Unsubscribe: <http://lists.freebsd.org/mailman/options/freebsd-fs>, <mailto:freebsd-fs-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/freebsd-fs/> List-Post: <mailto:freebsd-fs@freebsd.org> List-Help: <mailto:freebsd-fs-request@freebsd.org?subject=help> List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-fs>, <mailto:freebsd-fs-request@freebsd.org?subject=subscribe> X-List-Received-Date: Wed, 03 Dec 2014 13:37:33 -0000 > El 3/12/2014, a las 13:31, Bruce Evans <brde@optusnet.com.au> = escribi=C3=B3: >=20 > On Wed, 3 Dec 2014, [utf-8] Jos=C3=A9 Mar=C3=ADa Alcaide wrote: >=20 >> I have an HP Proliant Microserver Gen8. Nice machine but picky BIOS. = When its hard disk controller is configured in SATA AHCI mode, there is = no way to choose the boot disk among those connected to the SATA ports. = I have four HDD attached to the backplane, and another drive connected = to a fifth SATA port originally intended for an optical drive. The four = HDD are arranged in a RAIDZ. Currently the machine is booting from an = USB flash device, but I would like to boot the FreeBSD installed on = fifth drive. The disk controller sees and reports the five disks just = fine, but as I said above, there is no way to choose the fifth disk as a = boot device. >>=20 >> I wondered whether I could use boot0 to redirect the boot from a USB = flash device (pendrive or, still better, a microSD) to the fifth drive. = The idea comes from the fact that boot0 shows a "F5 - Drive 2" option = when it detects more than one drive. I tried to understand how boot0 = works reading its source code, and I experimented with the boot0cfg's = "-d disk" and "-o setdrv" options, to no avail. So I decided to ask for = help. :) > >> Is that possible? Any help will be greatly appreciated. >=20 > boot0 wants to chain to the next drive by loading the boot block = (which > contains the new boot program and partition table). Loading a new = boot > program is usually exactly what is not wanted. It means that to boot > from the fifth drive (Drive 4 (?)) starting from the first drive = (Drive 0 > (?)), you not only have to hit F5 4 times, but you must put a FreeBSD > boot0 on all disks chained through. Even when you know this, it is > easy to forget it and chain to nowhere (a data disk with a dummy boot > block on it), or better yet, to a disk with a Windows boot loader on = it > that forcinly boots Windows). Yes, after reading boot0.S I suspected that it worked in that way. I was = even thinking about modifying boot0.S in order to go straight to the = fifth drive. > Your best chance using boot0 is to get the BIOS to boot from the 4th > drive so that the 5th drive is only 1 chaining step away. Removable > drives probably wouldn't work well for this. They might be numbered > after the 5 fixed drives so they would be even further away. Perhaps > the BIOS renumbers all the drives, especially when you don't want it > to. The BIOS does not permit that. If the SATA AHCI controller is selected = as boot device, it reads the first sector only from the first SATA disk. > More practically, don't use boot0 for this. Boot as far as boot2 from > some drive supported for booting by the BIOS, then go from there to = the > final drive. This requires a tiny FreeBSD file system on the boot > drive to hold /boot.config. In fact that was my first approach to this problem: I created a MBR = table (with MBR boot sector), a active slice, a BSD label inside, a BSD = partition and the boot1+boot2 code, and a tiny file system with = /boot.config. However, I was not able to redirect the boot using the = syntax bios_drive:interface(unit,[slice,]part)filename Surely I was using it in the wrong way. Also, ideally I would like to = use GPT in the fifth disk, and I'm afraid that boot2 doesn't support = booting from GPT partitions (or it does?). Thank you very much! -- Jose M. Alcaide=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20141203223116.J43917>