Re: difficulties replacing a ZFS installer zroot pool with a new zroot pool on a new disk

From: Russell L. Carter <rcarter_at_pinyon.org>
Date: Wed, 30 Mar 2022 23:24:55 UTC
On 3/30/22 16:09, Tomasz CEDRO wrote:
> On Thu, Mar 31, 2022 at 12:48 AM Russell L. Carter wrote:
>> I installed the new NVMe SSD drive and I was able to boot the USB
>> install image and install a new FreeBSD system on it.  On reboot I
>> first tried keeping the old SATA drive as it was.  However the
>> motherboard BIOS (CSM enabled, legacy, ASUS Prime X570-PRO) refused
>> all of my efforts to set the boot drive to the new SSD.  I finally
>> resorted to disconnecting the data cable of the old SATA drive, and
>> the new SSD booted fine.  I then powered down the motherboard,
>> reattached the old SATA data cable, and booted.  The motherboard again
>> refused to boot the new NVMe SSD.  After about an hour of fighting the
>> BIOS, I gave up, set the SATA drive as "hot pluggable" in the BIOS,
>> and rebooted with the SATA data cable disconnected.  Once the NVMe SSD
>> was booted, I reattached the SATA data cable and it showed up in the
>> 'zpool import' list.  'zpool import zroot' was not a happy solution as
>> it collided with the new SSD zroot pool.
>>
>> I eventually worked out that I should rename the old pool zroot.old on
>> import.  That was also not a happy solution as it continued to
>> automatically mount itself on top of the new SSD zroot pool.  I then
>> worked out that I need to specify an altroot:
> 
> * I had a similar situation.
> * I exported old pool and disconnected all old disks.
> * I have connected only nvm disk and did clean install on it using
> `znvd` in place of `zroot`.
> * When new install on a new disk was working fine, power off, connect
> old disks, import `zroot`, change mountpoint with `zfs set
> mountpoint=/zroot/something zroot/something`.
> 
> * Remember not to use different pools with the same name (i.e. `zroot`).
> * You can also rename pool of the old disks and name new disk pool to
> zroot to avoid boot problems.
> * You can use shell from installer drive to manipulate pools easily as
> the are not /.
> 
> Hope that helps :-)
> 

Yeah, the crux of the matter is getting those pools named differently.
I did not notice how to get the new pool renamed during the install,
must be in the partition menu?  I am not afraid of the 'for experts'
option but tend to use guided just to be standard.  And I haven't had
to fight a BIOS like this instance in a very long time.  It's a new
motherboard, new problems, life goes on.

I am also going to examine carefully what I can do
when dropping to the shell at the end of the install, as you and
David Christensen suggest.

This was my first "ZFS working pool replace underlying drive" exercise.
I have easily replaced maybe 6 ZFS RAID drives over the last 7 years
or so.

Still, I remain puzzled about the power of

zfs mount oldpool/ROOT/default


The main problem here is that I did not understand how all the zpool
naming/import/mounting stuff interacted with the standard FreeBSD
install scheme.  So I wasn't at all prepared for the complications.
Oh, yeah, now bring it on  :-)

Thanks,
Russell