iSCSI(Internet Small Computer System Interface),Internet小型计算机系统接口,又称为IP-SAN,是一种基于因特网及SCSI-3协议下的存储技术,把原来只用于本机的SCSI协义透过TCP/IP网络发送,使连接距离可作无限的地域延伸,连接的服务器数量无限,可以实现在线扩容以至动态部署。

Server:172.25.254.211

基于 RAID 10 & LVM,虚拟机里添加四块硬盘,分别为 /dec/sdb /dev/sdc /dev/sdd /dev/sde

yum -y install mdadm
mdadm -Cv /dev/md0 -n 4 -l 10 /dec/sdb /dev/sdc /dev/sdd /dev/sde
mdadm -D /dev/md0
pvcreate /dev/md0
vgcreate vg0 /dev/md0
lvcreate -n lv1 -L 5G vg0
targetcli
    >/backstores/block create server.lvm1 /dev/vg0/lv1
    >/iscsi create iqn.2019-01.com.example:server
    >/iscsi/iqn.2019-01.com.example:server/tpg1/acls create iqn.2019-01.com.example:desktop
    >/iscsi/iqn.2019-01.com.example:server/tpg1/luns create /backstores/server.lv1
    >/iscsi/iqn.2019-01.com.example:server/tpg1/portals delete 0.0.0.0 3260
    >/iscsi/iqn.2019-01.com.example:server/tpg1/portals create 172.25.254.211 3260
    >saveconfig
    >exit
firewall-cmd --permanent --add-port=3260/tcp
firewall-cmd --reload
systemclt restart targetd
systemctl enable targetd

Desktop:172.25.254.210

yum -y install iscsi-initiator-utils
vim /etc/iscsi/initiatorname.iscsi
	iqn.2019-01.com.example:desktop
systemctl restart iscsi iscsid
systemctl enable iscsi iscsid
iscsiadm -m discovery -t st -p 172.25.254.211
iscsiadm -m node -T iqn.2019-01.com.example:server -p 172.25.254.211 -l
mkfs.ext4 /dev/vdb
blkid | grep /dev/vdb >> /etc/fstab
vim /etc/fstab
	UUID="b7a2532e-10d9-4a38-a338-c22e994a0773" /mnt/iscsi ext4 defaults,_netdev 0 0
mkdir /mnt/iscsi
mount -a