配置 iscsi
1.安装软件
1.yum install -y targetcli
2.systemctl start target
3.systemctl enable target
[root@localhost ~]# yum install -y targetcli
已加载插件:fastestmirror, langpacks
2.利用fdisk命令新增一块硬盘/dev/vdb1,大小为1G
1.fdisk /dev/vdb1
2.n #新建
3.p #主分区
4.+1G #指定大小为1G
5.w #写入
[root@localhost ~]# fdisk /dev/vbd1
3.执行targetcli命令
1.#建立与硬盘的连接
2./backstores/block create octopus:storage1 /dev/vdb1
3. #创建存储接口
4. iscsi/ create iqn.2019-05.com.octopus:storage1
5.#创建连接名称
6. iscsi/iqn.2019-05.com.octopus:storage1/tpg1/luns create 7./backstores/block/octopus:storage1
8.#添加连接密要
9. iscsi/iqn.2019-05.com.octopus:storage1/tpg1/acls create iqn.2019-05.com.octopus:key1
10. #指定连接IP
11. iscsi/iqn.2019-05.com.octopus:storage1/tpg1/portals create 172.25.254.141
12. #退出命令
exit
————————————————
[root@localhost ~]# systemctl start target
[root@localhost ~]# systemctl enable target
Created symlink from /etc/systemd/system/multi-user.target.wants/target.service to /usr/lib/systemd/system/target.service.
[root@localhost ~]# targetcli
targetcli shell version 2.1.fb46
Copyright 2011-2013 by Datera, Inc and others.
For help on commands, type 'help'.
/>
/> ls
o- / ............................................................................ [...]
o- backstores ................................................................. [...]
| o- block ..................................................... [Storage Objects: 0]
| o- fileio .....