IBM Cloud Docs
标识 LUN

标识 LUN

存在各种原因,导致您希望在计算主机上查找连接的存储卷的 LUN 标识。 例如,您可能有多个存储设备安装在具有相同卷大小的同一主机上。 您想要拆离并停用其中一个。 但是,您不确定如何将您在 Linux® 主机上看到的内容与控制台中看到的内容相关联。 另一个例子可能是,您有多个 Block Storage for Classic 卷附加到ESXi服务器上。 您想要扩展其中一个 LUN 的卷大小,并且需要知道要执行此操作的存储器的正确 LUN 标识。

在 Linux® 中查看 LUN 标识

  1. 在命令行中,运行 multipath -ll 并查看输出。

    root@server:~# multipath -l
    3600a098038303845372b4a5232346e35 dm-0 NETAPP ,LUN C-Mode
    size=12T features='4 queue_if_no_path pg_init_retries 50 retain_attached_hw_handle' hwhandler='1 alua' wp=rw
    -+- policy='round-robin 0' prio=50 status=active
    - `1:0:0:0 sdc 8:32 active ready running`
    3600a098038304471562b4c4743384332 dm-1 NETAPP ,LUN C-Mode
    size=12T features='4 queue_if_no_path pg_init_retries 50 retain_attached_hw_handle' hwhandler='1 alua' wp=rw
    -+- policy='round-robin 0' prio=10 status=active
    `- 3:0:0:1 sdd 8:48 active ready running`
    

    请注意 "1:0:0:0" 和 "3:0:0:1"。 这些字段中的最后一个数字 "1:0:0:0" 和 "3:0:0:1","0" 和 "1" 是块存储设备的 iscsi LUN 标识号。

  2. 输入以下 ibmcloud cli 命令: ibmcloud sl block volume-listibmcloud sl block volume-detail 以将其输出与您在步骤 1 中收集的信息进行比较。

    $ ibmcloud sl block volume-list
    id       username          datacenter storage_type              capacity_gb bytes_used lunId
    20973781 IBM02SEL1575811-1 dal09      endurance_block_storage   100           -          3
    22030583 IBM02SEL1575811-3 dal12      endurance_block_storage   20            -          0
    23976093 IBM02SEL1575811-4 dal12      performance_block_storage 80            -          1
    24024217 IBM02SEL1575811-5 seo01      performance_block_storage 2000          -          2
    
    $ ibmcloud sl block volume-detail 22030583
    Name                       Value
    ID                         22030583
    User name                  IBM02SEL1575811-3
    Type                       endurance_block_storage
    Capacity (GB)              20
    LUN Id                     0
    Endurance Tier             READHEAVY_TIER
    Endurance Tier Per IOPS    2
    Datacenter                 dal12
    Target IP                  161.26.110.17
    Snapshot Size (GB)         5
    Snapshot Used (Bytes)      3325952
    # of Active Transactions   0
    Replicant Count            0
    

    输出显示存储设备的主机名,LUN 标识和目标 IP:

    IBM02SEL1575811-3 lun id: 0 Target IP: 161.26.110.17
    IBM02SEL1575811-4 lun id: 1 Target IP: 161.26.110.43
    
  3. 您可以使用以下命令 iscsiadm -m session -P 3 进一步确认此信息。

    # iscsiadm -m session -P 3
    iSCSI Transport Class version 2.0-870
    version 6.2.0.874-7
    Target: iqn.1992-08.com.netapp:stfdal1201 (non-flash)
    Current Portal: 161.26.110.17:3260,1027 # match this target iscsi IP to the block storage device
    Persistent Portal: 161.26.110.17:3260,1027
    **********
    Interface:
    **********
    Iface Name: default
    Iface Transport: tcp
    Iface Initiatorname: iqn.2018-08.com.ibm:ibm02su1575811-i117305979
    Iface IPaddress: 10.74.10.67
    Iface HWaddress: <empty>
    Iface Netdev: <empty>
    SID: 1
    iSCSI Connection State: LOGGED IN
    iSCSI Session State: LOGGED_IN
    Internal iscsid Session State: NO CHANGE
    *********
    Timeouts:
    *********
    Recovery Timeout: 5
    Target Reset Timeout: 30
    LUN Reset Timeout: 30
    Abort Timeout: 15
    *****
    CHAP:
    *****
    username: IBM02SU1575811-I117305979
    password: ********
    username_in: <empty>
    password_in: ********
    ************************
    Negotiated iSCSI params:
    ************************
    HeaderDigest: None
    DataDigest: None
    MaxRecvDataSegmentLength: 262144
    MaxXmitDataSegmentLength: 65536
    FirstBurstLength: 65536
    MaxBurstLength: 65536
    ImmediateData: Yes
    InitialR2T: No
    MaxOutstandingR2T: 1
    ************************
    Attached SCSI devices:
    ************************
    Host Number: 1 State: running
    scsi1 Channel 00 Id 0 Lun: 0 # match the "Lun: 0" here to the LUN ID.
    Attached scsi disk sdc State: running
    
    Current Portal: 161.26.110.43:3260,1041 # match this target iscsi IP to the block storage device.
    Persistent Portal: 161.26.110.43:3260,1041
    **********
    Interface:
    **********
    Iface Name: default
    Iface Transport: tcp
    Iface Initiatorname: iqn.2018-08.com.ibm:ibm02su1575811-i11730597
    Iface IPaddress: 10.74.10.67
    Iface HWaddress: <empty>
    Iface Netdev: <empty>
    SID: 3
    iSCSI Connection State: LOGGED IN
    iSCSI Session State: LOGGED_IN
    Internal iscsid Session State: NO CHANGE
    *********
    Timeouts:
    *********
    Recovery Timeout: 5
    Target Reset Timeout: 30
    LUN Reset Timeout: 30
    Abort Timeout: 15
    *****
    CHAP:
    *****
    username: IBM02SU1575811-I117305979
    password: ********
    username_in: <empty>
    password_in: ********
    ************************
    Negotiated iSCSI params:
    ************************
    HeaderDigest: None
    DataDigest: None
    MaxRecvDataSegmentLength: 262144
    MaxXmitDataSegmentLength: 65536
    FirstBurstLength: 65536
    MaxBurstLength: 65536
    ImmediateData: Yes
    InitialR2T: No
    MaxOutstandingR2T: 1
    ************************
    Attached SCSI devices:
    ************************
    Host Number: 3 State: running
    scsi3 Channel 00 Id 0 Lun: 1 # match the "Lun: 1" here to the LUN ID.
    Attached scsi disk sdd State: running
    

在 Windows 中查看 LUN 标识

  1. 在PowerShell,发出命令iscsicli SessionList| findstr /c:"Device Number" /c:"Location" /c:"Target Portal"。 输出显示 IP 地址和 LUN 标识。 在此示例中,IP 地址为 10.201.174.123,LUN 标识为 LUN 0。

    C:\Users\Adminisitrator>iscsicli SessionList| findstr /c:"Device Number" /c:"Location"  /c:"Target Portal"
       Target Portal    : 10.201.174.124/3260
       Device Number    : 3
       Location         : Bus Number 0, Target Id O, LUN 0
       Target Portal    : 10.201.174.123/3260
       Device Number    : 4
       Location:        : Bus Number 0, Target ID 1, LUN 0
    
  2. 然后,输入以下 ibmcloud cli 命令: ibmcloud sl block volume-listibmcloud sl block volume-detail 以将其输出与您在步骤 1 中收集的信息进行比较。

    $ ibmcloud sl block volume-list
    id        username           datacenter storage_type            capacity_gb bytes_used lunId
    333280508 SL02SEL1160157-221 dal10      endurance_block_storage 200         -          0
    333506786 SL02SEL1160157-222 tok02      endurance_block_storage 200         -          0
    
    $ ibmcloud sl block volume-detail 333506786
    Name                       Value
    ID                         333506786
    User name                  SL02SEL1160157-222
    Type                       endurance_block_storage
    Capacity (GB)              200
    LUN Id                     0
    Endurance Tier             READHEAVY_TIER
    Endurance Tier Per IOPS    2
    Datacenter                 tok02
    Target IP                  10.201.174.123
    # of Active Transactions   0
    Replicant Count            0
    

在 VMWare ® 中查看 LUN 标识

  1. 运行 esxcli storage vmfs extent list 命令。 输出包含卷名 iscsi-datastore 及其唯一的网络寻址权限 (naa) 标识。 保证该数字对于该 LUN 是唯一的。

    Volume Name     VMFS UUID                           Extent Device Name                     Partition
                                                        Number
    --------------- ----------------------------------- ------ ------------------------------------ ----
    datastore1      5f69774e-f1031e44-7bdb-ac1f6bc4b812      0 naa.600062b2049d040026fc1e4b2f305682    3
    iscsi-datastore 621f425f-0dc2da8a-927b-ac1f6bc4b812      0 naa.600a098038305674695d51694b427849    1
    
  2. 接下来,输入 esxcfg-mpath -b 命令。 输出包含相同的 naa 编号,LUN 标识和 PortalTag。

    naa.600a098038305674695d51694b427849 : NETAPP iSCSI Disk (naa.600a098038305674695d51694b427849)
       vmhba64:C0:T1:L0 LUN:0 state:active iscsi Adapter: iqn.2020-10.com.ibm:sl02su1160157-h1907004
       Target: IQN=iqn.1992-08.com.netapp:stfdal1007 Alias= Session=00023d000001 PortalTag=1034
       vmhba64:C1:T1:L0 LUN:0 state:active iscsi Adapter: iqn.2020-10.com.ibm:sl02su1160157-h1907004
       Target: IQN=iqn.1992-08.com.netapp:stfdal1007 Alias= Session=00023d000002 PortalTag=1030
    

    在此示例中,字符串 LUN:0 表示 LUN 标识为 0。

  3. 发出 esxcli iscsi adapter target portal list 命令。 从输出中,记下与 Portal 标记匹配的 IP 地址和 Tpgt 值。

    Adapter  Target                             IP             Port  Tpgt
    -------  ---------------------------------  -------------  ----  ----
    vmhba64  iqn.1992-08.com.netapp:stfdal1007  161.26.99.155  3260  1034
    vmhba64  iqn.1992-08.com.netapp:stfdal1007  161.26.99.152  3260  1030
    

    在此示例中,IP 地址 "161.26.99.155" 是 Block Storage for Classic 的目标 IP 地址,"1034" 是 PortalTag。

  4. 接下来,使用 IBMCLOUD CLI 命令 ibmcloud sl block volume-list。 输出内容包括卷ID、存储设备的主机名、直流位置、存储类型、容量、已用空间量以及LUN ID。

    $ ibmcloud sl block volume-list
    id        username           datacenter storage_type            capacity_gb bytes_used lunId
    221426384 SL02SEL1160157-195 che01      endurance_block_storage 1500         -          2
    332299016 SL02SEL1160157-220 dal13      endurance_block_storage 20           -          2
    333280508 SL02SEL1160157-221 dal10      endurance_block_storage 200          -          0
    

    在此示例中,字符串 "333280508" 是卷标识,"0" 是 Block Storage for Classic LUN 的 LUN 标识。

    发出命令 ibmcloud sl block volume-detail 以获取有关存储卷的更多详细信息。

    $ ibmcloud sl block volume-detail 333280508
    Name                       Value
    ID                         333280508
    User name                  SL02SEL1160157-221
    Type                       endurance_block_storage
    Capacity (GB)              200
    LUN Id                     0
    Endurance Tier             READHEAVY_TIER
    Endurance Tier Per IOPS    2
    Datacenter                 dal10
    Target IP                  161.26.99.155
    # of Active Transactions   0
    Replicant Count            0
    

    因此,您可以将 iscsi LUN 标识映射到块设备的主机名:

    SL02SEL1160157-221  lun id: 0  Target IP: 161.26.99.155
    

在控制台中查看 LUN ID

您还可以收集 LUN ID、目标 IP 地址和主机名Block Storage for Classic控制台中的卷详情页面上的设备。

控制台中的“卷详细信息”页面提供了有关 LUN 的详细信息。 存储卷名称与名称标签一起显示。 目标IP地址标记为“目标地址”。 LUN ID显示为卷ID。
控制台的“卷详细信息”页面提供了有关 LUN 的详细信息。