fstrim/shrink not working after migrate

Jul 5, 2023
3
0
1
Hi,

whe have the current scenariio, pve 7.4.x in a cluster.

vm1 on proxhost 2:
lvs shows 28% in use from the 127GB disk on local thin storage. fstrim -av works.

migrate lvm1 to proxhost 01:
lvs shows 100% in use, this is a known issue, but running sudo fstrim -av in the vm normally results in a trimmed thin disk.
But after moving, to host 1, fstrim only trims 1,9gb, leaving 98% stil in use.
dd if=/dev/zero of=/zeros bs=256M
rm /zeros
fstrim -av
Doesn't work either, moving the vm back to host2 still gives 98% in use after fstrim.

So basically, when a vm is moved, it's more al a full provisioned disk.

How can we correct this? we're losing a lot of space this way.
 
Ok, found it
dd if=/dev/zero of=/zeros bs=256M doesn't seem to work:
cat /dev/zero >> zero.file ; sync ; rm zero.file ; fstrim -av
does, but the annoying part here is that you'll write until the partition is nearly full

Strange part of all of this, why does a migration of a vm result in a untrimmable disk?
 
are you sure it's related to migration ?

does it work if you do fstrim multiple time on your vm ? do you use ext4 for your vm filesystem ? (they are a known ext4 bug, where ext4 is not able to fstrim multiple time without reboot)
 
are you sure it's related to migration ?

does it work if you do fstrim multiple time on your vm ? do you use ext4 for your vm filesystem ? (they are a known ext4 bug, where ext4 is not able to fstrim multiple time without reboot)
Yes i do, also moving the disk to a different storage results in the same bahaviour, fstrim is working on all disks on the proxmox host, as long as they're created on that machine. using up space, deleting the files and using fstrim works.
creating a disk, and using qm impordisk also resolves in 100% lvs usage. in that scenarion, the fstrim command works flawlessly without the need for zeroing out the disk.


Yes It's ext4, but why is it working before the migration?
 
same here.

after migration, I trim a ext4 vm partition but proxmox lvm show 98% usage on vm disk.

proxmox8 in both nodes.
 
Last edited:

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!