Wednesday, May 12, 2010

How to attach or search a iscsi target device to a Linux machine

 To attach or search a iscsi target your machine should be configured as an iscsi initiator. There is a software in linux called iscsi-initiator-utils. You can either use rpm or compile the source to install it.

 #rpm -ivh iscsi-initiator-utils-6.2.0.865-0.8.el5.i386.rpm

 After installing iscsi-initiator-utils package, start the iscsid service. And set the chkconfig entry so that it will automatically start at the next reboot.

 # service iscsid start
 Turning off network shutdown. Starting iSCSI daemon: [ OK ]
 [ OK ]

 # chkconfig iscsid on
# chkconfig iscsi on

Searching the iscsi target:

# iscsiadm -m discovery -t sendtargets -p 192.168.0.27
You can also use port number if you want. As follows

# iscsiadm -m discovery -t sendtargets -p 192.168.0.27:3260
192.168.0.27:3260,1 iqn.2004-01.com.openfiler:oracle.rac.storage1

You will get the scanned result as the line above.

Loging in to the iscsi target:

# iscsiadm -m node -T 192.168.0.27:3260,1 iqn.2004-01.com.openfiler:oracle.rac.storage1 -p 192.168.0.27 -l

#fdisk -l
will list the iscsi targets now.


Best Reads:
1.  iSCSI: The Universal Storage Connection: The Universal Storage Connection
2.  Storage Networks Explained: Basics and Application of Fibre Channel SAN, NAS, iSCSI, InfiniBand and FCoE