How to make Ubuntu dual-boot reinstall with zfs-on-root?
Andrew Henderson
I am using a Ubuntu system (19.10) with zfs as the root file system.
I installed the system as a dual-boot system by installing on a smaller disk and transferring the partitions to a larger disk afterwards with Windows partitions already on it, so the gpt partition scheme has the following partitions now:
part 1 - UEFI boot - /boot/efi
part 2 - Grub boot partition - /boot/grub
part 3 - swap
part 4 - zfs boot (bpool)
part 5 - zfs root (rpool)
part 6 - Windows MSR
part 7 - Windows System
part 8 - Windows RE
So, I would like to reinstall the system for unrelated reasons now. I am even willing to test 20.04 if it's more flexible. How can I best reinstall the system? The plain Ubuntu installer doesn't know about zfs, and the zfs option only works on the whole disk.
In other words, I want to install Ubuntu again, with part 3 - 5 open to deletion / formatting, the others should be untouched.
1 Answer
The easiest way to install Ubuntu with root as zfs I have come up with so far is this:
- Do a default zfs install (with full disk erasure) on a virtual machine
- Erase your two old partitions on the physical computer
- create two new partitions on the physical computer which start at the same starting points as the old ones and have sizes equal to the sizes of the corresponding
rpoolandbpoolpartitions on the VM - Copy the two partitions from VM to physical computer with
ddover network or removable media - Adjust UUIDs in
/etc/fstabon the physical computer according to the new values - Boot into new Ubuntu, probably manually specifying
rootandlinuxparameters at thegrub>prompt - Make sure
/bootand/boot/efiare mounted correctly grup-install && reboot- Use
partedto expand partitions to their full size (or however large you want them to be) - Use
zpool online -eto expand the pools to the full partition size - Done