LXC Container Reducing my SSD available Space

I have a problem of my SSD reducing space when i df . command on the container

ubuntu@devubuntugui:~$ df .
Filesystem 1K-blocks Used Available Use% Mounted on
default/containers/devubuntugui 44730624 19437184 25293440 44% /
ubuntu@devubuntugui:~$ df .
Filesystem 1K-blocks Used Available Use% Mounted on
default/containers/devubuntugui 44373376 19437184 24936192 44% /
ubuntu@devubuntugui:~$ df .
Filesystem 1K-blocks Used Available Use% Mounted on
default/containers/devubuntugui 44366080 19437184 24928896 44% /

what might be the issue kindly?

Further digging with ncdu / i found out that

sudo ls -ltr /var/snap/lxd/common/lxd/disks
total 183222284
-rw------- 1 root root 214748364800 Jun 19 17:54 default.img

keeps on increasing in size which it takes up space

why is this happenning ?

This is normal. When a storage pool is created on a disk image loop file, it is sparsely allocated, which means the blocks are only allocated from the host system as they are used.

However depending on the storage pool driver it may (or most likely may not) release blocks back to the host OS when they are not in use, instead it will keep them allocated to the pool file for reuse in the future.

1 Like

how can i stop this from happening

You can use a dir pool. Or you can use a storage pool with a source specified that is a dedicated disk or partition.

Another thing to note about the loop file (default.img in your case) is that it will only grow up to the size it was configured to. lxc storage show default should tell you which size it is.