Solved bsdinstall disables GPT identification for guided ZFS install

memreflect

Member

Reaction score: 54
Messages: 99

When you install FreeBSD using the Auto ZFS option, GPT labels and GPT UUIDs are disabled in loader.conf(5):

Code:
kern.geom.label.disk_ident.enable="0"
kern.geom.label.gptid.enable="0"
The only reference to labels being disabled that I could find is from a 5-year-old PC-BSD bug report complaining that PC-BSD doesn't install properly on a multiboot machine, which makes sense if the installer doesn't feature a partition editor to customize which partition onto which you install FreeBSD. However, I have yet to find a reason for GPT UUIDs also being disabled as neither the commit message nor the comments above it indicate a problem with leaving them enabled.

As ZFS uses GUIDs already, it isn't a big deal that these are disabled until you shuffle disks around, and suddenly a UFS filesystem won't mount because it has been assigned a different geom identifier (e.g. ada7p2 becomes ada3p2). But if you're not on a multiboot system, then it should be safe to re-enable both of these settings, right? Or is there some other reason they're still disabled by default?
 
OP
M

memreflect

Member

Reaction score: 54
Messages: 99

So as it turns out, the GPT stuff isn't displayed.

With geom_label_enable="YES" in /boot/loader.conf, the /dev/gpt and /dev/gptid directories are populated, but the only things in there are the EFI System Partitions and freebsd-boot partitions in my mirrored BIOS+UEFI setup:

Code:
ROOT ~# ls /dev/gpt
efiboot0 efiboot1 gptboot0 gptboot1
My guess is that when the root ZFS system is found and booted, it seems like it takes over the GEOM providers required, essentially rendering GPT labels on ZFS partitions almost useless. I say "almost" because once a GEOM device provider is not in use, such as when you execute something like zpool detach zroot ada1p4, you can see the GEOM label provider (assuming geom_label.ko is loaded and one or both of the tunables mentioned in the original post is nonzero), which means you can add it to the pool by GPT label/ID instead of by the GEOM device provider name:

Code:
ROOT ~# zpool detach zroot ada1p4
ROOT ~# ls /dev/gpt
efiboot0 efiboot1 gptboot0 gptboot1 zfs1
ROOT ~# zpool attach zroot ada0p4 gpt/zfs1    # or gptid/`gpart list ada1 | sed -n '/ada1p4/,/rawuuid/p' | awk '/rawuuid/{print $2}'`
After that, zpool status should display your newly added vdev instead of the GEOM name. Detaching and reattaching the vdev unfortunately requires a resilver, but it could be worth it in some cases. I feel it is also worth mentioning to ZFS newbies like myself that if you want to do this for all of the vdevs in the pool, you'll want to detach and reattach them in their original order, else you'll see things like gpt/zfs1 before gpt/zfs0 when you use zpool status. This may not matter to you, but I just prefer things to be in order. ;)
 
Top