New setup: Trim and Discard Settings

athompson3117

New Member
Nov 10, 2025
19
0
1
I'm still wading into PVE setup as I get my first system stood up. Now I've come across the documentation on trim and dIscard, and there is a lot of information out there, some which may be out of date. I have my VMs running on a RAID1 ZFS pool comprised of 2 SSDs. Let's tackle some items.

1) I plan to set up a weekly job to run trim from the PVE host itself (there's a ready-made cron that does this I've read), as I've been lead to believe that autotrim can lead to poor performance and/or unnecessary SSD wear. Is this the correct approach.

2) I have the VM disks using VirtIO devices, and with discard enabled at the PVE level. Do I need to enable something more at the PVE level? Do I need to enable something more at the guest OS level? My guests are all Linux and Windows. For windows, its all 2019. I'd have to check the Linux guests, but I believe the lowest are some some RHEL7s.

3) I will check to make sure the default scrub job is running.

Are all these correct? Should I so more?

Thanks!
 
Just a bit of background:

Trimming VMs is to reclaim deleted space and necessary if you use thin provisioning. It should run after heavy file action like update yet running it once per week can be enough. Trimming on SSD should not be neccessary with enterprise class SSDs and even with newer consumer and prosumer drives, yet running it does normally not hurt the life expectancy.
 
Trimming on SSD should not be necessary with enterprise class SSDs and even with newer consumer and prosumer drives, yet running it does normally not hurt the life expectancy.
This is good to know. This is a little homelab I've set up, so I'm just using WD Black SN7100s. Not sure if that's new enough to not need the explicit trim job.

Just for my own curiosity, even if explicit trimming is unnecessary on the SSDs I have, how do you go about enabling discard on the guest VMs?
 
I do not. I quoted this from the PVE docs. It seems to work fine on linux and windows without it. I don't use HDDs so I wouldn't really notice.
 
Last edited: