Space do not seem to be released after restoring a snapshot (on LVM storage pool)

Hi all,

I have an LXD container with an LVM storage pool. The container already has several snapshots.

Today, I made some modifications inside my container (installations/upgrades of some packages). After running these modifications I run df -h inside the container and noticed that the total space had increased of about 3GB. Later during the day, I eventually decided to restore the container to the latest snapshot which discarded the changes I had made earlier today. Running df -h again inside the container, I could see that the additional 3GB were “freed”.

However, when I run df -h outside the container (on my server) I see an increase of 3GB.

Where did the extra 3GB go ? Where is it stored ? On the LVM storage pool ? Is there a way to free this space ?

The command lxc storage info lvmpool returns:

info:
  description: ""
  driver: lvm
  name: lvmpool
  space used: 43.22GiB
  total space: 137.70GiB

while sudo du -h /var/snap/lxd/common/lxd/disks/lvmpool.img returns

53G	/var/snap/lxd/common/lxd/disks/lvmpool.img

and lxc storage show lvmpool returns

config:
  lvm.thinpool_name: LXDThinPool
  lvm.vg_name: lvmpool
  size: 150GB
  source: /var/snap/lxd/common/lxd/disks/lvmpool.img
  volume.size: 50GB

Unfortunately, I do not know whether the output of any of the above commands was different before I started modifying my container.

Thanks a lot and apologies if this seems like a n00b question.

When the initial extra storage was used by the LVM pool it would have requested additional storage be allocated inside the loop file that is backing your LVM pool.

After the storage was released by the logical volume snapshots, the additional storage allocated to the LVM storage pool in the loop file would have remained. It is not freed.

You should see that the space is available to the LVM pool though by running sudo vgs