Re: ZFS: How may I get rid of a zpool that has no extant devices?

From: David Wolfskill <david_at_catwhisker.org>
Date: Fri, 28 Jan 2022 17:23:24 UTC
On Fri, Jan 28, 2022 at 09:06:59AM -0800, Freddie Cash wrote:
> ...
> Did you do a "zpool destroy zroot" before partitioning the devices for use
> in the tank pool?  If not, that's why it thinks the zroot pool is still
> "available" as it sees the old ZFS label on the devices.

Right; I had not (run "zfs destroy zroot") -- I think.  (This was within
the installer -- first time I had used the installer in years...)

> ... 
> > How may I make "zroot" disappear?
> ...

> If nothing else works, the nuclear option is to run "zpool labelclear" on
> each of the devices used for the zroot pool.  That will remove the ZFS
> label from the disks, clear the GPT partition table and backup table, and
> render the device essentially "unformatted", ready for use.

I have (since) determined (using "zdb -l") that th eonly vestige of
zroot is on /dev/ada0.

> As you aren't using ZFS on ada0, you might be able to run "zpool
> labelclear" on just that device to make it disappear, as you have proper
> ZFS labels on the other drives for tank.
> .....

OK; thanks.

Success:

freetest(12.3-S)[22] sudo zpool labelclear /dev/ada0
failed to open /dev/ada0: Operation not permitted
freetest(12.3-S)[23] sysctl kern.geom.debugflags
kern.geom.debugflags: 0
freetest(12.3-S)[24] sudo !!=16
sudo sysctl kern.geom.debugflags=16
kern.geom.debugflags: 0 -> 16
freetest(12.3-S)[25] sudo zpool labelclear /dev/ada0
use '-f' to override the following error:
/dev/ada0 is a member of potentially active pool "zroot"
freetest(12.3-S)[26] sudo zpool labelclear -f /dev/ada0
freetest(12.3-S)[27] sudo zpool import
freetest(12.3-S)[28]  

[Caution in case anyone is tempted to do the above: please be careful,
especially if you are working with precious data.  In my case, it's just
a headless build machine that I am still in the process of setting up,
so a problem would have been annoying, but hardly a catastrophe.]

Peace,
david
-- 
David H. Wolfskill                              david@catwhisker.org
Republican Senators had two chances to hold Donald Trump accountable
for his malfeasance in office during his term -- and utterly failed.

See https://www.catwhisker.org/~david/publickey.gpg for my public key.