Schedule trim (fstrim) job on Hosts/VMs

TomSawyer

New Member
Aug 24, 2020
29
0
1
35
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,
 

oguz

Proxmox Retired Staff
Retired Staff
Nov 19, 2018
5,207
695
118
hi,

fstrim.timer executes once a week automatically.
 
  • Like
Reactions: TomSawyer

oguz

Proxmox Retired Staff
Retired Staff
Nov 19, 2018
5,207
695
118
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

TomSawyer

New Member
Aug 24, 2020
29
0
1
35
I understand...Thank you.

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

oguz

Proxmox Retired Staff
Retired Staff
Nov 19, 2018
5,207
695
118
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
 
Feb 27, 2020
32
2
13
49
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
 

janssensm

Well-Known Member
Dec 18, 2016
234
81
48
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 your own in 60 seconds.

Buy now!