configuring an openiscsi client on ubuntu server 7.04

We recently got a truck-load of storage set up in two giants SANs, and these are designed to be accessed by iSCSI. Configuration of our Ubuntu servers was easy enough, here's the recipe we used:

Getting the software
Ubuntu's repository contains a reasonably up-to-date version of openiscsi, so that's what we used. To install, simply update the repository cache and install:

sudo apt-get update
sudo apt-get install open-iscsi

Everything you need should now be configured and ready to go.

Checking the install
To check that things are installed and running:

sudo /etc/init.d/open-iscsi status

and if you need to start it up:

sudo /etc/init.d/open-iscsi start

At this point, the status should show that it is not connected to anything.

Getting the host details
Now we need to have some details before we can hook up to the SAN. To discover those details, all you need is the IP address of the iSCSI gateway:

sudo iscsiadm --mode discovery --type sendtargets --portal <ip address>

This will return a bunch of output along the following lines:

<ip address%gt;:<port>,0 iqn.1986-03.com.hp:fcgw.mpx100.1.500XXXbcab0.500XXXcaba
...
<ip address>:<port>,0 iqn.1986-03.com.hp:fcgw.mpx100.1.5000XXXbcab0.50001XXXbcabc

Take one of these lines, you'll need it for the next step.

Connecting to the SAN
Now for the magic:

sudo iscsiadm -m node -p <ip address> -T iqn.1986-
03.com.hp:fcgw.mpx100.0.5000XXX1270.50001XXX127e -l

Just replace your line with the above. And don't forget the '-l' in there, or it's not going to work!

Testing the connection
Now you should have another disk device that you can mount and use. Try using:

sudo fdisk -l

to see if the device is present, and try:

sudo /etc/init.d/open-iscsi status

to verify that the connection has been made. All that's left for you to do is to mount the device and presto! It appears has just another disk to the system.