Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 6 Jul 2020 15:10:16 +0200 (CEST)
From:      Christian Kratzer <ck-lists@cksoft.de>
To:        freebsd-fs <freebsd-fs@freebsd.org>
Subject:   gptzfsboot targeting wrong vdev
Message-ID:  <alpine.BSF.2.22.395.2007061453250.82939@nocfra1.cksoft.de>

next in thread | raw e-mail | index | archive | help
Hi,

I have a couple of freebsd based zfs servers on 12.1-RELEASE-p6 that have zfs root and separate geli procted zfs data pools.

I have been booting these off usb sticks or sdcards with a copy of /boot
and the geli keys and then subsequently mounting root from the zfsroot pool.

 	root@zfs1:/home/ck # zpool list
 	NAME    SIZE  ALLOC   FREE  CKPOINT  EXPANDSZ   FRAG    CAP  DEDUP  HEALTH  ALTROOT
 	zp1    3.62T   242G  3.39T        -         -     3%     6%  1.00x  ONLINE  -
 	zp2    21.8T  13.2T  8.51T        -         -    13%    60%  1.00x  ONLINE  -
 	zroot   127G   112G  15.1G        -         -    30%    88%  1.00x  ONLINE  -
 	root@zfs1:/home/ck #

In above setup zroot is an unencrypted two ssd vdev with just the OS on it.

The disks for zp1 and zp2 are encrypted using geli via keys provided in loader.conf.

Above setup is working fine whilst I keep /boot on the usb stick.

I have tried again to get rid of the usb stick and booting directly from the mirror on zroot.

I have following in my loader.conf

 	# zfs
 	zfs_load="YES"
 	vfs.root.mountfrom="zfs:zroot/ROOT/default"
 	vfs.zfs.boot.primary_pool="17582686064334413803"
 	vfs.zfs.boot.primary_vdev="9317482241260982593"

I got the guid values using

 	root@zfs1:/usr/src # zpool get guid zroot
 	NAME   PROPERTY  VALUE  SOURCE
 	zroot  guid      17582686064334413803  default

 	root@zfs1:/usr/src # zfs get guid zroot/ROOT/default
 	NAME                PROPERTY  VALUE  SOURCE
 	zroot/ROOT/default  guid      9317482241260982593  -


I also have following setup on the devices that are part of zroot

 	root@zfs1:/home/ck # gpart show ada0
 	=>       40  468862048  ada0  GPT  (224G)
 		 40       1024     1  freebsd-boot  (512K)
 	       1064  134217728     2  freebsd-swap  (64G)
 	  134218792   33554432     3  freebsd-zfs  (16G)
 	  167773224   33554432     4  freebsd-zfs  (16G)
 	  201327656  267534424     5  freebsd-zfs  (128G)
 	  468862080          8        - free -  (4.0K)

 	root@zfs1:/home/ck #

When booting from ada0 I get following:

 	ZFS: i/o error - all block copies unavailable
 	ZFS: can't read MOS of pool zp1
 	gptzfsboot: failed to mount default pool zp1

 	FreeBSD/x86 boot

At least it seems that my bios is loading the zfs loader from the correct gpt partition.

But I cannot figure out why it is still trying to boot from zp1 and not zroot.

I have not been able to break out into the loader via serial console to inspect if those vfs values are really there.

I do see them if I boot via my usb stick copy of /boot

 	root@zfs1:/home/ck # kenv | grep vfs
 	vfs.root.mountfrom="zfs:zroot/ROOT/default"
 	vfs.zfs.boot.primary_pool="17582686064334413803"
 	vfs.zfs.boot.primary_vdev="9317482241260982593"
 	root@zfs1:/home/ck #

This should all be unrelated to geli as I only need the zroot pool mounted at this point in time which is unencrypted.

I am a bit lost at this stage and would have following questions if anybody can help me:

1. Am I getting the correct guid values for the primary_pool and _vdev or am I misundestanding the requirements ?

2. How can I break into the loader to inspect or set kenv values ?

3. Should I perhaps try exporting zp1 and zp2 so as only to have zroot visible ?

4. Can I try setting the vfs variables from /config ? How would the syntax for that be ?

Anything else I can do or check to get this to work ?

Greetings
Christian

-- 
Christian Kratzer                   CK Software GmbH
Email:   ck@cksoft.de               Wildberger Weg 24/2
Phone:   +49 7032 893 997 - 0       D-71126 Gaeufelden
Fax:     +49 7032 893 997 - 9       HRB 245288, Amtsgericht Stuttgart
Mobile:  +49 171 1947 843           Geschaeftsfuehrer: Christian Kratzer
Web:     http://www.cksoft.de/



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