Configure iSCSI Target & iSCSI Initiator

ISCSI is a transport layer protocol that describes how Small Computer System Interface (SCSI) packets should be transported over a TCP/IP network.

iSCSI - Internal Small Computer System Interface

iSCSI, which stands for Internet Small Computer System Interface, works on top of the Transport Control Protocol (TCP) and allows the SCSI command to be sent end-to-end over local-area networks (LANs), wide-area networks (WANs) or the internet.

ISCSI makes it possible to set up a shared-storage network where multiple servers and clients can access central storage resources as if the storage was a locally connected device.

How iSCSI works

ISCSI works by transporting block-level data between an iSCSI initiator on a server and an iSCSI target on a storage device.

The iSCSI protocol encapsulates SCSI commands and assembles the data in packets for the TCP/IP layer.

Packets are sent over the network using a point-to-point connection.

Upon arrival, the iSCSI protocol disassembles the packets, separating the SCSI commands so the operating system (OS) will see the storage as if it was a locally connected SCSI device that can be formatted as usual.

Some of iSCSI's popularity in small to midsize businesses (SMBs). has to do with the way server virtualization makes use of storage pools.

In a virtualized environment, the storage pool is accessible to all the hosts within the cluster and the cluster nodes communicate with the storage pool over the network through the use of the iSCSI protocol.

iSCSI SAN deployment

This image illustrates how a simple iSCSI SAN deployment could share the same infrastructure as the rest of the computers on the network. Ideally, however, the data and storage networks should run separately to avoid network congestion.

Components of iSCSI

Components of iSCSI include:

iSCSI initiator. An iSCSI initiator is a piece of software or hardware that is installed in a server to send data to and from an iSCSI-based storage array or iSCSI target.

iSCSI target. In the iSCSI configuration, the storage system is the "target." The target is essentially a server that hosts the storage resources and allows access to the storage via one or more NICs, HBAs or iSOEs.

iSCSI is a transport layer protocol that works on top of the Transport Control Protocol (TCP).

It enables block-level SCSI data transport between the iSCSI initiator and the storage target over TCP/IP networks.

iSCSI supports encrypting the network packets, and decrypts upon arrival at the target.

SCSI is a block-based set of commands that connects computing devices to networked storage, including spinning up storage media and data reads/writes.

The protocol uses initiators to send SCSI commands to storage device targets on remote servers.

Storage targets may be SAN, NAS, tape, general-purpose servers – both SSD and HDD – LUNs, or others.

The protocol allows admins to better utilize shared storage by allowing hosts to store data to remote networked storage, and virtualizes remote storage for applications that require direct attached storage.

NFS, Samba, AFS (NAS Based Tools) work at filesystem level, whereas iSCSI (SAN Based like AoE) works at block level.

iSCSI Target =) iSCSI Server iSCSI initiator =) iSCSI Client

iSCSI Target (Server) Configuration: (RHEL): 192.168.1.104

ifconfig
hostnamectl set-hostname server.goutam

hostnamectl

yum install -y targetcli

lsblk

OR

fdisk -l

targetcli

ls 
    backstores
        BLOCK = Block-device based LUN Storage Space like Disk e.g. /dev/sdb. 
        FILEIO = File based LUN Storage Space like file created with dd command. 
        PSCSI = (SCSI Pass-through) Physical Disk based LUN Storage Space like CD-ROM. 
        RamDisk= Ramdisk based LUN Storage Space for higher IO speed.
    iscsi
    loopback

/backstores/block create newlun /dev/sdb

ls

/iscsi create
ls
iscsi
       -iqn
               -tpg1 = target portal group
               -acl = provide the access to luns with the help of client iqn number
               -luns = which lun has to mapped or to be accessed by client
               -portals = network cards, ip address, port number
                -0.0.0.0:3260
ls

Go to Client & Copy Number with cat /etc/iscsi/initiatorname.iscsi

/iscsi/iqn.2003-01.org.linux-iscsi.server.x8664:sn.89b50c23d34a/tpg1/acls create iqn.1994-05.com.redhat:3e9d906e8

ls

exit

Client Configuration: (RHEL ): 192.168.1.105

yum repolist

ifconfig

hostnamectl set-hostname client.goutam

hostnamectl

yum install -y iscsi-initiator-utils

lsblk

OR

fdisk -l

cat /etc/iscsi/initiatorname.iscsi

iscsiadm --help

iscsiadm -m discovery -t sendtargets -p 192.168.1.104

iscsiadm -m node -T iqn.2003-01.org.linux-iscsi.server.x8664:sn.89b50c23d34a 192.168.1.104 -l

lsblk

OR

fdisk -l

cat /proc/scsi/scsi

mkdir -p /newlun

mkfs.ext4 /dev/sdb

mount /dev/sdb /newlun

cd /newlun

touch test{1..10}.txt

mkdir aa bb cc dd

ls -lh