<div dir="ltr">I did have a quick look in the zpool trim code and it's a bit difficult to achieve what is being suggested; that error is generated deep in libzfs not in the mainline of the zpool command, so capturing it or declaring it not-an-error with a flag would not be super clean. It's possible, but it might not be quick.<div><br></div><div>Short-term fix; parse the output of 'zpool status -t' to figure out if any devices support trim and only trim when there's at least one which does; something like:</div><div><br></div><div><blockquote style="margin:0 0 0 40px;border:none;padding:0px">zpool status -tLP "$pool" | fgrep /dev/ | fgrep -qv 'trim unsupported' && zpool trim "$pool"<br><br></blockquote>... but there might be corner cases which this doesn't catch.</div><div><br></div><div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div>Colm</div></blockquote><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><br></blockquote></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, 11 Feb 2021 at 17:45, Christoph Biedl <<a href="mailto:debian.axhn@manchmal.in-ulm.de">debian.axhn@manchmal.in-ulm.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Petter Reinholdtsen wrote...<br>
<br>
> Any idea how to figure out if trimming is possible/useful?<br>
<br>
Haven't checked, but in the meantime I figured a sane solution was<br>
something like Colm suggested: Have upstream modifiy the zpool command<br>
so - at least when providing an option like "--cron-mode" - it is silent<br>
as long as there is no error, and it considers that particular situation<br>
not an error. Then you could also remove the "|| true" again which has<br>
potential of hiding errors where it should not.<br>
<br>
    Christoph<br>
_______________________________________________<br>
Pkg-zfsonlinux-devel mailing list<br>
<a href="mailto:Pkg-zfsonlinux-devel@alioth-lists.debian.net" target="_blank">Pkg-zfsonlinux-devel@alioth-lists.debian.net</a><br>
<a href="https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/pkg-zfsonlinux-devel" rel="noreferrer" target="_blank">https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/pkg-zfsonlinux-devel</a></blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><span style="color:rgb(153,153,153);font-size:x-small">Colm Buckley | </span><a href="mailto:colm@tuatha.org" style="font-size:x-small" target="_blank">colm@tuatha.org</a><div><br></div></div></div></div></div>