fstrim before backup

PSz

New Member
Feb 19, 2024
18
2
3
What do you think about similar option to 'Run guest-trim after a disk move or VM migration' for backup?!

Maybe this one option would be enough. If it is already checked, it is also worth doing fstrima before backup.

We are very annoyed by the fact that we cannot set it to be activated by default. It would be best if there was a default datacenter setting, and from the VM level we could choose on, off, auto/default.
 
Ideally you setup your disks with Discard and use a OS and filesystem in the VM that issues trim ops on delete, so the storage will keep itself properly thin provisioned.

What's your use case for this?
 
  • Like
Reactions: Kingneutron
You are right. Enable cron service is essential: `systemctl enable --now fstrim.timer`
However, it depends on the guest administrator. Forcing this from PVE level will sometimes be very convenient.
 
Forcing this from PVE level will sometimes be very convenient.
If the guest has the qemu-guest-agent package installed and running and you activated the guest agent in the VM config:
You can just execute qm guest cmd <vmid> fstrim on the host the VM is running on.
 
  • Like
Reactions: Kingneutron
Most OS do come with fstrim enabled, but I understand your use case. Two options come to my mind:

- Run an fstrim periodically via cron and qemu-agent [1]
- Set up a script in either /etc/vzdump.conf or the backup task [2] and run the fstrim via qemu-agent on backup-start phase [3]

[1] https://forum.proxmox.com/threads/fstrim-script-via-qemu-guest-agent.78574/
[2] https://forum.proxmox.com/threads/w...script-to-scheduled-backup.139614/post-624038
[3] https://git.proxmox.com/?p=pve-mana...e70a4a9775438ab658da2191;hb=refs/heads/master
 
  • Like
Reactions: Kingneutron

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!