Friday, March 21, 2008

Linux iSCSI Howto

Now that I am working with VMWare Virtual Infrastructure 3, I've had a crash course in iSCSI storage. As a result, I've been working on implementing iSCSI in my own "datacenter" (ie: basement) The first step (paradoxically) was to connect a Linux client to an existing host. Luckily, I'm able to use the companies datacenter resources for R&D.

It took several howto's and hacking around, but once I found all the pieces, it was actually quite simple. Using Fedora 6 as a base, the first step was to install the iSCSI RPMs:
lsscsi
iscsi-initiator-utils
(lsscsi may not be necessary, but let's be safe for now)

In the /etc/iscsi directory are two files. We need to add the host IP and port as the first two directives of the iscsid.conf.
isns.address = 172.16.1.110
isns.port = 3260
Next, change initiatorname.iscsi to contain the name defined on the host.
InitiatorName=iqn.2007-09.vm.vi3:esx7
Start the service and execute a sendtargets request:
# service iscsi start
# iscsiadm -m -discovery -t sendtargets -p 172.16.1.131
(Yes, the IP's are different. For some reason, I have to initiate to one NAS in order to connect to the other.)
Now I see the LUNs, but what about the devices? An fdisk -l sees the .110 NAS which was defined, but not the .131 NAS, which was discovered. We could be reboot, but this is Linux, not Windows! Let's try:
# service iscsi restart
Whoa! Look at all that output. Another fdisk -l now sees the devices.

Set the service to start at boot time, and we are in business:
# chkconfig iscsi on

No comments:

Post a Comment