Does fstrim work on all storage devices?

No, fstrim is primarily intended for use with SSDs and thin-provisioned storage devices that support the TRIM operation. It generally doesn't provide any benefit for traditional hard disk drives (HDDs).