lvmteam / lvm2

Mirror of upstream LVM2 repository
https://gitlab.com/lvmteam/lvm2
GNU General Public License v2.0
128 stars 72 forks source link

lvmthin on top of lvmvdo - space of removed thin snapshots of thin volumes is not discarded on lvmvdo #150

Open maurerh opened 2 months ago

maurerh commented 2 months ago

Hi

I am running LVM2 2.03.24. When I create a thinpool on top of LVM using

lvcreate --type thin-pool -n lv_data_pool -L 350G --pooldatavdo y VolGroupVDO  --chunksize 64k
lvrename VolGroupVDO/lv_data_pool_vpool0 VolGroupVDO/lv_data_vdo_vpool0
lvextend --poolmetadatasize 16G VolGroupVDO/lv_data_pool
lvextend -L+1650G VolGroupVDO/lv_data_pool
lvcreate  --thin VolGroupVDO/lv_data_pool --virtualsize 1T --name lvdata

This leads to the following LVM setup

  lv_data_pool               VolGroupVDO twi-a-t---   1,95t                           0,00   0,15
  [lv_data_pool_tdata]       VolGroupVDO vwi-aov---   1,95t lv_data_vdo_vpool0        0,00
  [lv_data_pool_tmeta]       VolGroupVDO ewi-ao---- <15,88g
  lv_data_vdo_vpool0         VolGroupVDO dwi------- 350,00g                           1,21
  [lv_data_vdo_vpool0_vdata] VolGroupVDO Dwi-ao---- 350,00g
  lvdata                     VolGroupVDO Vwi-a-t---   1,00t lv_data_pool              0,00
  [lvol0_pmspare]            VolGroupVDO ewi------- <15,88g

If I write data to the filesystem and delete it, discards work on vdo layer and space is discared as expected and vdostats --hu reduces the usage. VolGroupVDO-lv_data_vdo_vpool0-vpool 350.0G 4.2G 345.8G 1% 99%

If I write data to the file system, create a thin snapshot with lvcreate -s --name lvdata_s1 VolGroupVDO/lvdata delete the data in the original filesystem, the usage of vdo does not change as expected.

But if i delete the snapshot, with lvremove VolGroupVDO/lvdata_s1 I would expect, that the VDO space is freed. But this is not the case, the usage vdostats --hu does not change I am using

        issue_discards = 1
        thin_pool_discards = "passdown"
        thin_pool_zero = 1

therefore discards should be passed down to VDO

lvs -o  name,discards
  LV                 Discards
  lvroot                     
  lvswap                     
  lvvar                      
  lv_data_pool       passdown
  lv_data_vdo_vpool0         
  lvdata             passdown
  lvdata_s1          passdown

Therefore the space of deleted snapshots continuously cumulate, and at some point the VDO volume runs out of space, even if I create only some data and all thin snapshots are deleted.

How can I free VDO space, when I delete an thin-snapshot of a thin volume on top of VDO.

Regards

Hansjörg

zkabelac commented 1 month ago

Yep - this feature is still in devel ATM - there are more troubles along this route. Meanwhile - until resolved - you can run 'blkdiscard /dev/vg/lv' before dropping thin volume.