You are on page 1of 5

iSCSI server configuration in RHEL6

Page 1 of 5

iSCSI server configuration in RHEL6


Configuring iSCSI target on RHEL 6

Introduction: 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 serverside 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. OS installation: Install RHEL 6 on the server with basic server installation and configure yum server on the machine. Network setup: 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 Install and enable the iSCSI target service: Install and enable the iSCSI target service with the following commands # yum install scsi-target-utils # chkconfig tgtd on # service tgtd start 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/sdc1 as iSCSI storage LUN

http://advancelinux.blogspot.in/2012/02/configuring-on-rhel-6-introduction.html

4/19/2013

iSCSI server configuration in RHEL6

Page 2 of 5

# fdisk -l /dev/sdc Disk /dev/sdc: 3221 MB, 3221225472 bytes 255 heads, 63 sectors/track, 391 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0xc9a1606e Device Boot System /dev/sdc1 Linux 1 391 3140676 83 Start End Blocks Id

Create the targets:


Targets can be created by adding an XML entry to the /etc/tgt/targets.conffile, using text editor. Following entries to be added. #vi /etc/tgt/targets.conf

default-driver iscsi <target iqn.2008-09.com.example:server.target1> backing-store /dev/sdc1 write-cache off </target>


Note: The target attribute requires an iSCSI Qualified Name (IQN),following is the general format: iqn.yyyy-mm.reversed.domain.name:OptionalIdentifierText yyyy-mm represents the 4-digit year and 2-digit month the device was started (for example: 2011-07) reversed.domain.name is the hosts domain name in reverse. For example, server1.example.com, in an IQN, becomes com.example.server1; OptionalIdentifierText is any text string, without spaces, that helps the administrator identifies which device.

Restart tgtd service: Need to restart tgtd service after configuring iscsi target # service tgtd restart

Stopping SCSI target daemon: Starting SCSI target daemon:


Checking configuration:

[ [

OK OK

] ]

To confirm the successful operation , query the iSCSI target setup using following command

http://advancelinux.blogspot.in/2012/02/configuring-on-rhel-6-introduction.html

4/19/2013

iSCSI server configuration in RHEL6

Page 3 of 5

# tgt-admin --show Target 1: iqn.2008-09.com.example:server.target1 System information: Driver: iscsi State: ready I_T nexus information: LUN information: LUN: 0 Type: controller SCSI ID: IET 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 SCSI SN: beaf11 Size: 3216 MB Online: Yes Removable media: No Backing store type: rdwr Backing store path: /dev/sdc1 Account information: ACL information: ALL Client side configuration: 1 ) Install iscsi-initiator-utils package on the client using yum # yum install iscsi-initiator-utils 2 )Discover the target LUNs 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 10.30.32.206 00010001 00010000

Starting iscsid: [ 09.com.example:server.target1t Note :


-p : it is indicates the address of target server. 3) To connect iSCSI target we can use following command , we need to mention server ip and iqn name. # iscsiadm -m node -T iqn.2008-09.com.example:server.target1 p 10.30.32.206 login

OK

10.30.32.206:3260,1 iqn.2008-

http://advancelinux.blogspot.in/2012/02/configuring-on-rhel-6-introduction.html

4/19/2013

iSCSI server configuration in RHEL6

Page 4 of 5

Note :
-p : it is indicates the address of target server. -T : This option specifies iqn of target server Now iSCSI target is connected from ip 10.30.32.206.To find out the device associated with the iSCSI LUN. We have to check /var/log/message # tail /var/log/messages Dec 26 14:22:50 localhost kernel: scsi 3:0:0:0: Attached scsi generic sg4 type 12 Dec 26 14:22:50 localhost kernel: scsi 3:0:0:1: Direct-Access IET Dec 26 VIRTUAL-DISK 14:22:50 0001 PQ: 0 ANSI: 5 kernel: sd 3:0:0:1: Attached scsi localhost

generic sg5 type 0 Dec 26 14:22:50 localhost kernel: sd 3:0:0:1: [sdd] 6281352 512byte logical blocks: (3.21 GB/2.99 GiB) Dec 26 14:22:50 localhost kernel: sd 3:0:0:1: [sdd] Write Protect is off Dec 26 14:22:50 localhost kernel: sd 3:0:0:1: [sdd] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA Dec 26 14:22:50 localhost kernel: sdd: sdd1 Dec 26 14:22:50 localhost kernel: sd 3:0:0:1: [sdd] Attached SCSI disk Dec Dec 26 26 14:22:50 14:22:50 localhost localhost libvirtd: iscsid: 14:22:50.833: to error : udevGetSCSIType:747 : Failed to find SCSI device type 12 Connection1:0 [target: iqn.2008-09.com.example:server.target1, portal: 10.30.32.206,3260] through [iface: default] is operational now In this demo, iSCSI LUN is linked as /ded/sdd1 Creating file system: we can create file system on /ded/sdd1 and use locally. # mkfs.ext3 /dev/sdd1 # mkdir iSCSI # mount /dev/sdd1 /iSCSI/ Adding entry in /etc/fstab: Find out UUID of device using following command # blkid /dev/sdd1 /dev/sdd1: UUID="9674832d-c995-4ac8-b6da-0d25efa088d0" TYPE="ext3" Add the following entry in /etc/fstab using vi editor. UUID=9674832d-c995-4ac8-b6da-0d25efa088d0 /iSCSI ext3 _netdev [root@dhcpserver /]# cat /etc/fstab # # /etc/fstab 0 0

http://advancelinux.blogspot.in/2012/02/configuring-on-rhel-6-introduction.html

4/19/2013

iSCSI server configuration in RHEL6

Page 5 of 5

# Created by anaconda on Thu Jun # # Accessible filesystems, by

2 00:41:38 2011 reference, are maintained under

'/dev/disk' # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info # /dev/mapper/VolGroup-lv_root defaults ext4 defaults tmpfs defaults devpts gid=5,mode=620 sysfs defaults proc defaults _netdev 0 0 /iSCSI ext3 0 0 0 0 /proc proc 0 0 /sys sysfs 0 0 /dev/pts devpts defaults 0 0 /dev/shm tmpfs 1 1 /boot swap 1 2 swap / ext4

UUID=9c732237-b39f-4024-a631-3c264e637179 /dev/mapper/VolGroup-lv_swap

UUID=9674832d-c995-4ac8-b6da-0d25efa088d0

The added entry is highlighted in the above output. Note: We must use _netdevparameter 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.

http://advancelinux.blogspot.in/2012/02/configuring-on-rhel-6-introduction.html

4/19/2013

You might also like