How can I reset the name of the ZFS dataset for LXD?

My LXC data was stored on a ZFS dataset. Since then, due to rearranging other things on the system, I had to move the LXC data to another ZFS dataset on another ZFS pool.

I cannot get LXD to recognize the new pool. I’m unable to start the daemon at all to mess with config, with the following error:

ERROR  [2023-03-17T21:50:56Z] Failed mounting storage pool                  err="ZFS zpool exists but dataset is missing" pool=default

That’s correct, the default pool is missing because it’s now in a different place. For example, it’s no longer at tank/lxc, but it’s now at submarine/lxc. Everything was moved over via ZFS replication.

For various reasons I can’t just put the data back on the tank pool, and in either case I don’t want it there anymore.

The thing that confuses me is that I tried manually editing the SQLite database at /var/lib/lxd/database/global/db.bin. I edited the records in storage_pools_config that point to tank/lxc to point to submarine/lxc. However, when I tried starting the LXD daemon, I got the same error, and the settings were reverted back to /tank/lxc in the db.bin file. Ultimately I can’t start the daemon at all, so the only other option I know of is to delete the entire database and start over, but I’d really rather not do that!

Where can I go to simply change the root path of the ZFS dataset for LXC without having to start everything all over again? It seems like moving the dataset should be possible offline, even if it means editing the database. But since changing the value in the database doesn’t seem to work and indeed it gets changed back, that value is also being stored somewhere else - where?

Thanks!

You will need to use a DB patch to modify the dqlite database at LXD start up, see

https://linuxcontainers.org/lxd/docs/master/database/#running-custom-queries-at-lxd-daemon-startup