Cleanup after storage pool is lost

(Saulius Gurklys) #1


I had two storage pools (zfs and btrs) and by accident lost one (btrfs) of them.
“lxc list” still lists all containers including ones from lost pool.

I can not delete gone containers

# lxc delete f1
Error: no such file or directory

or storage pool and volumes

# lxc storage volume delete btrfs f1
Error: No such object

# lxc storage delete btrfs
Error: storage pool "btrfs" has volumes attached to it

Is there a way to cleanup information/data about lost containers and storage pool and volumes?

Thank you.

(Stéphane Graber) #2

Easiest is to temporarily re-create the pool, even if empty, then you can remove everything.

Can you show lxc storage show btrfs?

(Saulius Gurklys) #3


lxc storage show btrfs


  btrfs.mount_options: compress=zstd
  source: /btrfs/lxd
  volatile.initial_source: /btrfs/lxd
description: ""
name: btrfs
driver: btrfs
- /1.0/containers/alpine-edge
- /1.0/containers/docker1
- /1.0/containers/f1
- /1.0/containers/f2
- /1.0/images/af646b495f250dad72a2b5dd6f604264936b9d932a52878e7686891f285173c6
- /1.0/profiles/btrfs
status: Created
- none

So I just need to create /btrfs/lxd ?

Thank you.

(Stéphane Graber) #4

Yep, creating /btrfs/lxd should do the trick

(Saulius Gurklys) #5

I created /btrfs/lxd directory. And then I was able to delete all containers, images, profiles and storage pool. My problem has been solved :slight_smile: