Terms: target
is a server and initiator
is a client.
For permanent connect there're settings to be set up. Otherwise, it can be done with command line utilties:
- Fetch remote targets, so initiator knows about them:
iscsiadm -m discovery -t sendtargets -p IPAddr
- Connect to the target (the targetname and ip:port you should see in the output of the discovery command)
iscsiadm -m node --targetname iqn-of-target -p IP:port --login
- Find disks attached to the session:
iscsiadm -m session -P3
(there's a lot of output, but you should see words "attaced scsi disk X")
- there are various… I think it's called drivers — apps to provide iscsi targets. One that you likely to find in tutorials online is called
tgt
. Another one is scst. They seem to conflict with each another if you use them simultaneously, but I'm not sure, problems I had could've been caused by something else. - "iscsiadm: No portals found": I was getting this when trying to "discover" LUNs from a client. Debug logs of
iscsid
had nothing catchy. For me this was caused by lack of access in to LUN in target configuration for the client that ran discovery.
If you don't do this, the default
iface will be used.
iscsiadm -m iface -I iscsi01 --op=new
- Bind it to a network iface by its MAC:
iscsiadm -m iface -I iscsi01 --op=update -n iface.hwaddress -v 90:e2:ba:72:3a:74
- Am not sure on the relevance of this operation given the IP address is probably already assigned to the original iface, but: `iscsiadm -m iface -I iscsi01 --op=update -n iface.ipaddress -v 10.10.10.30**
Note: omit -I iscsi01
option if you skipped previous section.
- Server: create an iSCSI lun and give it access to the client by its IQN that can be found at
/etc/iscsi/initiatorname.iscsi
. - Client: discover IQNs available on the target:
iscsiadm -m discovery -I iscsi01 --op=new --op=del --type sendtargets --portal 10.10.10.26
. We sayiqn.myiqn
further to refer to the IQN you got here. - Client: log in to bring the target devices in
iscsiadm -m node --targetname iqn.myiqn --login -I iscsi01
- Client: now, list the devices
iscsiadm -m session -P3
. There will be a textAttached SCSI devices:
and then some information including the block-device names shall follow. - (optional): client: if you have multipath, then it should've automatically grouped the devices mentioned under
iscsiadm -m session -P3
, and thenmultipath -ll
should show what/dev/mapper/*
devices were created as result.
- Server: create a pool, volume.
- Server: go to
Protocols → iSCSI
, enable the service, create a LUN for the volume. - Create a client with IQN
- Client: open
Management panel → Initiator settings
, and clickConfiguration
tab. There should be a fieldinitiator name
with IQN of the machine. - Server, go to
Access → Clients and Groups
, create a client, and as an IQN enter the one we got from the Windows machine.
- Client: open
- Server: bind iscsi service to the IP addresses you gonna connect through.
- Server: bind the client created to the LUNs.
- Client, in the
Initiator settings
, go to tabEndpoints
, enter the server IP addresses and press Enter. That should open a prompt with IQNs available on the server, choose one, press ok. - (optional) Client: open
Computer management → Disks management
(or Rundiskmgmt.msc
), scroll at the lower half-screen the list of disks to the bottom, and find the new disk that should've appeared. Right-click its icon on the left, and pressInitialize
.