zoukankan      html  css  js  c++  java
  • iscsi

     创建RAID10磁盘阵列

    [root@localhost ~]# mdadm -Cv /dev/md0 -n 4 -l 10 /dev/sd[b-e]
    [root@localhost ~]# mdadm -D /dev/md0

     配置iSCSI服务端

    [root@localhost ~]# yum install targetd targetcli
    [root@localhost ~]# systemctl restart iscsid
    [root@localhost ~]# systemctl enable iscsid
    [root@localhost ~]# targetcli
    /> ls
    o- / ............................................................................ [...]
      o- backstores ................................................................. [...]
      | o- block ..................................................... [Storage Objects: 0]
      | o- fileio .................................................... [Storage Objects: 0]
      | o- pscsi ..................................................... [Storage Objects: 0]
      | o- ramdisk ................................................... [Storage Objects: 0]
      o- iscsi ............................................................... [Targets: 0]
      o- loopback ............................................................ [Targets: 0]
    /> cd /backstores/block
    /backstores/block> create disk0 /dev/md0
    Created block storage object disk0 using /dev/md0.
    /> cd iscsi
    /iscsi> create
    Created target iqn.2003-01.org.linux-iscsi.localhost.x8664:sn.72b4c8640c0c.
    Created TPG 1.
    /iscsi> cd iqn.2003-01.org.linux-iscsi.localhost.x8664:sn.72b4c8640c0c
    /iscsi/iqn.20....72b4c8640c0c> ls
    o- iqn.2003-01.org.linux-iscsi.localhost.x8664:sn.72b4c8640c0c .............. [TPGs: 1]
      o- tpg1 ...................................................... [no-gen-acls, no-auth]
        o- acls ................................................................. [ACLs: 0]
        o- luns ................................................................. [LUNs: 0]
        o- portals ........................................................... [Portals: 0]
    /iscsi/iqn.20....72b4c8640c0c> cd tpg1/luns
    /iscsi/iqn.20...c0c/tpg1/luns> create /backstores/block/disk0
    Created LUN 0.
    /iscsi/iqn.20...c0c/tpg1/luns> cd ..
    /iscsi/iqn.20...c8640c0c/tpg1> ls
    o- tpg1 ........................................................ [no-gen-acls, no-auth]
      o- acls ................................................................... [ACLs: 0]
      o- luns ................................................................... [LUNs: 1]
      | o- lun0 .................................................. [block/disk0 (/dev/md0)]
      o- portals ............................................................. [Portals: 0]
    /iscsi/iqn.20...c8640c0c/tpg1> cd portals
    /iscsi/iqn.20.../tpg1/portals> create 192.168.10.10
    Using default IP port 3260
    Created network portal 192.168.10.10:3260.
    /iscsi/iqn.20.../tpg1/portals> cd ..
    /iscsi/iqn.20...c8640c0c/tpg1> cd acls
    /iscsi/iqn.20...c0c/tpg1/acls> create iqn.2003-01.org.linux-iscsi.localhost.x8664:sn.72b4c8640c0c:client
    Created Node ACL for iqn.2003-01.org.linux-iscsi.localhost.x8664:sn.72b4c8640c0c:client
    Created mapped LUN 0.
    /iscsi/iqn.20...c0c/tpg1/acls> exit
    Global pref auto_save_on_exit=true
    Last 10 configs saved in /etc/target/backup.
    Configuration saved to /etc/target/saveconfig.json
    [root@localhost ~]# iptables -F
    [root@localhost~]# service iptables save
    iptables: Saving firewall rules to /etc/sysconfig/iptables:[  OK  ]

    配置Linux客户端

    [root@localhost ~]# ls -l /dev/sd*
    brw-rw----. 1 root disk 8, 0 8月  13 2019 /dev/sda
    brw-rw----. 1 root disk 8, 1 8月  13 2019 /dev/sda1
    brw-rw----. 1 root disk 8, 2 8月  13 2019 /dev/sda2
    
    [root@localhost ~]# vim /etc/iscsi/initiatorname.iscsi
    InitiatorName=iqn.2003-01.org.linux-iscsi.localhost.x8664:sn.72b4c8640c0c:client
    
    [root@localhost ~]# systemctl restart iscsid
    [root@localhost ~]# systemctl enable iscsid
    
    [root@localhost ~]# iscsiadm -m discovery -t st -p 192.168.10.10
    192.168.10.10:3260,1 iqn.2003-01.org.linux-iscsi.localhost.x8664:sn.72b4c8640c0c
    
    [root@localhost ~]# iscsiadm -m node -T iqn.2003-01.org.linux-iscsi.localhost.x8664:sn.72b4c8640c0c -p 192.168.10.10 --login
    
    [root@localhost ~]# ls -l /dev/sd*
    brw-rw----. 1 root disk 8,  0 8月  13 2019 /dev/sda
    brw-rw----. 1 root disk 8,  1 8月  13 2019 /dev/sda1
    brw-rw----. 1 root disk 8,  2 8月  13 2019 /dev/sda2
    brw-rw----. 1 root disk 8, 16 8月  12 17:08 /dev/sdb
    
    [root@localhost ~]# iscsiadm -m node -T iqn.2003-01.org.linux-iscsi.localhost.x8664:sn.72b4c8640c0c -u
    
    [root@localhost ~]# ls -l /dev/sd*
    brw-rw----. 1 root disk 8, 0 8月  13 2019 /dev/sda
    brw-rw----. 1 root disk 8, 1 8月  13 2019 /dev/sda1
    brw-rw----. 1 root disk 8, 2 8月  13 2019 /dev/sda2
  • 相关阅读:
    设计模式总结
    centos7.5 安装python3.7
    搭建yum软件源
    centos安装gitbook
    编译技术
    samba安装
    docker命令
    shell基础知识
    随笔
    虚拟机字节码执行引擎(三)
  • 原文地址:https://www.cnblogs.com/dinghailong128/p/12178403.html
Copyright © 2011-2022 走看看