6

I have read "Add TRIM support" article, but failed to get a clue for "When and how often does ZFS autotrim take place?" And How can I observe activities of autotrim?

Thanks for your comments in advance.

2 Answers 2

14

ZFS autotrim really is a continuous, opportunistic operation which run after a block/range was freed.

From the man page:

autotrim = on | off

When set to on space which has been recently freed, and is no longer allocated by the pool, will be periodically trimmed ... Automatic TRIM does not immediately reclaim blocks after a free. Instead, it will optimistically delay allowing smaller ranges to be aggregated in to a few larger ones. These can then be issued more efficiently to the storage.

For more details, you can look at these code comments:

Automatic TRIM happens continuously in the background and operates
solely on recently freed blocks (ms_trim not ms_allocatable).
...
While the automatic TRIM process is highly effective it is more likely
than a manual TRIM to encounter tiny ranges.  Ranges less than or equal to
'zfs_trim_extent_bytes_min' (32k) are considered too small to efficiently
TRIM and are skipped.  This means small amounts of freed space may not
be automatically trimmed.
1
  • Thanks to you I had a quenched thirst. And the document you recommended said "3) There is no automatic TRIM progress information stored on disk, nor is it reported by 'zpool status'.", which can be the answer for observing activities of 'autotrim'. Thank you again.
    – sohnman
    Dec 29, 2020 at 8:15
6

Use this command to view io requested on pool [tank], including trim.

zpool iostat -r [tank]

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .