How To Configure Iscsi Storage On Redhat Linux

April 11, 2012 | By in LINUX HOWTO, STORAGE | Reply More

Iscsi Storage Network

Here I am trying to explain Equallogic Lun configuration on Redhat Linux 5 version. Linux Iscsi Storage Lun Mapping is much simpler on Equallogic Storage Array. Free Open Isci tool is used as the iscsi initiator. Once installed you can use iscsiadm command to configure the Lun. Dell recommends to configure iscsi on redhat 5 or above version.

First you should create volumes on the storage group interface manager and then needs to maps those Luns to server. You need to mention either iscsi initiator name or IP address to map the Lun to the server(host). If you need any authentication you can use chap. Now you can move to Linux host for further iscsi configuration.

Show current installed redhat version and update

[root@BobTestBox ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 5.7 (Tikanga)

Display Architecture

[root@BobTestBox ~]# getconf LONG_BIT
64

Check isci initiator installed or not (You need iscsi-initiator-utils-6.2.0.742-0.6.el5 or greater)

[root@BobTestBox ~]# rpm -qa | grep -i iscsi
iscsi-initiator-utils-6.2.0.872-10.el5

Display interfaces and IP address details

[root@BobTestBox ~]# ifconfig -a | more
eth0 Link encap:Ethernet HWaddr 00:50:56:AB:00:E7
inet addr:172.28.*.* Bcast:172.28.12.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2503 errors:0 dropped:0 overruns:0 frame:0
TX packets:838 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:196784 (192.1 KiB) TX bytes:98212 (95.9 KiB)

eth1 Link encap:Ethernet HWaddr 00:50:56:AB:00:E8
inet addr:172.28.*.* Bcast:172.28.40.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:4237 errors:0 dropped:0 overruns:0 frame:0
TX packets:3807 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:966177 (943.5 KiB) TX bytes:359247 (350.8 KiB)

eth2 Link encap:Ethernet HWaddr 00:50:56:AB:01:00
inet addr:172.28.*.* Bcast:172.28.40.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:4387 errors:0 dropped:0 overruns:0 frame:0
TX packets:3960 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:894415 (873.4 KiB) TX bytes:384013 (375.0 KiB)

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:10 errors:0 dropped:0 overruns:0 frame:0
TX packets:10 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:660 (660.0 b) TX bytes:660 (660.0 b)

Creating the interface files for MPIO

[root@BobTestBox ~]# iscsiadm -m iface -I eth1 -o new
New interface eth1 added

[root@BobTestBox ~]# iscsiadm -m iface -I eth2 -o new
New interface eth2 added

Updating the interface name for each port

[root@BobTestBox ~]# iscsiadm -m iface -I eth1 -o update -n iface.net_ifacename -v eth1
eth1 updated.

[root@BobTestBox ~]# iscsiadm -m iface -I eth2 -o update -n iface.net_ifacename -v eth2
eth2 updated.

[root@BobTestBox ~]# cat /var/lib/iscsi/ifaces/eth1
# BEGIN RECORD 2.0-872
iface.iscsi_ifacename = eth1
iface.net_ifacename = eth1
iface.transport_name = tcp
# END RECORD
[root@localhost ~]# cat /var/lib/iscsi/ifaces/eth2
# BEGIN RECORD 2.0-872
iface.iscsi_ifacename = eth2
iface.net_ifacename = eth2
iface.transport_name = tcp
# END RECORD

Iscsi target Discovering using iscsiadm command

[root@BobTestBox ~]# iscsiadm -m discovery -t st -p 172.28.*.*:3260
172.28.*.*:3260,1 iqn.2001-05.com.equallogic:0-8a0906-a146b2a07-57858e634784f7b0-bobrhel
172.28.*.*:3260,1 iqn.2001-05.com.equallogic:0-8a0906-a146b2a07-57858e634784f7b0-bobrhel

Logging into target ( You have option to login individually also)

[root@BobTestBox ~]# iscsiadm -m node -l
Logging in to [iface: eth2, target: iqn.2001-05.com.equallogic:0-8a0906-a146b2a07-57858e634784f7b0-bobrhel, portal: 172.28.*.*,3260]
Logging in to [iface: default, target: iqn.2001-05.com.equallogic:0-8a0906-a146b2a07-57858e634784f7b0-bobrhel, portal: 172.28.*.*,3260]
Logging in to [iface: eth1, target: iqn.2001-05.com.equallogic:0-8a0906-a146b2a07-57858e634784f7b0-bobrhel, portal: 172.28.*.*,3260]
Login to [iface: eth2, target: iqn.2001-05.com.equallogic:0-8a0906-a146b2a07-57858e634784f7b0-bobrhel, portal: 172.28.*.*,3260] successful.
Login to [iface: default, target: iqn.2001-05.com.equallogic:0-8a0906-a146b2a07-57858e634784f7b0-bobrhel, portal: 172.28.*.*,3260] successful.
Login to [iface: eth1, target: iqn.2001-05.com.equallogic:0-8a0906-a146b2a07-57858e634784f7b0-bobrhel, portal: 172.28.*.*,3260] successful.
[root@BobTestBox ~]#

Display scsi attached device

[root@BobTestBox ~]# cat /proc/scsi/scsi
Attached devices:
Host: scsi0 Channel: 00 Id: 00 Lun: 00
Vendor: VMware Model: Virtual disk Rev: 1.0
Type: Direct-Access ANSI SCSI revision: 02
Host: scsi7 Channel: 00 Id: 00 Lun: 00
Vendor: EQLOGIC Model: 100E-00 Rev: 5.2
Type: Direct-Access ANSI SCSI revision: 05
Host: scsi6 Channel: 00 Id: 00 Lun: 00
Vendor: EQLOGIC Model: 100E-00 Rev: 5.2
Type: Direct-Access ANSI SCSI revision: 05
[root@BobTestBox ~]#

Below command will display Iscsi session details

[root@BobTestBox ~]# iscsiadm -m session
tcp: [6] 172.28.*.*:3260,1 iqn.2001-05.com.equallogic:0-8a0906-a146b2a07-57858e634784f7b0-bobrhel
tcp: [7] 172.28.*.*:3260,1 iqn.2001-05.com.equallogic:0-8a0906-a146b2a07-57858e634784f7b0-bobrhel
[root@BobTestBox ~]#

Display Disk details

Below command will display linux disk details that are known to kernel.

[root@BobTestBox ~]# fdisk -l

Disk /dev/sda: 5368 MB, 5368709120 bytes
255 heads, 63 sectors/track, 652 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 574 4610623+ 83 Linux
/dev/sda2 575 652 626535 82 Linux swap / Solaris

Disk /dev/dm-0: 1085 MB, 1085276160 bytes
255 heads, 63 sectors/track, 131 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/dm-0 doesn’t contain a valid partition table

Disk /dev/sde: 1085 MB, 1085276160 bytes
34 heads, 61 sectors/track, 1022 cylinders
Units = cylinders of 2074 * 512 = 1061888 bytes

Disk /dev/sde doesn’t contain a valid partition table

Disk /dev/sdf: 1085 MB, 1085276160 bytes
34 heads, 61 sectors/track, 1022 cylinders
Units = cylinders of 2074 * 512 = 1061888 bytes

Disk /dev/sdf doesn’t contain a valid partition table
[root@BobTestBox ~]#

Checking whether Equallogic Hit installed ( I have already installed HIT Kit 1.0.0- #rpm –ivh equallogic-host-tools-1.0.0-1.el5.x86_64.rpm )

[root@BobTestBox ~]# rpm -qa | grep -i equa
equallogic-host-tools-1.0.0-1.el5

Hit requires dkms 1.95 (Dynamic kernel module support) installed. ( I have already installed dkms – #rpm –ivh dkms-1.95.32-1.noarch.rpm )

[root@BobTestBox ~]# rpm -qa | grep -i dkms
dkms-1.95.32-1

Dkms module can be download from http://linux.dell.com/dkms/testing/permalink/

Restarting EHCMD service (dell multipath module )

[root@BobTestBox ~]# /etc/init.d/ehcmd restart
Stopping ehcmd: [FAILED]
Starting ehcmd: [ OK ]

Restarting Multipath deamon ( You can set alias ,uuid , device details , blacklist node in multhipath.conf file before restarting)

[root@BobTestBox ~]# /etc/init.d/multipathd restart
Stopping multipathd daemon: [FAILED]
Starting multipathd daemon: [ OK ]
[root@BobTestBox ~]#

Display multhipath details

[root@BobTestBox ~]# multipath -ll
Bob_rhel_lun () dm-0 EQLOGIC,100E-00
[size=1.0G][features=1 queue_if_no_path][hwhandler=0][rw]
\_ round-robin 0 [prio=2][enabled]
\_ 3:0:0:0 sdc 8:32 [active][ready]
\_ 1:0:0:0 sdd 8:48 [active][ready]
[root@BobTestBox ~]#

Device mapper target device status

[root@BobTestBox ~]# dmsetup ls –target=multipath
Bob_rhel_lun (253, 0)
[root@BobTestBox ~]#

Mounting the the filesystem. I have already formated the filesystem using mkfs command (mkfs.ext3 /dev/mapper/Bob_rhel_lun)

[root@BobTestBox ~]# mount /dev/mapper/Bob_rhel_lun /data

Display disk usage

[root@BobTestBox ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 4.3G 2.7G 1.5G 66% /
tmpfs 502M 0 502M 0% /dev/shm
/dev/mapper/Bob_rhel_lun 1019M 34M 934M 4% /data
[root@BobTestBox ~]#

For persistence on reboot , added mount point to fstab file

[root@BobTestBox ~]# cat /etc/fstab
LABEL=/ / ext3 defaults 1 1
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
LABEL=SWAP-sda2 swap swap defaults 0 0
/dev/mapper/Bob_rhel_lun /data ext3 defaults 0 0
[root@BobTestBox ~]#

Tags: , , ,

Category: LINUX HOWTO, STORAGE

Leave a Reply

Commenting Policy:
Promotion of your products ? Comment gets deleted.
All comments are subject to moderation.