LVM thin oversized, trying to understand ideal discard and trim options

luison

Renowned Member
Feb 22, 2010
160
6
83
Spain
elsurexiste.com
Hi, after a long time and due to an increase in used size of our main thinpool we realised we were having an issue like these:

https://forum.proxmox.com/threads/l...-actual-vm-disk-usage-low.108218/#post-464967
https://forum.proxmox.com/threads/lvm-thin-storage-filling-up-why.104327/#post-449704

We mainly have CT running but also 2 KVMs and we obviously have not had this correctly setup.
The host system is triming correctly via fstrim.timer but we have now realised this does not necessarily trim none of the thin disks mounted on the containers.

I found this clarifying how to check, activate for KVM and I understand I can discard or not when mounting disks there:

https://gist.github.com/hostberg/86bfaa81e50cc0666f1745e1897c0a56

But I am not so certain of the recommended procedure for the LXC containers, this is, if i want to trim immediately I understand I should flag discard on fstab but in case I don't (which I understand is better for the disks lifespan):

  • should i use fstrim.timer (via systemctl status fstrim.timer) on each container
  • or should I cron manually with: pct fstrim <vmid> instead?
  • do I need to set any special flag in LVMs conf for the thin pool?
I've red some issues with freezed containers when triming. Also does this affect or differ in case of using NVM disks?

Thanks.