What’s the recommended way to set this up?
I sort of foolishly assumed that trim was enabled automatically.
According to this running zpool trim via the systemd timer is preferred to setting the autotrim property on the pool itself.
What’s the recommended way to set this up?
I sort of foolishly assumed that trim was enabled automatically.
According to this running zpool trim via the systemd timer is preferred to setting the autotrim property on the pool itself.
I prefer to run it from cron once daily myself. You really don’t need it any more often than that unless you’ve got something VERY unusual and hardcore going on.
Timely thread. I had to turn off autotrim on my pool just yesterday. The discards were hitting my post-enshittification Crucial MX500’s at the same time as regular I/O and causing the whole thing to bog down.
I guess the warnings about consumer drives handling discards poorly are true.
Take a look at this file
# dpkg -S /etc/cron.d/zfsutils-linux
zfsutils-linux: /etc/cron.d/zfsutils-linux
# TRIM the first Sunday of every month.
24 0 1-7 * * root if [ $(date +\%w) -eq 0 ] && [ -x /usr/lib/zfs-linux/trim ]; then /usr/lib/zfs-linux/trim; fi
I let this cron job handle it for me. It’s Proxmox VE/Debian specific but I wrote a bit about this here if you’re interested. Also see the related information/links here.
Thanks for posting a link to your (awesome) write-up. That explained how to verify a SATA SSD properly supports TRIM and enable it in a clearer, more succinct way than anything else I’ve read on the PVE forum.
I’ve just tried enabling it on my rpool’s Intel enterprise SSD, so we’ll see how that goes, I guess. ![]()
root@pisces1:/etc/cron.d# zpool status -vt rpool
pool: rpool
state: ONLINE
scan: scrub repaired 0B in 00:00:31 with 0 errors on Sun Sep 13 00:24:32 2026
config:
NAME STATE READ WRITE CKSUM
rpool ONLINE 0 0 0
ata-SSDSC2BB120G7R_PHDV809404DJ150MGN-part3 ONLINE 0 0 0 (100% trimmed, completed at Wed Sep 23 20:04:10 2026)
errors: No known data errors
root@pisces1:/etc/cron.d# lsblk -e230 -Ddo+FSTYPE,LABEL,MODEL,SERIAL
NAME DISC-ALN DISC-GRAN DISC-MAX DISC-ZERO FSTYPE LABEL MODEL SERIAL
sda 0 4K 2G 0 SSDSC2BB120G7R PHDV809404DJ150MGN
sdb 0 0B 0B 0 Card Reader 000000001616
sdc 0 0B 0B 0 SanDisk 3.2Gen1 0401d4ef6066758868f4eb94e431bfa6dc462f8676fb7bf535d7d8da53d9b5fb09590000000000000000
nvme0n1
0 512B 2T 0 Samsung SSD 970 EVO Plus S6S1NS0T805122H
root@pisces1:/etc/cron.d# zpool list -H | awk '{ print $1 }' | xargs -r zfs list -oname,org.debian:periodic-trim
NAME ORG.DEBIAN:PERIODIC-TRIM
pisces1VirtStore -
rpool -
root@pisces1:/etc/cron.d# zfs set org.debian:periodic-trim=enable rpool
root@pisces1:/etc/cron.d# zpool list -H | awk '{ print $1 }' | xargs -r zfs list -oname,org.debian:periodic-trim
NAME ORG.DEBIAN:PERIODIC-TRIM
pisces1VirtStore -
rpool enable
Unfortunately, using SATA SSDs with proper TRIM support is still one of the least intuitive things about setting up a Proxmox node using ZFS, IMO.
It’ll be nice when/if the patch actually lands that’s supposed to enable TRIM on these sort of SATA SSDs out of the box.