1.添加一块5G 的硬盘
[root@localhost ~]# lsblk
sda 8:0 0 5G 0 disk
2然后创建大小为4G的逻辑卷
3配置issc服务包
[root@localhost ~]# yum install -y targetcli
4然后关闭防火墙,selinux,启动服务
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# setenforce 0
[root@localhost ~]# systemctl restart target
5在当前主机上能成功发现此共享
6安装客户端
yum install iscsi-initiator-utils -y
7客户端也能成功发现到此共享
[root@client ~]# iscsiadm -m discovery -t st -p 192.168.136.152
192.168.136.152:3260,1 iqn.2003-01.org.linux-iscsi.localhost.x8664:sn.c21ab93a6c75
然后对此设备分区
格式化分区
[root@client ~]# mkfs.ext4 /dev/sdb1
创建目录/share/disk
[root@client ~]# mkdir /share/disk -p
查看uuid,编辑配置文件实现自动挂载
[root@client ~]# blkid
/dev/sdb1: UUID=“a39aaaaa-8297-4e82-a240-a06de70a047b” TYPE=“ext4”