Setting up iSCSI with tgtadm (server) and using open-iscsi (client)

service tgt restart

create new target

tgtadm –lld iscsi –op new –mode target –tid {tid} -T {target_name}
tgtadm –lld iscsi –op new –mode target –tid 2 -T 2018.scsi

connect to source

tgtadm –lld iscsi –op new –mode logicalunit –tid 2 –lun 2 -b /root/2018.iscsi
tgtadm –lld iscsi –op new –mode logicalunit –tid 1 –lun 2 -b /dev/sdc

publish target to all interfaces

tgtadm –lld iscsi –op bind –mode target –tid 2 -I ALL

Show targets

tgtadm –lld iscsi –op show –mode
tgtadm –lld iscsi –op delete –mode target –tid {tid}

Setting up the client

apt-get install open-iscsi
vi /etc/iscsi/iscsid.conf

At the end of the file insert as follows:

node.startup = automatic
node.session.auth.username = isky
node.session.auth.password = pesky
discovery.sendtargets.auth.username = isky
discovery.sendtargets.auth.password = pesky
node.session.timeo.replacement_timeout = 120
node.conn[0].timeo.login_timeout = 15
node.conn[0].timeo.logout_timeout = 15
node.conn[0].timeo.noop_out_interval = 10
node.conn[0].timeo.noop_out_timeout = 15
node.session.iscsi.InitialR2T = No
node.session.iscsi.ImmediateData = Yes
node.session.iscsi.FirstBurstLength = 262144
node.session.iscsi.MaxBurstLength = 16776192
node.conn[0].iscsi.MaxRecvDataSegmentLength = 65536

/etc/init.d/iscsid restart


iscsiadm -m discovery -t sendtargets -p ipaddress
iscsiadm -m discovery -t st -p localhost

Show available

iscsiadm –mode discovery –type sendtargets –portal localhost

Show credentials

iscsiadm –mode discovery –type login –portal localhost

Log in

iscsiadm –mode node –targetname 2018.scsi –portal localhost –login
iscsiadm –mode node –targetname 2018.scsi –portal localhost –logotime


Configure Ubuntu To Serve As An iSCSI Target