CentOS 7.x iSCSI target server setup

From Notes_Wiki
Revision as of 14:15, 21 October 2017 by Saurabh (talk | contribs) (Created page with "<yambe:breadcrumb>CentOS_7.x_iSCSI|CentOS 7.x iSCSI</yambe:breadcrumb> =CentOS 7.x iSCSI target server setup= To setup iSCSI target server on CentOS 7 use: # Install require...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

<yambe:breadcrumb>CentOS_7.x_iSCSI|CentOS 7.x iSCSI</yambe:breadcrumb>

CentOS 7.x iSCSI target server setup

To setup iSCSI target server on CentOS 7 use:

  1. Install required packages:
    yum -y install targetcli python-configshell python-rtslib python-six python-dbus
    One can consider doing 'yum -y update' of whole system as targetcli has many hidden dependencies
  2. Clear configuration using 'targetcli clearconfig confirm=true '
  3. Run 'targetcli' and configure it using:
    #Create file to be used as iscsi backstore
    cd /backstores
    fileio/ create test /opt/test.iscsi 100m
    ls
    #Note that we can also use block devices using /backstores/block
    #/opt/test.iscsi can also be created using
    #cd /opt
    #qemu-img create -f raw test.iscsi 100M
    cd /iscsi
    #This will create IQN number automatically
    #Ideally we should create different iqn numbers for every backstore
    #So that there is flexibility on client side. We can run
    #create multiple times to create different iqn numbers.
    create
    cd iqn.<press-tab-to-autocomplete>
    #Create lun
    cd tpg1/luns
    create /backstores/fileio/test
    #Allow client IQN numbers without authentication
    cd ../acls
    create <client1-iscsi-initiator-name>
    create <client2-iscsi-initiator-name>
    #Save and exit
    cd /
    saveconfig
    exit
    Client initiator name is located in file '/etc/iscsi/initiatorname.iscsi'. Take only value after 'InitiatorName=' starting with 'iqn.'
  4. Configure service to start on system boot and also start it for current run:
    systemctl enable target
    systemctl start target
  5. Disable firewall or given exception for port 3260
    systemctl disable firewalld
    systemctl stop firewalld



<yambe:breadcrumb>CentOS_7.x_iSCSI|CentOS 7.x iSCSI</yambe:breadcrumb>