Using tgt from tgt aur package. Following this guide from fedora.
Using the tgtadm
cli tool:
$ tgtadm --lld iscsi --mode account --op new --user ''username'' --password ''password''
Again with tgtadm
:
$ tgtadm --lld iscsi --mode target --op new --tid=1 --targetname iqn.2018-04.example.com:reminder
And adding an authorized user to it:
$ tgtadm --lld iscsi --mode account --op bind --tid 1 --user ''username''
Then adding LUN (logical units):
$ tgtadm --lld iscsi --mode logicalunit --op new --tid 1 --lun 1 -b /dev/vmpool/aVolume
To enumerate the iSCSI disks:
$ tgtadm --lld iscsi --mode target --op show
Using the builtin iSCSI kernel module (GNU/Linux). Following this guide from debian the content of /etc/iscsi/iscsid.conf
should be:
node.sendtargets.auth.authmethod = CHAP
node.sendtargets.auth.username = username
node.sendtargets.auth.password = password
And then:
$ systemctl restart iscsi.service
Explore a target for shares:
$ iscsiadm -m discovery -t st -p 192.168.0.20
192.168.0.1:3260,1 iqn.2007-01.org.debian.foobar:CDs
192.168.0.1:3260,1 iqn.2007-01.org.debian.foobar:USB
Mount a share:
$ iscsiadm -m node --targetname "iqn.2007-01.org.debian.foobar:CDs" --portal "192.168.0.1:3260" --login