Total Pageviews

Tuesday, December 21, 2010

RHEV ISCSI Storage Set up

Setting Up ISCSI Storage on RHEL5 for RHEV

In this section we are going to see how to make your existing RHEL5 Box as ISCSI server that serve as a storage to virtual machine running on Redhat Enterprise Virtualization .

The "scsi-target-utils" package allows a system to serve block-level SCSI storage to other systems that have an iSCSI initiator. This capability is initially deployed as a Linux iSCSI target, serving storage over a network to any iSCSI initiator.

Note: From RHEL5.3 and later you can use the configuration  file /etc/tgt/targets.conf provided by iscsi-target-utils to configure the target . And for older Release you have to use tgtadm .

 First Register your Host to RHN  Cluster Storage Child Channel or you can create your local repo if you are having an RHEL ISO DVD  with you .

Install the below packages.

yum install scsi-target-utils

rpm -ql iscsi-initiator-utils-6.2.0.868-0.18.el5

start and make the service on your required  run level

/etc/init.d/tgtd  start

chkconfig  tgtd on


Define the first target

tgtadm --lld iscsi --op new --mode target --tid=1  --targetname  rhev-dc1-data-disk1:iscsistorage1

To Show  the current Target Configuration

tgtadm --lld iscsi --op show --mode target

Now Attach the block device to the target . Here the block device we used is a simple raw logical volume named /dev/dc1vg0/dc1disk1

tgtadm --lld iscsi --op new --mode logicalunit --tid 1 --lun 1 -b /dev/dc1vg0/dc1disk1

Giving Full access of tid 1 to ALL IP or even you can restrict it only certain Initiator IP .

tgtadm --lld iscsi --op bind --mode target --tid 1 -I ALL

Finally use the below command to Show Target and details .

tgtadm --lld iscsi --op show --mode target

For RHEL5.2 and older release Put this on rc.local start up script so that when the iscsi target host reboots , it will exports the target after reboot .

[root@storage yum.repos.d]# echo >> /etc/rc.local <<EOF
>tgtadm --lld iscsi --op new --mode target --tid=1  --targetname  rhev-dc1-data-disk1:iscsistorage1
> tgtadm --lld iscsi --op new --mode logicalunit --tid 1 --lun 1 -b /dev/dc1vg0/dc1disk1
> tgtadm --lld iscsi --op bind --mode target --tid 1 -I ALL
> EOF
[root@storage yum.repos.d]#

From RHEL5.4 and later release  don't put in rc.local for iscsi instead run this below command.

tgt-admin  --dump

tgt-admin --dump > /etc/tgt/targets.conf

Iscsi Initiator Commands &  Troubleshooting

Note: If your host is RHEVM Managed please dont run any of the below command on the RHEV-H or RHEL Host which is acting as an hypervisor . 

This Section will be use full  only  If you are doing configuration on independent Client which is initiating(non RHEV Set Up) connection to iscsi target Server for general shared storage and for High Availability cluster .


After the software iSCSI target is setup, you can setup the iSCSI initiator on the remote host and login to this target

yum install iscsi-initiator-utils


Next, start the iscsid service and enable it to start when the system boots:


service iscsid start

chkconfig iscsid on



Then obtain a listing of available targets from a given host (please note that ipaddress listed below must be replaced with the resolvable hostname or ip address of the system providing the port if different than default):

 iscsiadm -m discovery -t sendtargets -p 192.168.100.1


Finally, use the following command to login to the available target (again, replace targetname with one from the output of the previous command and replace ipaddress below with that of the target system):
 

iscsiadm -m node -T rhev-dc1-data-disk1:iscsistorage1  -p  192.168.100.1  -l


To print all the logged in sessions


iscsiadm --mode node


To logout the existing connection

iscsiadm --mode node --targetname
rhev-dc1-data-disk1:iscsistorage1  --portal 192.168.100.1:3260 --logout


To prints out all the iscsi sessions info (what target and port we are connected to) and then prints out the disks accessed throught that session.

iscsiadm -m session -P 3



ISCSI Server (Target) Side Commands


To delete the luns

tgtadm --lld iscsi --op delete --mode=logicalunit --tid=1 --lun=1



To delete the particular target

tgtadm --lld iscsi --op delete --mode target --tid=1



Reference Links : 


https://access.redhat.com/kb/docs/DOC-19448
https://access.redhat.com/kb/docs/DOC-15154



1 comment:

Anonymous said...

What is the performance for iscsi vs nfs?