ISCSI

ISCSI

iSCSI stands for Internet Small Computer Systems Interface. It is an IP-based storage networking standard for linking data storage facilities. It allows client machines (called initiators) to send SCSI commands (CDBs) to SCSI storage devices (targets) on remote servers. It is a popular protocol used for exchanging SCSI commands over IP networks, enabling the use of the existing network infrastructure to connect storage

On the Server side

sudo apt-get install tgt

Go to /etc/tgt/targets.conf and add a target which is the ip address of the server side.

<target 192.168.1.9:target01>
backing-store /dev/md0
incominguser admin admin
</target>

Restart the service: systemctl restart tgt

and now let’s see the target we have installed:

root@k8snode:/home/touk# tgtadm --mode target --op show
Target 1: 192.168.1.9:target01
    System information:
        Driver: iscsi
        State: ready
    I_T nexus information:
    LUN information:
        LUN: 0
            Type: controller
            SCSI ID: IET     00010000
            SCSI SN: beaf10
            Size: 0 MB, Block size: 1
            Online: Yes
            Removable media: No
            Prevent removal: No
            Readonly: No
            SWP: No
            Thin-provisioning: No
            Backing store type: null
            Backing store path: None
            Backing store flags:
    Account information:
        admin
    ACL informat

On the Client side (Initiator):

sudo apt-get install open-iscsi

then let’s change the config file to set up a connection to the server:

sudo vim /etc/iscsi/iscsid.conf

look for node.session.auth.username_in and password and change the credentials to admin admin like we did

# To set a CHAP username and password for initiator
# authentication by the target(s), uncomment the following lines:
node.session.auth.username = admin
node.session.auth.password = admin

Start the iscsid daemon :

systemctl start iscsid

systemctl status iscsid

and sure enough we can now discover the iSCSI targets available on the server. :

touk@ubuntu:~$ sudo iscsiadm --mode discovery -t sendtargets --portal 192.168.1.9
192.168.1.9:3260,1 192.168.1.9:target01

Now lets see something before we login:

touk@ubuntu:~$ ls /dev | grep sd
sda
sda1
sda2
sda5
And now let’s login using this command:
touk@ubuntu:~$ sudo iscsiadm --mode node --targetname 192.168.1.9:target01 portal 192.168.1.9 --login
Logging in to [iface: default, target: 192.168.1.9:target01, portal: 192.168.1.9,3260] (multiple)
Login to [iface: default, target: 192.168.1.9:target01, portal: 192.168.1.9,3260] successful.

And now !!

touk@ubuntu:~$ ls /dev | grep sd
sda
sda1
sda2
sda5
sdb

We have the sdb disk remotly connected to our machine

Last updated