GCP ZFS-on-Root (working, and some questions)

From: Pat Maddox <pat_at_patmaddox.com>
Date: Sat, 30 Jul 2022 22:07:23 UTC
Hey there, I have taken some of the concepts and scripts that Colin used 
to make the AWS AMI Builder (thank you!!), and used them to configure a 
ZFS-on-Root image for GCP.

Here’s the script: 
https://gist.github.com/patmaddox/1a0be973ecfce4f056c517abb7746286

I did it slightly differently from the AMI builder. Instead of working 
in a mem disk, I just fetch base.txz and expand it to a dir, edit the 
files, etc.

One other difference is that because base.txz doesn’t include a 
kernel, I `cp -Rp /boot/kernel/ /mnt/boot/kernel/`.

It boots, I can SSH and do all the usual things, so far I am very happy.

My questions:

1. Is there anything I might be missing with the approach of extracting 
base.txz, and copying over the current instance’s kernel?
2. If I change the GCP disk size and reboot, the partition table is 
corrupt. I need to `geom part recover da0 && geom part resize -i 2 da0` 
to resize it. How can I have that happen automatically during the boot 
process, the way that the AMI does?

Pat