Deleted ZFS volume still appearing in `lxc storage volume list`

I still not have moved to Incus, please let me know if there is a problem asking a question here for LXD.

After an interrupted evacuate, I found my system in a strange state, where zfs and lxd did not agree on volumes.
At first, the evacuate interruption made the VM duplicated on two cluster members. I did not notice this until we restarted the VM, and found the state of the VM 2 months back in time. I made a snapshot of the filesystem, created a new vm, restored the snapshot on the new VM and attempted to delete the old buggy VM. The deletion appears to work, but in the end lxc storage volume list tank and zfs list were still mentioning the old VM volume. I deleted it with zfs delete tank/container/oldvolume but it still appears in lxc storage volume list tank.

How to force lxc storage volume list tank to agree with ZFS?

Thank you

Most likely you’re going to have to do a bit of DB surgery.

You can use lxd sql global "SELECT * FROM storage_volumes" to get a list of the storage volumes in the database. You can use lxd sql global "DELETE FROM storage_volumes WHERE id=XYZ to delete a specific row.

Thank you!

How to interact with sql through incus?
incus sql is not implemented yet?

Found out!

incus admin sql
is the way.

1 Like