Delete unavailable LXD/zfs storage

Hello,
I have remnants from old zfs pool which was removed before, but it’s still visible in lxd:

$ lxc storage list
+---------+--------+-------------+-------------+---------+-------------+
|  NAME   | DRIVER |   SOURCE    | DESCRIPTION | USED BY |    STATE    |
+---------+--------+-------------+-------------+---------+-------------+
| default | zfs    | serzfs/lxd  |             | 3       | UNAVAILABLE |
+---------+--------+-------------+-------------+---------+-------------+

there are also remnants visible in its config, no idea where these files can be but I am confident they are not needed anymore:

used_by:
- /1.0/profiles/default
- /1.0/storage-pools/default/volumes/image/16e27f3863ea7afe958966d67531a6ec2a3c5f5b8dda1b514bf63cb016f3ac6d
- /1.0/storage-pools/default/volumes/image/dac05c5309085422395beb0857329c7ef7ed5913bfd1b7f1bb34d77a1a2b169e

How can I delete that storage?

$ lxc storage delete default
Error: The storage pool is currently in use

Hi,

It seems the storage pool is still used by some resources (images and default profile).

Can you check the output of lxc profile show default to see whether the profile references the default pool (in devices section). You can then delete the the device that references the default pool using lxc profile device rm default root, where root is the name of the device in the profile.

For images, you can list the images within the storage pool using lxc storage volume ls default type=image, and then delete them using lxc image rm <image_fingerprint>.

yaah, but there are no images because the pool is not available:

$ lxc storage volume ls default type=image
+------+------+-------------+--------------+---------+
| TYPE | NAME | DESCRIPTION | CONTENT-TYPE | USED BY |
+------+------+-------------+--------------+---------+

i was able to edit default profile and change pool from default to currently used one, but the images are virtual remnants which i am still unable to remove from lxd “memory”

OK, I issued

rm -rf /var/snap/lxd/common/lxd/storage-pools/default

and then i was able to delete it

$ lxc storage delete default
Storage pool default deleted

thanks for support :slight_smile:

2 Likes