iscsiadm用法


iscsiadm 用法


data from

Understanding iscsiadm Utility in CentOS / RHEL
Discovering iSCSI targets using Send Targets

mode

Use the iscsiadm utility to update, delete, insert, and query the persistent database. Also use this utility to establish a session between a target and an initiator. Several different operational modes are available for the command.

  • discoverydb: Updates or queries the Open-iSCSI database records
  • discovery: Performs a discovery operation
  • node: Performs an operation on a portal (IP:port) on an iSCSI target
  • session: Performs an operation on a TCP connection between an initiator and a target
  • iface: Performs an operation on a network interface

Additional options to iscsiadm include:

  • -type – Specify the discover type.
  • -portal – Specify the iSCSI target portal.

command

  1. Discover targets at a given IP address:

iscsiadm –mode discoverydb –type sendtargets –portal 192.168.1.10 –discover

  1. Login into a iscsi target (must use a node record id found by the discovery).

iscsiadm –mode node –targetname iqn.2001-05.com.doe:test –portal 192.168.1.1:3260 –login

  1. Logout from a iscsi target.

iscsiadm –mode node –targetname iqn.2001-05.com.doe:test –portal 192.168.1.1:3260 –logout

  1. List node records:

iscsiadm –mode node

  1. Display all data for a given node record:

iscsiadm –mode node –targetname iqn.2001-05.com.doe:test –portal 192.168.1.1:3260

command detail

specify the iSCSI qualified name (IQN)

指定特定的IQN,避免不同主机IQN冲突.
The initiator name that you choose must match the iSCSI name given to the Storwize® V7000 host object for this system.

Edit the /etc/iscsi/initiatorname.iscsi file to specify the IQN name. The following example shows a sample name:

InitiatorName=iqn.2012-02.com.ibm.de.boeblingen:01:c5f446d488f4

discovery command

Run the discovery command on linux host:

iscsiadm –mode discovery –type sendtargets –portal 192.0.2.* 复制
192.0.2.:3260,1 iqn.2012-02.com.ibm.de.boeblingen:2145.v7k01.node1
#where 192.0.2.
is the IP address of the iSCSI target on the Storwize V7000 clustered system.

When you use the discovery command, you can substitute:
* -m for –mode
* -t for –type
* -p for –portal

connect to a specific portal on a discovered target.

The Storwize® V7000 system supports only one iSCSI session between an initiator and a target.

On the Linux host, use the following command to log on to the Storwize V7000 system target:

iscsiadm –mode node –target –portal 192.0.2.* –login

# iscsiadm –mode node –target iqn.2012-02.com.ibm.de.boeblingen:2145.v7k01.node1 –portal 192.0.2.* –login
Logging in to [iface: default, target: iqn.2012-02.com.ibm.de.boeblingen:2145.v7k01.node1, portal: 192.0.2.,3260] (multiple)
Login to [iface: default, target: iqn.2012-02.com.ibm.de.boeblingen:2145.v7k01.node1, portal: 192.0.2.
,3260] successful.

When the login command completes, the device nodes for the Storwize V7000 system volumes that are mapped to the host are created on Linux host system.

lsscsi
[2:0:0:0] disk IBM 2145 0000 /dev/sda
[2:0:0:1] disk IBM 2145 0000 /dev/sdb 复制


Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: