ZFS trim and scrub

Started by kevindd992002, January 02, 2025, 11:11:24 AM

Previous topic - Next topic
I have OPNsense 24.7.11_2-amd64 installed in a Proxmox VM and am wondering if it has ZFS trim and scrub scheduled by default? Or do I still need to add both tasks as a cron job?

If they're not enabled by default, why? Is there a reason we don't want these two?

Unless you have attached a ZFS pool to the VM, the machine hosting the zpool should do the trimming and scrubbing.

Quote from: mooh on January 02, 2025, 04:12:00 PMUnless you have attached a ZFS pool to the VM, the machine hosting the zpool should do the trimming and scrubbing.

I do have another pool inside the VM. So does that mean I have to create a cron job for trimming and scrubbing? What is the difference between the trim cron job and the autotrim property?

Yes, I you have a ZFS pool inside your VM, the VM needs to do the trimming and scrubbing. If this pools happens to be mapped to a file in a ZFS pool of the host, the scrubbing is not needed since it is done by the host. Actually, scrubbing a virtual ZFS pool doesn't make sense.
Furthermore, if you have a zfs inside a zpool on the guest inside a zfs of a zpool on the host, performance will be suboptimal. Other than for training purposes, you'll be better off to mount a host ZFS to your VM directly.

Setting autotrim of a zpool to true causes ZFS to do trimming automatically, as part of the normal operation of the file system, which may happen to be at inconvenient times. If that setting is off, you may run "zpool trim ..." at your discretion.