Configuring iSCSI target on RHEL 6.4 (PowerLinux)
mhhaque 2700012HF4 Visits (22678)
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 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.4.
iptable Configuration (if required):
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
Install and enable the iSCSI target service:
Install and enable the iSCSI target service with the following commands
# rpm -ivh scs
# chkconfig tgtd on
# service tgtd start
Allocate storage for the LUNs:
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 LVM partition /dev
Create the targets:
Targets can be created by adding an XML entry to the /etc
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: 2011-07)
Need to restart tgtd service after configuring iscsi target
# service tgtd restart
Stopping SCSI target daemon:
Starting SCSI target daemon:
To confirm the successful operation , query the iSCSI target setup using following command
# tgt-admin --show
Client side configuration:
# rpm -ivh isc
# vim /etc
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 192.168.70.208
To connect iSCSI target we can use following command, we need to mention server ip and iqn name.
# iscsiadm -m node -T iqn.
# tail /var/log/messages
In this demo, iSCSI LUN is linked as /ded/sdb
Creating file system:
We can create file system on /ded/sdb and use locally
# mkfs.ext3 /dev
# mkdir /ipsan
# mount /dev
Adding entry in /etc/fstab:
Find out UUID of device using following command
# blkid /dev
Add the following entry in /etc/fstab using vi editor.
[root@dhcpserver /]# cat /etc/fstab
The added entry is highlighted in the above output.
We must use _netdev parameter while adding entry in /etc/fstab,Which is used to prevent the system from attempting to mount the file systems until the network has been enabled on the system.