Centos ISCSI initiator

Posted by Dark Training on January 8, 2010 tags: | linux | centos

To mount and use an ISCSI volume you'll need to install the following tools:

yum install iscsi-initiator-utils

Now locate the targets (drives) on the ISCSI server.

/sbin/iscsiadm -m discovery -t sendtargets -p 192.168.0.4
/etc/init.d/iscsi restart

Once the above starts ok, you can use fdisk -l to see your new disk, then just format and treat it as you would any other disc.


I ran into an interesting problem on one clients configuration though, the client had a ISCI server behind a NAT router. When the CentOS box would try to connect I would get the following eror:

iscsiadm: Could not login to [iface: default, target: iqn.1986-03.com.sun:02:8c8d457f-bd70-4b0f-8f8a-xxxx, portal: 192.168.0.101,3260]:
iscsiadm: initiator reported error (8 - connection timed out)
iscsiadm: Could not log into all portals. Err 8.

It took forever to figure out what was going on, I had to do TCP dumps and finally relized what was going wrong, while the discovery worked correctly, when the client tried to connect to the server, it was sending the request to the NAT address, and that client and server where on different networks. So I edited the config file for that node:

sudo nano /var/lib/iscsi/nodes/<strong>IQN name/IP-address</strong>/default

Then I looked for the following lines: node.discovery_address = xxx.xxx.xxx.xxx node.conn[0].address = 192.168.0.101 I then changed the 2nd line to match the top line, ran /etc/init.d/iscsi restart and BOOM, she was working like a champ!