美文网首页存储
IP-SAN存储配置使用(iscsi)

IP-SAN存储配置使用(iscsi)

作者: xlgao | 来源:发表于2020-11-25 13:02 被阅读0次

    一. 服务端配置target

    1. systemctl start target
      systemctl enable target
    2. target配置
    
    [root@localhost txn]# targetcli
    />
    ## 创建block关联磁盘
    /> /backstores/block create block1 /dev/sdb1
    Created block storage object block1 using /dev/sdb1.
    />
    ## 创建target
    /> /iscsi create iqn.2020-11.25.com:disk
    Created target iqn.2020-11.25.com:disk.
    Created TPG 1.
    Global pref auto_add_default_portal=true
    Created default portal listening on all IPs (0.0.0.0), port 3260.
    
    ## 创建acl
    
    />iscsi/iqn.2020-11.25.com:disk/tpg1/acls
    create
    iqn.2020-11.25.com:nfsacl
    Created Node ACL for iqn.2020-11.25.com:nfsacl
    
    ## 创建lun关联block和target
    
    />
    iscsi/iqn.2020-11.25.com:disk/tpg1/luns
    create
    /backstores/block/block1
    Created LUN 0.
    /> ls 可以查看
    /> exit  退出
    

    二. 客户端配置iscsi

    1. 配置iscsi:/etc/iscsi/initiatorname.iscs,添加共享存储磁盘的ACL名,添加后需要重启iscsid服务。
    [root@localhost ~]# cat /etc/iscsi/initiatorname.iscsi 
    InitiatorName=iqn.2020-11.25.com:nfsacl
    [root@localhost ~]#  systemctl restart iscsid
    
    1. 客户端扫描服务端target
    [root@localhost ~ ]# iscsiadm -m discovery -t st -p 192.168.122.23
    192.168.122.23:3260,1 iqn.2020-11.25.com:disk
    
    1. 客户端登录
    [root@localhost ~]# iscsiadm -m node -T iqn.2020-11.25.com:disk -p 192.168.122.23 -l
    Logging in to [iface: default, target: iqn.2020-11.25.com:disk, portal: 192.168.122.23,3260] (multiple)
    Login to [iface: default, target: iqn.2020-11.25.com:disk, portal: 192.168.122.23,3260] successful.
    
    1. 客户端对共享存储分区并格式化
    [root@localhost ~]# lsblk
    [root@localhost ~]# fdisk /dev/sdb
    [root@localhost ~]# mount /dev/sdb1 /mnt/test
    
    1. 注销操作
    [root@localhost ~]# umount /mnt/test
    [root@localhost ~]# iscsiadm -m ndoe -T iqn.2020-11.25.com:disk -p 192.168.122.23 -u
    Logging out of session [sid: 2, target: iqn.2020-11.25.com:disk, portal: 192.168.122.23,3260]
    Logout of [sid: 2, target: iqn.2020-11.25.com:disk, portal: 192.168.122.23,3260] successful.
    

    相关文章

      网友评论

        本文标题:IP-SAN存储配置使用(iscsi)

        本文链接:https://www.haomeiwen.com/subject/hhfniktx.html