一 iscsi简介

  The Internet Small Computer System Interface ,它是基于IP网络的TCP/IP协议的高可用本地存储。提供给远程主机数据传输和远程磁盘block管理。


ISCSI卡


iscsi软件


相关名称:

IQN   :unique name to identifiy individual iscsi targets and initiators

WWN : unique number to identifiy individual Fibre Chananel port and nodes

LUN : storage resource block device on an iscsi server

target : storage resource on an iscsi server

initiator :  ISCSI client implemented in either software or hardware

node : a single iscsi initiator or target




二 安装配置

yum install -y targetcli


targetcli

ls

cd /iscsi

create iqn.2016.com.example:remotedisk1


systemctl enable target


targetcli /backstores/block create block1 /dev/vdb


targetcli /isci create iqn.xxxx:remotedisk1


targetcli saveconfig


systemctl start target


firewall-cmd --permanent --add-port=3260/tcp

firewall-cmd --reload


fdisk /dev/vdb

pvcreate /dev/vdb1

vgcreate ISCSI_vg /dev/vdb1

vgdisplay iSCSI_vg

lvcreate -n disk1_lv -L 100m iSCSI_vg

lvdisplay iScsi_vg/disk1_lv


targetcli

>/backstores/block/ create serverX.disk1 /dev/iSCSI_vg/DISK1_LV

>/iscsi create iqn.2016.com.example:serverX

>/iscsi/iqn.2016.eample.com:serverX/tpg1/acls/ create

>/iscsi/iqn.2016.example.com:serverX/tpg1/luns create /bacstores/bolck/serverX.disk1

>/iscsi/iqn.2016.com.example:serverX/tpg1/portals create 172.x.x.



ls


/etc/target/saveconfig.json.

>exit



2. accessing iscsi storage

vi /etc/iscsi/iscsid.conf

vi /etc/iscsi/initiatorname.iscsi


systemctl restart iscsi

lsblk

iscsiadm -m session -P 3 



iscsiadm -m mode -T iqn.example.com:serverX -p 172.x.x.x -u





三 实例

  iscsi target共享一个目录/dataiscsi出去,client服务器,通过iscsi协议使用这个lun,格式化后,挂载到/data_iscsi