Schedule trim (fstrim) job on Hosts/VMs

TomSawyer

New Member
Aug 24, 2020
29
0
1
37
Do I need to schedule fstrim for SSD disks (or even HDD?..) on Proxmox 6.2 ?

And if I do, how exactly do I schedule such a job? I've searched online but didn't find anything except for scheduling backups...

Thank you,
 
hi,

fstrim.timer executes once a week automatically.
 
  • Like
Reactions: TomSawyer
you don't need to run any command, it executes automatically every week.

if you want to run it manually, you can run fstrim -av on the host
 
  • Like
Reactions: TomSawyer
I understand...Thank you.

Besides the host does it run automatically for all the VMs on it and storage/directories as well?
 
Besides the host does it run automatically for all the VMs on it and storage/directories as well?

fstrim -a is shorthand for fstrim --all. it will trim all the mounted filesystems that support discarding.

you can also run it separately in the VMs from the shell
 
Hi all.
as Urnash mention the fstrim.timer service is not running in a default installation. no matter if it is suscription or community edition. Is it safe to activate it?

systemctl list-timers -all
systemctl start fstrim.timer
systemctl start fstrim.service
 
Should be safe to activate, it's not something proxmox specific. Debian also has fstrim setup like that.
you can enable by running:
systemctl enable fstrim.timer

The timer triggers the service, the service isn't running all the time.
You can trigger it one time by running:
systemctl start fstrim.service

You can monitor by running:
journalctl -u fstrim.timer
and
journalctl -u fstrim.service
 

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!