Cannot delete storage volume

I deleted the container ‘focaltest’ a few weeks ago, but recently discovered that its storage volume is still hanging around:

$ lxc storage volume list lxd-partition
+-----------+------------------------------------------------------------------+-------------+--------------+---------+
|   TYPE    |                               NAME                               | DESCRIPTION | CONTENT-TYPE | USED BY |
+-----------+------------------------------------------------------------------+-------------+--------------+---------+
....
+-----------+------------------------------------------------------------------+-------------+--------------+---------+
| container | focaltest                                                        |             | filesystem   | 1       |

I tried to delete it but can’t:

$ lxc storage volume delete lxd-partition focaltest
Error: not found

The host is Ubuntu 20.04 using LXD from Snap. The storage is on a BTRFS partition that’s only used for LXD.

$ snap list
Name                 Version                     Rev    Tracking       Publisher         Notes
lxd                  4.11                        19389  latest/stable  canonical✓        -

How can I get rid of this orphaned storage volume and free up the space it’s taking?

lxd sql global "DELETE FROM storage_volumes WHERE name="focaltest"

Though that shouldn’t be taking any space unless the storage volume also didn’t get deleted somehow?

What’s in ls -lh /var/snap/lxd/common/lxd/mntns/var/snap/lxd/common/lxd/storage-pools/lxd-partition/containers/?

Hi Stephane,

$ lxd sql global "DELETE FROM storage_volumes WHERE name='focaltest'"
Rows affected: 1

$ sudo ls -lh /var/snap/lxd/common/lxd/mntns/var/snap/lxd/common/lxd/storage-pools/lxd-partition/containers/
ls: Zugriff auf '/var/snap/lxd/common/lxd/mntns/var/snap/lxd/common/lxd/storage-pools/lxd-partition/containers/' nicht möglich: Datei oder Verzeichnis nicht gefunden

sudo ls -lh /srv/lxd/containers/
insgesamt 0
d--x------ 1 1000000 root 78 Aug 1 2020 cntrdtop
d--x------ 1 1000000 root 78 Aug 1 2020 emby-focal
d--x------ 1 1000000 root 78 Feb 15 07:49 focaltest
d--x------ 1 1000000 root 78 Aug 1 2020 sncedge
d--x------ 1 1000000 root 78 Sep 12 07:02 vpncntr

$ sudo du -sh /srv/lxd/containers/focaltest/
3,0G /srv/lxd/containers/focaltest/

Would I be right to rm -rf /srv/lxd/containers/focaltest/ at this point?

Yeah, that’s fine

Thanks, that all seems to have worked. Not sure how the storage volume wasn’t deleted with the container. I don’t often delete containers but if it comes up again I might raise a bug