Solution 1:

What you're asking is highly iSCSI target implementation specific. Most of them don't do 1:1 SCSI command mapping, so if iSCSI target emulates hard disk - it won't bypass unrecognized commands (incl. UNMAP of course) to underlying storage @ back-end UNLESS you'll explicitly ask iSCSI target to do so. With TGT you ment'd you specify "thin_provisioning=1" for your virtual LUN in config file.

Solution 2:

TRIM is enabled by default to run weekly in Ubuntu 20.04 so there should be no problem even if you run it manually. You can check this in the fstrim.service and fstrim.timer just in case:

However, this indeed looks like you need to enable UNMAP on the target as already mentioned. Since many SATA SSDs had issues with UNMAP, it was disabled in LIO by default:

On the side note, of course, things are getting a lot easier when an iSCSI target natively supports TRIM/UNMAP with no further tinkering. Here is an example:

Solution 3:

LIO disables UNMAP by default. If you want to enable it you should set the emulate_tpu attribute on the target.