iscsi
Posted dinghailong128
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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
配置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
以上是关于iscsi的主要内容,如果未能解决你的问题,请参考以下文章
Microsoft iscsi initiator 功能及作用?
iSCSI vs iSER vs NVMe-TCP vs NVMe-RDMA