TRIM on SSD pools

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.

1 Like

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.

1 Like

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.

1 Like