Using boot0 to redirect booting to another disk?

José María Alcaide josemaria.alcaide at ehu.es
Wed Dec 3 13:37:33 UTC 2014


> El 3/12/2014, a las 13:31, Bruce Evans <brde at optusnet.com.au> escribió:
> 
> On Wed, 3 Dec 2014, [utf-8] José María 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 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.
>> 
>> 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.
> 
> 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


More information about the freebsd-fs mailing list