Behavior of "autotrim=on" vs "zpool trim" when disks lack TRIM support #17694
-
I have a question regarding the difference in behavior between the zpool trim command and setting the autotrim pool property when dealing with disks that do not support the TRIM function. From my observation and testing, the zpool trim command actively checks if the underlying disks support TRIM operations. If a disk does not support TRIM, the command fails gracefully and does not attempt the operation (e.g., displaying errors like "trim operations are not supported by this device"). However, it seems that setting the autotrim=on property using zpool set autotrim=on does not perform the same validation check. This leads to my concern: If autotrim=on is enabled on a pool containing disks that do not actually support TRIM, what is the expected behavior? Thank you for your insights and time. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
I have a HDD only pool which has auto trim enabled by mistake without any
issues. I had a pool where there was a mix of special SSDs and HDDs - there
is no property to apply trim to SSDs only, so kinda reasonable compromise.
…On Wed, Sep 3, 2025, 17:56 cabaneri ***@***.***> wrote:
I have a question regarding the difference in behavior between the zpool
trimcommand and setting the autotrimpool property when dealing with disks
that do not support the TRIM function.
From my observation and testing, the zpool trimcommand actively checks if
the underlying disks support TRIM operations. If a disk does not support
TRIM, the command fails gracefully and does not attempt the operation
(e.g., displaying errors like "trim operations are not supported by this
device").
However, it seems that setting the autotrim=onproperty using zpool set
autotrim=ondoes not perform the same validation check. This leads to my
concern:
If autotrim=onis enabled on a pool containing disks that do not actually
support TRIM, what is the expected behavior?
Thank you for your insights and time.
—
Reply to this email directly, view it on GitHub
<#17694>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABXQ6HN2KTKEDTDYTDL3X7D3Q2NJ7AVCNFSM6AAAAACFPWD5YOVHI2DSMVQWIX3LMV43ERDJONRXK43TNFXW4OZYHAZTIMZVGA>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
Yes, that's basically correct. When automatic trimming is enabled one 'vdev_autotrim' thread is created for each mirror/raidz/draid vdev in the pool (not leaf). These threads are then responsible for regularly issuing trim operations for blocks which were recently freed. If disk doesn't support the trim command it will be skipped.