This shows how to share a physical device via iSCSI.

While doing it quick&dirty like this is fine at home if you just want to mount a filesystem on another machine, be aware that using no authentication and restrictions is insecure.
For use in production environments, you certainly should consult the documentation (man tgtadm, man icsiadm) and use at least IP restrictions and CHAP authentication.



Create a target device:
tgtadm --lld iscsi --mode target --op new --tid=1 --targetname

Create a LUN:
tgtadm --lld iscsi --mode logicalunit --op new --tid 1 --lun 1 -b /dev/sdX

Set permissions to allow all initiators:
tgtadm --lld iscsi --mode target --op bind --tid 1 -I ALL


Allow tcp port 3260.

using iptables

iptables -I INPUT [rulenumber] -p tcp --dport 3260 -j ACCEPT

using firewalld

Check which zone is active:
firewall-cmd --get-active-zones

Allow the iscsi-target-service in that zone:
firewall-cmd --zone=PUTZONEHERE --add-service=iscsi-target
If you want to set this permanently, add --permanent.

Reload firewalld:
firewall-cmd --reload


Target discovery:
iscsiadm -m discovery -t sendtargets -p IP:3260

iscsiadm -m node -T -p IP:3260 --login

Now a new device should appear as /dev/sd* (check dmesg).
This device can be treated like a local device (with e.g., dd, mkfs, mount, …).

iscsiadm -m node -T -p IP:3260 --logout