How to install ZFS with differently-sized partitions

Ok, I've dug a bit deeper on this topic... when installing Zorin OS (or Ubuntu) with the ZFS file system, there's no GUI way to alter the partition sizes... you gets what you gets. A GUI is on the way, per the Ubuntu developers, but no time frame available.

But, there is a way... boot into the Zorin OS USB stick, and:

sudo su
gedit /usr/share/ubiquity/zsys-setup

We have to use sudo gedit, rather than sudoedit, because we're booted into the Zorin OS USB stick, and sudoedit brings up Nano, which isn't as easy to use as gedit. You can set up sudoedit to use gedit by default here.

Change line 240:

This is the size of the swap file. I set mine to double my RAM, or 24 GB.

Change line 250:
# bpool size: 500M < 5% of ZFS allocated space < 2G
# bpool size: 500M < 20% of ZFS allocated space < 10G

The above is just a comment, but it's best to update it so as to avoid confusion as you work.

Change line 252:
size_percent=$(expr \( $(blockdev --getsize64 ${partprefix}${partswap}) / 1024 / 1024 \) \* 5 / 100)
size_percent=$(expr \( $(blockdev --getsize64 ${partprefix}${partswap}) / 1024 / 1024 \) \* 20 / 100)

The above line checks the size of memory and changes swap file size accordingly, usually it's 5% of memory or a maximum of only 2 GB.

Change line 255:
[ ${bpool_size} -gt 2048 ] && bpool_size=2048
[ ${bpool_size} -gt 10240 ] && bpool_size=10240

Same with this line, but it sets the bpool size (rpool size is just whatever free space is left over after you've got all the other partitions set up).

Change line 263:
${partprefix}${partesp} : start= ${start}, size= 512M, type=C12A7328-F81F-11D2-BA4B-00A0C93EC93B, bootable
${partprefix}${partesp} : start= ${start}, size= 2048M, type=C12A7328-F81F-11D2-BA4B-00A0C93EC93B, bootable

And the same with the above line, which sets bpool size during formatting.

Change line 278:
${partprefix}${partesp} : start= ${start}, size= 512M, type=ef, bootable
${partprefix}${partesp} : start= ${start}, size= 2048M, type=ef, bootable

This should set the size of the very first partition, but it doesn't, and I can't figure out what does set its size. That's not really crucial, as the very first partition just holds the .EFI files that the system boots, so it doesn't have to be that big.

So now I've got:
Partition 1 (ESP): 522 MB
Partition 2 (SWAP): 24576 MB
Partition 3 (bpool): 10240 MB
Partition 4 (rpool): {the rest of the disk}

No more running out of space on bpool due to too many snapshots.

1 Like

Thanks! Been using Ubuntu 20.04 with ZFS Root for my main dev box since it came out and this was the biggest pain point.

1 Like