[linux-lvm] Why doesn't the lvmcache support the discard (trim) command?

Ilia Zykov linux at izyk.ru
Thu Oct 18 22:56:04 UTC 2018


Maybe it will be implemented later? But it seems to me a little strange when there is no way to clear the cache from a garbage.
Maybe I do not understand? Can you please explain this behavior.
For example:

I have the full cached partition, with full cache:

[root at localhost ~]# df -h /data
Filesystem             Size  Used Avail Use% Mounted on
/dev/mapper/test-data   12G   12G     0 100% /data
[root at localhost ~]# lvs -a
  LV              VG     Attr       LSize  Pool   Origin       Data%  Meta%  Move Log Cpy%Sync Convert
  data            test   Cwi-aoC--- 12.00g [fast] [data_corig] 99.72  2.93            0.00
  [data_corig]    test   owi-aoC--- 12.00g
  [fast]          test   Cwi---C---  1.00g                     99.72  2.93            0.00
  [fast_cdata]    test   Cwi-ao----  1.00g
  [fast_cmeta]    test   ewi-ao----  8.00m
  [lvol0_pmspare] test   ewi-------  8.00m

I clear the partition and do fstrim:

[root at localhost ~]# rm -rf /data/*
[root at localhost ~]# fstrim -v /data
[root at localhost ~]# df -h /data
Filesystem             Size  Used Avail Use% Mounted on
/dev/mapper/test-data   12G   41M   12G   1% /data


But the cache remained full:

[root at localhost ~]# lvs -a
  LV              VG     Attr       LSize  Pool   Origin       Data%  Meta%  Move Log Cpy%Sync Convert
  data            test   Cwi-aoC--- 12.00g [fast] [data_corig] 99.72  2.93            0.00
  [data_corig]    test   owi-aoC--- 12.00g
  [fast]          test   Cwi---C---  1.00g                     99.72  2.93            0.00
  [fast_cdata]    test   Cwi-ao----  1.00g
  [fast_cmeta]    test   ewi-ao----  8.00m
  [lvol0_pmspare] test   ewi-------  8.00m

Thank you.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3980 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://listman.redhat.com/archives/linux-lvm/attachments/20181019/4655cde0/attachment.p7s>


More information about the linux-lvm mailing list