Monday, December 2, 2013

iSCSI Client configuration in RHEL6

Client side configuration

1| Install  iscsi-initiator-utils package on the client using yum

# yum install iscsi-initiator-utils

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 10.30.32.206

Starting iscsid:                                         [  OK  ]
10.30.32.206:3260,1 iqn.2008-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

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      VIRTUAL-DISK     0001 PQ: 0 ANSI: 5
Dec 26 14:22:50 localhost kernel: sd 3:0:0:1: Attached scsi generic sg5 type 0
Dec 26 14:22:50 localhost kernel: sd 3:0:0:1: [sdd] 6281352 512-byte 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 26 14:22:50 localhost libvirtd: 14:22:50.833: error : udevGetSCSIType:747 : Failed to find SCSI device type 12
Dec 26 14:22:50 localhost iscsid: Connection1:0 to [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

3| Creating file system

 we can create file system on /ded/sdd1 and use locally.

# mkfs.ext3 /dev/sdd1       
# mkdir iSCSI                      
# mount /dev/sdd1 /iSCSI/ 

4| 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        0 0”

# cat /etc/fstab

#
# /etc/fstab
# Created by anaconda on Thu Jun  2 00:41:38 2011
#
# Accessible filesystems, by 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 /                       ext4    defaults        1 1
UUID=9c732237-b39f-4024-a631-3c264e637179 /boot                   ext4    defaults        1 2
/dev/mapper/VolGroup-lv_swap swap                    swap    defaults        0 0
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
UUID=9674832d-c995-4ac8-b6da-0d25efa088d0 /iSCSI ext3   _netdev        0 0

The added entry is highlighted in the above output.

Note
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.

+JetStor iSCSI RAID +Red Hat +Linux 

No comments:

Post a Comment