Cannot delete LXC container with full volume nor the volume itself

Tags:

Answer: 1

5 hours ago

I've been toying around with LXC/LXD lately and ended up with a couple of stopped containers:

❯ lxc list
+------------------------------------+---------+------+------+-----------+-----------+
|                NAME                |  STATE  | IPV4 | IPV6 |   TYPE    | SNAPSHOTS |
+------------------------------------+---------+------+------+-----------+-----------+
| build                              | STOPPED |      |      | CONTAINER | 0         |
+------------------------------------+---------+------+------+-----------+-----------+
| build-2020-05-27-180024-06f86fd0ac | STOPPED |      |      | CONTAINER | 0         |
+------------------------------------+---------+------+------+-----------+-----------+

Time to clean up:

❯ lxc delete build
Error: Error deleting storage volume: Failed deleting subvolume "/var/snap/lxd/common/lxd/storage-pools/default/containers/build": Failed to run: btrfs subvolume delete /var/snap/lxd/common/lxd/storage-pools/default/containers/build: ERROR: cannot delete '/var/snap/lxd/common/lxd/storage-pools/default/containers/build': No space left on device
❯ lxc storage info default
info:
  description: ""
  driver: btrfs
  name: default
  space used: 970.61MB
  total space: 1000.00MB
used by:
  containers:
  - build
  - build-2020-05-27-180024-06f86fd0ac
  images:
  - 40775fd923e2a77f56ce3c028ce22ad43b9254bb12766b12eeeefb32a3a145da
  profiles:
  - default

Apparently the volume is too small. My naive approach to solve this was to increase the volume size from 1G to 10GB via lxc storage edit default. As there is no obvious way to apply the changed setting I trust it's applied automatically by lxc storage edit . Turns out it isn't (as reported by lxc storage info default afterwards).

Next try: Let's just delete the insurgent volume so I can delete the container:

❯ lxc storage volume list default
+-----------+------------------------------------------------------------------+-------------+---------+
|   TYPE    |                               NAME                               | DESCRIPTION | USED BY |
+-----------+------------------------------------------------------------------+-------------+---------+
| container | build                                                            |             | 1       |
+-----------+------------------------------------------------------------------+-------------+---------+
| container | build-2020-05-27-180024-06f86fd0ac                               |             | 1       |
+-----------+------------------------------------------------------------------+-------------+---------+
| image     | 40775fd923e2a77f56ce3c028ce22ad43b9254bb12766b12eeeefb32a3a145da |             | 1       |
+-----------+------------------------------------------------------------------+-------------+---------+
❯ lxc storage volume delete default build-2020-05-27-180024-06f86fd0ac
Error: not found

Now I'm a bit stuck. What options do I have to delete the container (or resize the volume - which in turn shoud allow deleting)?


Update 1: Here are some specs about the system used.

❯ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04 LTS
Release:        20.04
Codename:       focal
❯ snap list | grep lxd
lxd    4.1    15161    latest/stable    canonical*        -

Update 2: In the meantime I tried to resize the volume "manually", like this:

truncate -s +500G /var/snap/lxd/common/lxd/disks/default.img
mount -t btrfs /var/snap/lxd/common/lxd/disks/default.img /mnt/test
sudo btrfs filesystem resize max /mnt/test/
reboot # because why not, hopfeully lxd catches up

After the reboot I could successfully delete both, the image and the volumes.

Everything looked good at this point. When I created a new container however, it refused to erase it with the same symptoms as described above. Same for the volume.

According to lxc storage show default the upgrade to 10G has been recognized by lxd after the reboot. I don't think it is possible the 10G capacity has actually been reached.

Added by: Madilyn Schuppe

Popular Search

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 1 2 3 4 5 6 7 8 9