Re: BIOS/MBR drive enumeration order, FreeBSD dev nodes, GELI ZFS root, and ZFS boot

From: Erich Dollansky <freebsd.ed.lists_at_sumeritec.com>
Date: Tue, 21 Jun 2022 08:03:37 UTC
Hi,

On Mon, 20 Jun 2022 23:24:44 -0700
David Christensen <dpchrist@holgerdanske.com> wrote:

> > On Mon, 20 Jun 2022 11:35:01 -0700 David Christensen wrote:
> >   
> >> freebsd-questions:
> >>
> >>
> >> I have a desktop computer:  
> 
> 
> >> When I boot the machine, I see a prompt:
> >>
> >>       GELI Passphrase:
> >>
> >>
> >> If I enter the correct passphrase, boot succeeds.
> >>
> >>
> >> If I enter an incorrect passphrase, I see another prompt later in
> >> boot:
> >>
> >>       Enter passphrase for ada0s1d:
> >>
> >>
> >> Note that "ada0" corresponds to the device node name of the SSD
> >> when FreeBSD was installed.
> >>
> >>
> >> If I enter the correct passphrase, boot continues and succeeds.
> >>
> >>
> >> I would now like to use the computer to examine an EIDE HDD.
> >>
> >>
> >> I have installed a HBA:
> >>
> >>       Promise Technology Ultra 133 TX2
> >>
> >>
> >> Connected the HDD to the HBA:
> >>
> >>       Maxtor 6L200P0
> >>
> >>
> >> And set the CMOS Setup boot order so that the SSD is before the
> >> HDD.
> >>
> >>
> >> When I boot the machine I see the first prompt:
> >>
> >>       GELI Passphrase:
> >>
> >>
> >> No matter what passphrase I enter, I always see the second prompt:
> >>
> >>       Enter passphrase for ada1s1d:
> >>
> >>
> >> Note that "ada1" no longer corresponds to the device node name of
> >> the SSD when FreeBSD was installed.  (I suspect the HDD is "ada0".)
> >>
> >>
> >> No matter what passphrase I enter at the second prompt, it is
> >> always rejected.  FreeBSD will not boot.  
> 
> 
> On 6/20/22 22:37, Erich Dollansky wrote:
>  > Hi,
>  >
>  > allow me a general answer on top: FreeBSD has support for labels.
>  > Just give each partition a name and use the partitions via their
>  > names. This works then even if you move the devices to other
>  > machines.  
> 
> 
> Thank you for the reply.
> 
> 
> I have several older machines in my SOHO network.  BIOS/MBR is the 
> lowest common denominator, so that is what I use.  AIUI MBR does not 
> support partition labels, only GPT.
> 
GEOM and UFS also support labels. It should not matter then what
BIOS/MBR thinks of the disk.
> 
> I seem to recall that it is possible to slice/ partition the boot/
> root drive with a hybrid MBR/ GPT scheme such that BIOS thinks the
> drive is MBR but the FreeBSD boot loader switches to GPT at some
> point (?).  Can this be achieved with the FreeBSD installer per
> "Guided Partitioning Using Root-on-ZFS"?
> 
> https://docs.freebsd.org/en/books/handbook/bsdinstall/#bsdinstall-partitioning
> 
I use gpart by hand like this:

	gpart destroy -F Device
	gpart create -s GPT Device
	gpart destroy -F Device
	gpart create -s MBR Device
	gpart bootcode -b /boot/mbr Device
	gpart add -t freebsd -i 1 Device
	gpart set -a active -i 1 Device
	gpart destroy -F Devices1
	gpart create -s GPT Devices1
	gpart destroy -F Devices1
	gpart create -s BSD -n 10 Devices1
	gpart bootcode -b /boot/boot Devices1
	gpart add -t freebsd-ufs -a 4k -s 1G Devices1
	glabel label root Devices1a
	newfs -S 512 /dev/label/root
	gpart add -t freebsd-swap -a 4k -s 16G Devices1
	glabel label swap Devices1b

I repeat then:

	gpart add -t freebsd-ufs -a 4k -s xxG Devices1
	glabel label Devices1a
	newfs -S 512 /dev/label/xxx

until all required partitions are done. I ZFS is used, I do not use
newfs but the ZFS tool.

Erich