zoukankan      html  css  js  c++  java
  • iscsi使用教程(下)

    动态创建目标

    安装iscsi服务端

    # yum install -y scsi-target-utils.x86_64
    

    修改配置文件

    # mkdir -p ~/volumes
    # sed -i '$ i include /root/volumes/*' /etc/tgt/tgtd.conf
    

    启动服务

    ### 有告警是正常的,因为我们现在还没配置目标
    # tgtd -f --iscsi portal=92.0.0.14:3260
    tgtd: iser_ib_init(3436) Failed to initialize RDMA; load kernel modules?
    tgtd: work_timer_start(146) use timer_fd based scheduler
    tgtd: bs_init_signalfd(267) could not open backing-store module directory /usr/lib64/tgt/backing-store
    tgtd: bs_init(386) use signalfd notification
    

    新增磁盘并创建LV

    # pvcreate /dev/sda
    # vgcreate cinder-volumes /dev/sda
    # lvcreate -n vol cinder-volumes -L 1g
    

    创建目标配置文件

    # tee /root/volumes/vol.conf << EOF
    <target iqn.2010-10.org.openstack:vol>
        backing-store /dev/cinder-volumes/vol
        driver iscsi
        write-cache on
    </target>
    EOF
    

    动态更新目标

    # tgt-admin --update iqn.2010-10.org.openstack:vol
    

    查询目标信息

    # tgtadm --lld iscsi --op show --mode target
    Target 1: iqn.2010-10.org.openstack:vol
        System information:
            Driver: iscsi
            State: ready
        I_T nexus information:
        LUN information:
            LUN: 0
                Type: controller
                SCSI ID: IET     00010000
                SCSI SN: beaf10
                Size: 0 MB, Block size: 1
                Online: Yes
                Removable media: No
                Prevent removal: No
                Readonly: No
                SWP: No
                Thin-provisioning: No
                Backing store type: null
                Backing store path: None
                Backing store flags:
            LUN: 1
                Type: disk
                SCSI ID: IET     00010001
                SCSI SN: beaf11
                Size: 1074 MB, Block size: 512
                Online: Yes
                Removable media: No
                Prevent removal: No
                Readonly: No
                SWP: No
                Thin-provisioning: No
                Backing store type: rdwr
                Backing store path: /dev/cinder-volumes/vol
                Backing store flags:
        ### 允许连接的客户端用户名
        Account information:
        ### 允许连接的客户端地址
        ACL information:
            ALL
    

    安装客户端

    # yum install iscsi-initiator-utils.x86_64 -y
    

    发现目标

    # iscsiadm -m discovery -t sendtargets -p 92.0.0.14
    92.0.0.14:3260,1 iqn.2010-10.org.openstack:vol
    

    连接目标

    # iscsiadm -m node -T iqn.2010-10.org.openstack:vol -p 92.0.0.14 -l
    Logging in to [iface: default, target: iqn.2010-10.org.openstack:vol, portal: 92.0.0.14,3260] (multiple)
    Login to [iface: default, target: iqn.2010-10.org.openstack:vol, portal: 92.0.0.14,3260] successful.
    
    # iscsiadm -m session
    tcp: [1] 92.0.0.14:3260,1 iqn.2010-10.org.openstack:vol (non-flash)
    

    断开连接

    # iscsiadm -m node -T iqn.2010-10.org.openstack:vol -p 92.0.0.14 -u
    Logging out of session [sid: 2, target: iqn.2010-10.org.openstack:vol, portal: 92.0.0.14,3260]
    Logout of [sid: 2, target: iqn.2010-10.org.openstack:vol, portal: 92.0.0.14,3260] successful.
    
    # iscsiadm -m session
    iscsiadm: No active sessions.
    
  • 相关阅读:
    第01组 Alpha冲刺(4/6)
    第01组 Alpha冲刺(3/6)
    第01组 Alpha冲刺(2/6)
    第01组 Alpha冲刺(1/6)
    第01组 团队Git现场编程实战
    第01组 团队项目-需求分析报告
    团队项目-选题报告
    团队作业-选题报告
    第二次结对编程作业
    第09组 Alpha冲刺(5/6)
  • 原文地址:https://www.cnblogs.com/silvermagic/p/9087165.html
Copyright © 2011-2022 走看看