Install Zorin OS 16 with ZFS file system without wiping drive?

I learn by doing, so I did.

I took my machine back to bare metal... I booted the Zorin OS USB stick, removed the internal drive's partitions, and used sudo dd if=/dev/zero of=/dev/sdxX bs=512 status=progress to zero all the sectors on the internal drive, on the ZFS L2ARC cache drives for the bpool and rpool, for the second swap drive partition, and for the ZFS mirror of the internal drive's rpool.

IOW, the machine had nothing on the system drives.

Then I partitioned, formatted and labelled the internal drive partitions using gdisk and GParted to ensure the drive had a proper GPT setup:
[sda1, 10 GB, EFI FAT32, label "Filesystem"]
[sda2, 20 GB, Linux Swap, label "Swap"]
[sda3, 10 GB, Solaris Boot, label "bpool"]
[sda4, remainder of drive space, Solaris Root, label "rpool"]

The defaults are:
[sda1, 537 MB, EFI FAT32, label "Filesystem"]
[sda2, 2.1 GB, Linux Swap, label "Swap"],
[sda3, 2.1 GB, Solaris Boot, label "bpool"]
[sda4, remainder of drive space, Solaris Root, label "rpool"]

Basically, an identical partition setup as the original installation, just bigger partitions for sda1, sda2 and sda3.

But when I start the "Install Zorin OS 16" link (ubiquity.desktop), there is no option to install Zorin OS with the ZFS file system without wiping the drive.

How do I do it? Is there a manual installation procedure? Is there a command-line flag I can use to tell the installation process that the drive's already set up properly?

Basically, what I'm trying to fix is this...

For the default ZFS installation done by ubiquity.desktop, sudo gdisk and enter /dev/sda1 (the internal drive), then press v to verify, I get:

Found invalid GPT and valid MBR; converting MBR to GPT format
in memory. THIS OPERATION IS POTENTIALLY DESTRUCTIVE! Exit by
typing 'q' if you don't want to convert your MBR partitions
to GPT format!

With my method, a proper GPT partition table is put onto the drive, and it shows:

sudo gdisk
GPT fdisk (gdisk) version 1.0.5

Type device filename, or press <Enter> to exit: /dev/sda
Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with protective MBR; using GPT.

Command (? for help): v

No problems found.

If one opens the "Install Zorin OS 16.2" (ubiquity.desktop) in Text Editor, there's the line:

sudo --preserve-env=DBUS_SESSION_BUS_ADDRESS,XDG_RUNTIME_DIR sh -c 'ubiquity gtk_ui'

That's what starts the installation process. Is there a command line flag to tell it to skip setting up the hard drive, to assume it's already set up?

I don't know much about ZFS or GPT to be honest but in my dim distant memory I have always used the 'something else' method, left some partitions without formatting, but just marked the partitions with the correct flags (/home and swap) but then overwrite / with the new install and always using Ext4. My only other query is your use of a swap file which should not be present if installing to SSD.

In /usr/lib/ubiquity/ubiquity/frontend/gtk_ui.py, there's a flag:

self.partitioned = False

Then further on in that file:

def maybe_start_installing(self):
        if not (self.partitioned and self.timezone_set):
            syslog.syslog(
                'Not installing yet, partitioned: %s, timezone_set %s' %
                (self.partitioned, self.timezone_set))
            return

Is that the flag to stop the ubiquity.desktop from running the hard drive partitioning routines?

Right below that is where ZFS installation and system installation starts:

# Setup zfs layout
        use_zfs = self.db.get('ubiquity/use_zfs')
        if use_zfs == 'true':
            misc.execute_root('/usr/share/ubiquity/zsys-setup', 'init')

        syslog.syslog('Starting the installation')

Alright, I'm just going to hack my way through this.

In /usr/lib/ubiquity/ubiquity/frontend/gtk_ui.py:

# CHANGED BY ME 12 DEC 2022
        self.partitioned = True
#        self.partitioned = False
# CHANGED BY ME 12 DEC 2022
#        use_zfs = self.db.get('ubiquity/use_zfs')
        use_zfs = 'true'
        if use_zfs == 'true':
            misc.execute_root('/usr/share/ubiquity/zsys-setup', 'init')

I'm going to try to run ubiquity.desktop. Wish me luck.

Good Luck! I never mess with code!

Mheh... didn't work. There's a second copy of that file on the Zorin OS boot USB (which is read-only) that can't be changed. I suspect ubiquity.desktop (the installation process) uses that read-only file.

Ok, I'm going to let the install go through as normal, then try to resize the partitions and set the drive up as proper GPT.

Well, the ZFS bpool and rpool partitions can't be shrunk.

This is something Team Zorin is going to have to address, I guess.

Strange... Team Zorin must have already addressed that. After I booted, I tested that again, and it gets the same response as my manual setup.

Now it's just a matter of getting the installer to recognize when you've already pre-configured the partitions, and uses those instead of wiping the disk... or at least lets you set the size of each partition it sets up before it wipes the disk.