Rebuilding Nixos on ZFS root System with new rpool

I am in the process of replacing my old rpool with a new one. I currently have a mirrored bpool on 2 disks, and rpool on separate disks.

I have my old config (flake) - the boot disks are the same, and I should be able to import the new rpool (same pool name).

What is the best way to go about an install with my extant config? I looked to Nixos root on ZFS but I don’t get inspiration for an approach.

I think it should be simple, but I’m not seeing it, so any pointers appreciated.

Shouldn’t you just make the new pool and datasets, mount the datasets, copy the nix config, regenerate hardware-configuration.nix and nixos-install?

That’s the approach I tried - but I got errors (sorry cannot remember - grappling with work IT since 5am). I’ll take a rest and try again…perhaps just a misstep.

For a reinstall, you shouldn’t need to import the old rpool at all. Perhaps you’re using it as the place to pull your flake from, or other small bits of config (like host keys), or more extensive data (like user data). In that case you want something like:

zpool import -R /mnt2 -t <old rpool pool id> rpool-old

using the pool id and a temporary name to avoid name and path conflicts.

Of course, once you’ve imported both pools like this, you could also send a full recursive snapshot from old to new pool, depending on how much your preference is ‘reinstallation’ versus ‘rearrangement’.

Thanks all - just fat fingers which led to wobbly partitions…