iSCSI allows SCSI commands to be sent over IP networks by encapsulating SCSI commands and data within iSCSI protocol data units (PDUs). Key components in iSCSI include initiators that send commands, targets that receive commands and send responses, and logical unit numbers (LUNs) that represent storage units. Administrators can use tools like Yast and Targetcli to configure iSCSI targets, map LUNs, and manage access control lists for authorized initiators.
2. What is SCSI
Small Computer System Interface(SCSI) is a set of standards for physically
connecting and transferring data between computers and peripheral devices. The
SCSI standards define commands, protocols, electrical and optical interfaces.
SCSI is most commonly used for hard disk drives and tape drives, but it can
connect a wide range of other devices, including scanners and CD drives,
although not all controllers can handle all devices. The SCSI standard defines
command sets for specific peripheral device types; the presence of "unknown" as
one of these types means that in theory it can be used as an interface to almost
any device, but the standard is highly pragmatic and addressed toward
commercial requirements.
3. What is SCSI
SCSI Initiator: An endpoint that initiates a SCSI session, that is, sends a SCSI
command.
SCSI Target: Usually a disk or a storage array.
SCSI LUN: SCSI Logical Unit Number, the real storage, a SCSI target should
have at least one LUN: LUN0.
In SCSI terminology, communication takes place between an initiator and a
target. The initiator sends a command to the LUN, which then responds. SCSI
commands are sent in a Command Descriptor Block (CDB).
4. What is SCSI
Lsscsi shows [Host:Bus:Target:LUN], device type,
vendor, etc
lsscsi shows SATA devices, Because SATA uses SCSI
transport layer.
7. What is iSCSI
Carry SCSI CBD in iSCSI PDU, benefit from IP networks.
Key words in iSCSI:
? ISID: The initiator part of the Session Identifier. It is explicitly specified by
the initiator during Login.
? I_T nexus: According to [SAM2], the I_T nexus is a relationship between a
SCSI Initiator Port and a SCSI Target Port.
? SSID (Session ID): A session between an iSCSI initiator and an iSCSI target
is defined by a session ID that is a tuple composed of an initiator part (ISID)
and a target part (Target Portal Group Tag). The ISID is explicitly specified by
the initiator at session establishment. The Target Portal Group Tag is implied
by the initiator through the selection of the TCP endpoint at connection
establishment.
8. What is iSCSI, key words:
? TSIH (Target Session Identifying Handle): A target assigned tag for a session
with a specific named initiator. The target generates it during session
establishment. Its internal format and content are not defined by this protocol,
except for the value 0 that is reserved and used by the initiator to indicate a
new session.
? ITT(Initiator Task Tag):The Initiator Task Tag is used to identify a task during
its execution even over sessions/connections.
? CID: connection ID.
? CmdSN: command sequence number.
? ExpStatSN: The expected status number, ExpStatSN is what the initiator uses
to tell the target what status response it thinks is the next one.
9. What is iSCSI, key words:
? StatSN:status sequence number, it is different from status also in the PDU.
Responses in transit from the target to the initiator are numbered. The StatSN
(Status Sequence Number) is used for this purpose. This helps the initiator
detect any missing StatSN(s) and issue a SNACK for the status
? ExpCmdSN: Next expected CmdSN from this initiator.
? MaxCmdSN: Maximum CmdSN from this initiator
21. Targetcli create backend storage
? Create a backend storage with a existed file:
backstores/fileio create name=iscsi_file file_or_dev=/home/lszhu/target.raw
? Create a backend storage with a file not existed, while you want to create the
file at the same time.
backstores/fileio create name=iscsi_file file_or_dev=/home/lszhu/target.raw
size=100M
? Create a backend storage with a block device
backstores/block/ create name=iscsi_sbc dev=/dev/sdc
21
22. Targetcli create targets
/> iscsi/ create iqn.2017-03.suse.com.target
Created target iqn.2017-03.suse.com.target.
Created TPG 1.
Global pref auto_add_default_portal=true
Created default portal listening on all IPs (0.0.0.0), port 3260.
/>
22
23. Targetcli create portals and luns
? Create a portal
/iscsi/iqn.20...m.target/tpg1> portals/ create ip_address=147.2.212.166
ip_port=3260
? Create a lun:
/iscsi/iqn.20...m.target/tpg1> luns/ create /backstores/block/iscsi_sdc
23
24. Targetcli set demo mode
? Set to demo mode then every initiator can access the target without
authentication
/iscsi/iqn.20...m.target/tpg1> set attribute authentication=0
demo_mode_write_protect=0 generate_node_acls=1 cache_dynamic_acls=1
24
25. Targetcli add an ACL
An ACL means you want some specific initiators granted the access to the targets,
others not.
1. /iscsi/iqn.20...m.target/tpg1> acls/ create iqn.2017-03.suse.com.lszhu.init
2. /iscsi/iqn.20...m.target/tpg1> cd acls/iqn.2017-03.suse.com.lszhu.init
3. /iscsi/iqn.20...om.lszhu.init> set auth userid=lszhu password=lszhu
mutual_userid=test mutual_password=test
4. /iscsi/iqn.20...om.lszhu.init> create mapped_lun=6
tpg_lun_or_backstore=lun0
25