Connecting to an iSCSI server from Linux

IMPORTANT: never stop or kill the iscsid daemon while iSCSI disks are still present!

Introduction

This document describes how to connection to an iSCSI server using Open-iSCSI from a Linux machine. I will asume Open-iSCSI has alread been installed

First setup the Initiator name in /etc/iscsi/initiatorname.iscsi. For example:

InitiatorName=iqn.2001-04.org.gentoo:client
InitiatorAlias=client

Next setup authenticaion options in /etc/iscsi/iscsid.conf, if needed. For example:

node.session.auth.authmethod = CHAP
node.session.auth.username = username
node.session.auth.password = password

discovery.sendtargets.auth.authmethod = CHAP
discovery.sendtargets.auth.username = username
discovery.sendtargets.auth.password = password

Setting up iSCSI interface

Creating a new iSCSI interface

iscsiadm -m iface -I iface0 -o new

Configuring an existing iSCSI interface

iscsiadm -m iface -I iface0 -o update -n iface.initiatorname -v iqn.2001-04.org.gentoo:client This configures the interface initiatorname (sets it to qn.2001-04.org.gentoo:client in this example)

iscsiadm -m iface -I iface0 -o update -n iface.ipaddress -v 192.168.2.2

This configures interface iface0 to use 192.168.2.2 as the source IP address. It also possible to use the interface name (iface.net_ifacename) or MAC address (iface.hwaddress)

Showing iSCSI interface settings

Use iscsiadm -m iface -I iface0 -o show to show information about an interface (iface0 in this case).

Deleting an existing iSCSI interface

iscsiadm -m iface -I iface0 -o delete

Set up iSCSI target discovery

add iSCSI discovery target

Use the sendtargets method discover targets on 192.168.2.4, using the configured username / password:

iscsiadm -m discovery -t sendtargets -p 192.168.2.4:3260 -I iface0

show iSCSI discovery settings

iscsiadm -m discovery -p 192.168.2.4:3260

remove iSCSI discovery target

To disable discovery for the 192.168.2.4 target, use: iscsiadm -m discovery -o delete -p 192.168.2.4:3260

Connecting to iSCSI target disks

-- Ivo van Geel - 30 Dec 2011

Edit | Attach | Watch | Print version | History: r3 < r2 < r1 | Backlinks | Raw View | More topic actions
Topic revision: r3 - 15 Jul 2017 - IvoVanGeel
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2010-2019 by LANIS