Simple iSCSI target (server) and initiator (client)

iSCSI (Internet Small Computer System Interface) - an Internet Protocol (IP)-based to provide data storage over network.
Protocol: tcp
Default port: 3260

System A, Target. IP: 10.10.10.1

Install:

yum install scsi-target-util

Configuration. There is example in configuration file /etc/tgt/targets.conf, and unused /dev/sdb:

# Sample target with one LUN only. Defaults to allow access for all initiators:
#<target iqn.2008-09.com.example:server.target1>
#    backing-store /dev/LVM/somedevice
#</target>
<target phn.org.ua:phn-disk-1>
    backing-store /dev/sdb
</target>

Autostart:

chkconfig tgtd on

Start service:

service tgtd start

System B, Initiator. IP: 10.10.10.2

Install:

yum install iscsi-initiator-utils

There is example in "man iscsiadm", how to discover new disks:

iscsiadm --mode discoverydb --type sendtargets --portal 10.10.10.1 --discover 10.10.10.1:3260,1 phn.org.ua:phn-disk-1

Autostart and start:

chkconfig iscsi on
service iscsi start

Verify status to find name of new disk:

service iscsi status
. . .
Attached scsi disk sdc State: running

Now file system can be created:

mkfs.ext4 /dev/sdc
mount /dev/sdc /mnt

During restart service use information from:

/var/lib/iscsi/nodes/
/var/lib/iscsi/send_targets/

Leave a Reply

Your email address will not be published. Required fields are marked *