linux_wiki:configure_a_system_as_either_an_iscsi_target_or_initiator_that_persistently_mounts_an_iscsi_target

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
linux_wiki:configure_a_system_as_either_an_iscsi_target_or_initiator_that_persistently_mounts_an_iscsi_target [2018/04/04 23:44]
billdozor [Create Back-end Storage]
linux_wiki:configure_a_system_as_either_an_iscsi_target_or_initiator_that_persistently_mounts_an_iscsi_target [2018/05/30 21:46]
billdozor [Configure the iSCSI Target]
Line 15: Line 15:
  
 ---- ----
 +
 +====== Help ======
 +
 +Finding help in this section.
 +  * iSCSI target (server)<code bash>#tab completion in targetcli utility</code>
 +  * iSCSI initiator (client)<code bash>man iscsiadm</code>
 +
 +----
 +
  
 ====== iSCSI Targets (Storage Server) ====== ====== iSCSI Targets (Storage Server) ======
Line 67: Line 76:
  
 \\ \\
-Create a block storage object within the targetcli interactive prompt+**Backing Storage:** Create a block storage object within the targetcli interactive prompt
 <code bash> <code bash>
-/> backstores/block create block1 /dev/vgsan/lvstor01+/> backstores/block create name=block1 dev=/dev/vgsan/lvstor01
 </code> </code>
   * backstores/block -> In the backstores block path   * backstores/block -> In the backstores block path
Line 76: Line 85:
  
 \\ \\
-Create an iSCSI Target IQN (Iscsi Qualified Name)+**iSCSI Target**: Create an iSCSI Target IQN (Iscsi Qualified Name)
 <code bash> <code bash>
-/>iscsi/ create iqn.2016-08.com.example.server2:target+/> iscsi/ create wwn=iqn.2018-05.com.example.server2:target
 </code> </code>
   * iscsi/ -> In the iscsi path   * iscsi/ -> In the iscsi path
-  * create iqn.2016-08.com.example.server2:target -> Create the IQN named "iqn.2016-08.com.example.server2:target"+  * create iqn.2018-05.com.example.server2:target -> Create the IQN named "iqn.2018-05.com.example.server2:target"
   * An IQN is how you refer to the target disk   * An IQN is how you refer to the target disk
     * All IQNs must start with "iqn"     * All IQNs must start with "iqn"
Line 91: Line 100:
 Change into the newly created IQN's TPG (Target Portal Group) and view the contents Change into the newly created IQN's TPG (Target Portal Group) and view the contents
 <code bash> <code bash>
-cd iqn.2016-08.com.example.server2:target/tpg1 +/> cd iscsi/iqn.2018-05.com.example.server2:target/tpg1/ 
-ls+/iscsi/iqn.20...2:target/tpg1> ls
 </code> </code>
   * Objects listed:   * Objects listed:
Line 98: Line 107:
     * luns (logical unit number or the exported resource)     * luns (logical unit number or the exported resource)
     * portals (IP addresses:ports to reach the exported resource)     * portals (IP addresses:ports to reach the exported resource)
 +      * **Note:** In some earlier versions (RHEL 7.0-7.1), a portal is NOT automatically created. This may need to be created manually.
  
 \\ \\
-Create a LUN within the target portal group+**Create portal: RHEL 7.0 - 7.1 only**
 <code bash> <code bash>
-/>luns/ create /backstores/block/block1+/iscsi/iqn.20...2:target/tpg1> portals create 0.0.0.0 ip_port=3260 
 +</code> 
 + 
 +\\ 
 +**LUN to Storage Map:** Create a LUN within the target portal group 
 +<code bash> 
 +/iscsi/iqn.20...2:target/tpg1> luns/ create /backstores/block/block1
 </code> </code>
   * luns/ -> In the luns path   * luns/ -> In the luns path
Line 108: Line 124:
  
 \\ \\
-Create an ACL for a client to be able to connect to the IQN in the future+**Client ACL:** Create an ACL for a client to be able to connect to the IQN in the future
 <code bash> <code bash>
-/>acls/ create iqn.2016-08.com.example:server1+/iscsi/iqn.20...2:target/tpg1> acls/ create iqn.2018-05.com.example:server1
 </code> </code>
   * acls/ -> In the acls path   * acls/ -> In the acls path
-  * create iqn.2016-08.com.example:server1 -> Create an ACL allowing this IQN+  * create iqn.2018-05.com.example:server1 -> Create an ACL allowing this IQN
     * This is a combination of a new IQN (following a similar naming convention) and an identifier of your choosing. Together, this makes up the **client iscsi initiator name** that will be used.     * This is a combination of a new IQN (following a similar naming convention) and an identifier of your choosing. Together, this makes up the **client iscsi initiator name** that will be used.
-    * iqn.2016-08.com.example -> IQN+    * iqn.2018-05.com.example -> IQN
     * :server1 -> an identifier of your choosing     * :server1 -> an identifier of your choosing
   * **Alternatively:** Instead of making of an IQN for the client, [[#configure_initiator_and_iscsid|see here to retrieve it]].   * **Alternatively:** Instead of making of an IQN for the client, [[#configure_initiator_and_iscsid|see here to retrieve it]].
Line 122: Line 138:
 **OPTIONAL**: Create a CHAP Username/Password for client connections **OPTIONAL**: Create a CHAP Username/Password for client connections
 <code bash> <code bash>
-/>cd acls/iqn.2016-08.com.example:server1/ +/iscsi/iqn.20...2:target/tpg1> cd acls/iqn.2018-05.com.example:server1/ 
-/>set auth userid=myuser +/iscsi/iqn.20...ample:server1> set auth userid=myuser password=mypassword
-/>set auth password=mypassword+
 </code> </code>
  
 \\ \\
 Save and exit the targetcli utility Save and exit the targetcli utility
-<code bash> +<code bash>/iscsi/iqn.20...ample:server1> cd / 
-/>saveconfig +/> saveconfig 
-/>exit+/> exit
 </code> </code>
  
Line 173: Line 188:
 vim /etc/iscsi/initiatorname.iscsi vim /etc/iscsi/initiatorname.iscsi
  
-InitiatorName=iqn.2016-08.com.example:server1+InitiatorName=iqn.2018-05.com.example:server1
 </code> </code>
   * Identifying client information needed to mount the disk   * Identifying client information needed to mount the disk
Line 191: Line 206:
 Enable and start the iscsi service Enable and start the iscsi service
 <code bash> <code bash>
-systemctl enable iscsid +systemctl enable iscsi 
-systemctl start iscsid+systemctl start iscsi
 </code> </code>
  
Line 209: Line 224:
  
 \\ \\
-Login to the Target IQN+Login to the Target IQN (found during discovery)
 <code bash> <code bash>
-iscsiadm --mode node --target iqn.2016-08.com.example.server2:target --portal 192.168.1.151 --login+iscsiadm --mode node --target iqn.2018-05.com.example.server2:target --portal 192.168.1.151 --login
 </code> </code>
   * Default port is 3260 if not specified   * Default port is 3260 if not specified
  • linux_wiki/configure_a_system_as_either_an_iscsi_target_or_initiator_that_persistently_mounts_an_iscsi_target.txt
  • Last modified: 2019/05/25 23:50
  • (external edit)