VM disk takes more disk after migrating it to LVM-thin storage

If you can't afford any downtime, ask the filesystem politely to please trim the free sectors :)
That would also have been my next guess.

So run this on one of you test machines:
  • migrate VM and keep i powered off
  • set discard if not already set on all disks
  • check if all disks are scsi and virtio scsi controller is set
  • poweron the machine
  • fstrim -va
  • check thin provisioning
  • if not good, try dd if=/dev/zero of=zero bs=64k; sync; sync; sync; rm -f zero in each mountpoint.
 
  • Like
Reactions: Sagi
Your problem may be that your filesystem refuses to trim already trimmed sectors [1]. Given that you have enabled discard on the drive and using VirtIO SCSI [single] as the controller, If you reboot the VM and then run fstrim -v again if should discard the free the space.

Thank you. That solved the issue!

So for live-migration what I did was:
1) Turned on "Discard" before migrating (and restarted to make it take effect)
2) Ran "live migration" to another node (at this stage, the LV is thick)
3) Reboot the VM
4) Ran "fstrim -av" on the VM (now the LV turns thin again).

This is downtime I can handle.
Thank you and everyone who helped in this thread!