Hi,
is it possible and safe to trim/discard a VMs filesystem from outside(proxmox host) while the vm is online?
I have some non-fstrim-enabled VMs on a proxmox host with lvm thin provisioning and I want to fstrim the vms filesystem regularly. So I thought I shutdown the VM and mount the VM filesystem from the proxmox host and run fstrim on the mountpoint. But I did not check that the VM really had shut down. In fact it hadn't, because it was stuck at some point. So I obviously did an fstrim on a twice mounted filesystem. I thought I trashed the virtual machine by that, but that did not happen. The VM started up without no problem.
I wonder whether it is generally safe to do that?
What I did to trim the VMs filesystem:
is it possible and safe to trim/discard a VMs filesystem from outside(proxmox host) while the vm is online?
I have some non-fstrim-enabled VMs on a proxmox host with lvm thin provisioning and I want to fstrim the vms filesystem regularly. So I thought I shutdown the VM and mount the VM filesystem from the proxmox host and run fstrim on the mountpoint. But I did not check that the VM really had shut down. In fact it hadn't, because it was stuck at some point. So I obviously did an fstrim on a twice mounted filesystem. I thought I trashed the virtual machine by that, but that did not happen. The VM started up without no problem.
I wonder whether it is generally safe to do that?
What I did to trim the VMs filesystem:
- added partition device files
Code:kpartx -av /dev/mapper/pve--vm--100--disk--0
- mounted VM filesystem on the host
Code:mount /dev/mapper/pve--vm--disk--0p1 /mnt2
- ren fstrim
Code:fstrim -v /mnt2
- unmounted filesystem
Code:umount /mnt2
- delete partition devices files
Code:kpartx -dv /dev/mapper/pve--vm--100--disk--0
Last edited: