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.
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: zpool status -tLP "$pool" | fgrep /dev/ | fgrep -qv 'trim unsupported' && zpool trim "$pool" ... but there might be corner cases which this doesn't catch. Colm On Thu, 11 Feb 2021 at 17:45, Christoph Biedl < debian.a...@manchmal.in-ulm.de> wrote: > Petter Reinholdtsen wrote... > > > Any idea how to figure out if trimming is possible/useful? > > Haven't checked, but in the meantime I figured a sane solution was > something like Colm suggested: Have upstream modifiy the zpool command > so - at least when providing an option like "--cron-mode" - it is silent > as long as there is no error, and it considers that particular situation > not an error. Then you could also remove the "|| true" again which has > potential of hiding errors where it should not. > > Christoph > _______________________________________________ > Pkg-zfsonlinux-devel mailing list > pkg-zfsonlinux-de...@alioth-lists.debian.net > > https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/pkg-zfsonlinux-devel -- Colm Buckley | c...@tuatha.org