ISCSI Server Configuration In RHEL-6

iSCSI (Internet Small Computer System Interfac)
iSCSI is Internet SCSI (Small Computer System Interface), an Internet Protocol (IP)-based storage networking standard for linking data storage facilities by carrying SCSI commands over IP networks. iSCSI is used to facilitate data transfers over intranets and to manage storage over long distances. iSCSI makes block devices available via the network. We can mount block devices (disks) across an IP network to local system and then use them like any other block device. iSCSI is a client-server protocol. The server-side is referred to as the ‘target,’ while the client-side is referred to as the ‘initiator.’ Both the target and initiator are uniquely identified by a string called the iSCSI Qualified Name (iQN). Initiators come in two varieties: software and hardware. A software initiator is just a driver that handles all requests and pairs the network interfaces driver and the SCSI drivers together to make it work. Using a software initiator any system with an Ethernet card can act as an iSCSI initiator. A hardware initiator is an iSCSI HBA, which is basically just an ethernet card with a SCSI ASIC onboard. Here we are configuring software initiator in RHEL 6.

Packages- scsi-target-utils
Port No-     

Daemon-   tgtd
Script-       /etc/init.d/tgtd

Conf file- 

Configure iSCSI Server Side. 

Step-1. Install iSCSI Package-

# yum install scsi-target-utils

Step-2 Configure network with ipaddress and make sure that clients are reachable to the server. By default iSCSI will listen to the port 3260, we have to add necessary rules in iptables to allow iSCSI. Ignore this step if firewall is disabled.

# iptables -I INPUT -p tcp -m tcp –dport 3260 -j ACCEPT
# service iptables save 
# service iptables restart

Step-3. (Allocate storage for the LUNs)The iSCSI target service is not dependent on a particular type of exported LUN. The LUNs can be plain files, LVM volumes, or block devices. There is however a performance overhead if using the LVM and/or file system layers as compared to block devices. This example demonstrates the creation of a local partition /dec/sdb1 as iSCSI storage LUN.

Create a Partition  5G.

# fdisk /dev/sdb

Device Boot  Start End Blocks   Id 
System /dev/sdb1 1  391 3140676 83  Linux

# partx -a /dev/sdb

# mkfs.ext4 /dev/sdb1

  Step-4. Create a targets..

# vim /etc/tgt/targets.conf

    backing-store /dev/dev/sdb1
initiator-address    { For incominguser root redhat perticular system access}


The target attribute requires an iSCSI Qualified Name (IQN),following is the general format:
yyyy-mm represents the 4-digit year and 2-digit month the device was started (for example: 2014-03) is the hosts domain name in reverse. For example,, in an IQN, becomes com.example.server1;
OptionalIdentifierText is any text string, without spaces, that helps the administrator identifies which device.
Step- 5. Restart tgtd services..
# /etc/init.d/tgtd restart;chkconfig tgtd on

Step-6 Check Configuration

tgt-admin –show
Target 1:

    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

            Online: Yes

            Removable media: No

            Backing store type: rdwr

            Backing store path: None

        LUN: 1

            Type: disk

            SCSI ID: IET     00010001

            SCSI SN: beaf11

            Size: 5 GB

            Online: Yes

            Removable media: No

            Backing store type: rdwr

            Backing store path: /dev/sdb1

    Account information:

    ACL information:



Configure iSCSI Client Side.

Step-1 Install iSCSI package

# yum install iscsi-initiator-utils* 

Step-2 Discover the target LUN’s exported by server using following command. It will provide iqn name with of LUN associated with given ip address 

# iscsiadm -m discovery -t sendtargets -p
Starting iscsid:             [  OK  ],1

Note :

-p : it is indicates the address of target server.

Step-3. To connect iSCSI target
 # iscsiadm –mode node –targetname –portal –login

 Now iSCSI target is connected from ip

Step- 4. Create a File System..
 we can create file system on /ded/sdc1 and use locally
# fdisk -l                      
# fdisk /dev/sdc
create a +2G partion

# partx -a /dev/sdc

# mkfs.ext4 /dev/sdc1
#vim /etc/fstab

/dev/sdc1        /mnt             ext4         defaults                      0 0

# mount -a 
# touch test-1 test-2 test-3 test-4    (Now Create some file in /mnt )

# iscsiadm –mode node –targetname –portal –logout

#init 6                      (Restart System)

#cd /mnt            (Again Check it will show your data)

Leave a Reply

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