Importing a pool not visible in the UI

After quite a number of times trying to apply my not inconsiderable google-fu, I finally figured out how to import a ZFS pool that is not visible in the UI. To be sure, the problem did not seem to be with the pool itself as I was able to import it from the CLI without any issues. It just would not show up in the GUI when trying to add it as an existing pool. I found a few posts with the same issue but no solution other than importing with various options, exporting, rebooting, crossing fingers, and finally having success. None of these steps worked for me.

What eventually put me on the right track was a post here on this forum that I am not able to link to directly (path is /t/cli-commands-of-pool-import-and-export/25875/2). The suggested approach uses the middleware API tool midclt, specifically:

sudo midclt call pool.import_pool '{"guid":POOLGUID}'

However, midctl was not able to give me the guid of the pool, which I eventually obtained using

sudo zpool get guid POOL

For this to work, the pool had to be imported but the midctl command did not seem to mind and the pool finally showed up in the GUI under Storage → Pools, no reboot needed.

Hoping that this helps others in a similar situation.

I’m curious, what is the history of this pool? How was it created, and so on?

The pool was originally part of another system that I migrated to a new server with a brand new installation, reusing the configuration. It showed up originally and I migrated the data onto a new pool with larger disks. I usually do most of this work on the CLI, including creating volumes etc., but that probably has nothing to do with it. What may have made the pool invisible was that I eventually renamed it to POOL_OLD and renamed POOL_NEW to POOL using the CLI, although I am not sure.