zoukankan      html  css  js  c++  java
  • 转:Target Daemon (tgtd) tgtadm

    see also :http://inqbus-hosting.de/support/dokumentation/docs/target-daemon-tgtd-tgtadm 

    The target daemon is used to export storage targets to other hosts through the network.

    To take control of the target daemon you have to use the tgtadm command line utility.

     

    What you can do with tgtadm:

     

    Show Targets

    #: tgtadm --lld iscsi --op show --mode target

    This command shows all current activated targets with their properties and active connections.

    The output seems like the following:

    Target 1: test1
    System information:
    Driver: iscsi
    State: ready
    I_T nexus information:
    I_T nexus: 5
    Initiator: iqn.1993-08.org.debian:01:8ced5dd1388
    Connection: 0
    IP Address: 192.168.2.219
    LUN information:
    LUN: 0
    Type: controller
    SCSI ID: deadbeaf1:0
    SCSI SN: beaf10
    Size: 0 MB
    Online: Yes
    Removable media: No
    Backing store: No backing store
    LUN: 1
    Type: disk
    SCSI ID: deadbeaf1:1
    SCSI SN: beaf11
    Size: 4295 MB
    Online: Yes
    Removable media: No
    Backing store: /dev/vg0/testvm1
    Account information:
    ACL information:
    192.168.2.219
    • In the first line you can get the target id (number) and the target name (here the id is 1 and the name is test1)
    • At the I_T nexus information part you can get an overview of currently connected hosts (here one host with the ip 192.168.2.219 is connected to this target)
    • The LUN 0 is the controller
    • At the LUN 1 part (should be 1 in every case) you can get information of the target like (the device which represents the target, if it is online, the size, ...)
    • At the lowest part of the output you can get the acl information. Only the hosts/networks which are represented here are allowed to discover and login to this target (here only the host with the ip 192.168.2.219 is allowed to do something with the target)

     

    Create a new target

    To create a new target the following 2 steps have to be performed:

     

    Create an empty target

    tgtadm --lld iscsi --op new --mode target --tid {tid} -T {target_name}
    • The tid is a numeric unique identifier for the target
    • The name is a freely choosable name for the target

     

    Create a LUN for the target

    tgtadm --lld iscsi --op new --mode logicalunit --tid {tid} --lun {lun} -b {block_device}
    • The tid is the identifier you have given at the creation process of the target
    • The lun number should be 1
    • The block_device parameter is the absolute path to device-file which is located in /dev

     

    Before the target can be accessed by any host you have to add acl rules.

     

    Access Control List - ACL

     

    Set/Add a new ACL rule

    tgtadm --lld iscsi --op bind --mode target --tid {tid} -I {ip_range}
    • tid is the identifier for the target you want to modify
    • ip_range can be one of the following:
      • a single ip (like "192.168.2.123")
      • a network (like "192.168.2.0/24")
      • "ALL" to deactivate address controlling

     


    Delete a current existing ACL rule

    tgtadm --lld iscsi --op unbind --mode=target --tid={tid} --initiator-address={ip_range}
    • tid is the identifier for the target you want to modify
    • ip_range can be one of the following:
      • a single ip (like "192.168.2.123")
      • a network (like "192.168.2.0/24")
      • "ALL" to deactivate address controlling

     

    Delete a target

    tgtadm --lld iscsi --op delete --mode target --tid {tid}
    • tid is the identifier of the target you want to delete

     

    This removes the target from the active targets list. After running this command you can't see the target by running the show targets command.

     

    Disconnect a client

    tgtadm --op delete --mode conn --tid {tid} --sid {sid} --cid {cid}
    • tid is the identifier for the target on which you want to disconnet a client.
    • sid is the session id of the connected client. You can get this numerical identifier from the output of the show targets command. The number is at the end of the I_T nexus line. In the example at the top of the page the sid is 5.
    • cid is the connection id of the connected client.  You can get this numerical identifier from the output of the show targets command. The number is at the end of the "Connection" line. In the example at the top of the page the sid is 0.

     

    Before disconnection a client you should delete the acl of the client you want to disconnect. If you don't do this the client starts reconnecting after the connection was broken. The result is a new connection from the client with new sid and cid.

  • 相关阅读:
    Leetcode100.相同的树
    Leetcode53. 最大子序列和
    Leetcode35. 搜索插入位置
    Leetcode27.移除元素
    Leetcode 26. 删除排序数组中的重复项
    Leetcode. 1290 二进制链表转整数
    Leetcode.234 回文链表
    Leetcode206.反转链表
    课本 求素数
    循环法求素数 1306 循环求素数10.1.5.253 ====== 1313 筛选法求素数10.1.5.253
  • 原文地址:https://www.cnblogs.com/jjkv3/p/2780620.html
Copyright © 2011-2022 走看看