linux上对应swap交换分区
windows上对应虚拟本地磁盘
存储的分类
DAS 直连式存储 硬盘 U盘
NAS 网络附加存储 NFS samba
SAS 存储区域网络 存储到主机的
1.准备工作:
centos7.0 一块2TB磁盘
2.安装targetcli
dnf -y install targetcli
3.开启target服务
systemctl start target
systemctl enable target
4.进入target配置
[root@clq ~]# targetcli
/> ls
o- / ...................................................................................................... [...]o- backstores ........................................................................................... [...]| o- block ............................................................................... [Storage Objects: 0]| o- fileio .............................................................................. [Storage Objects: 0]| o- pscsi ...
#配置iscsi
#创建存储vvv名称,关联存储/dev/sdb
/> /backstores/block create vvv.disk /dev/sdb
Created block storage object vvv.disk using /dev/sdb.#存储创建iqn号
/> iscsi/ create iqn.2021-05.com.example.com.vvv.disk
Created target iqn.2021-05.com.example.com.vvv.disk.
Created TPG 1.
Global pref auto_add_default_portal=true
Created default portal listening on all IPs (0.0.0.0), port 3260.每台机器唯一标识(该标识见下面图)
/> iscsi/iqn.2021-05.com.example.com.vvv.disk/tpg1/acls create iqn.1991-05.com.microsoft:clq0917
Created Node ACL for iqn.1991-05.com.microsoft:clq0917#关联iqn号acl关联存储
/> iscsi/iqn.2021-05.com.example.com.vvv.disk/tpg1/luns create /backstores/block/vvv.disk
Created LUN 0.
Created LUN 0->0 mapping in node ACL iqn.1991-05.com.microsoft:clq0917#监听服务器端口之前必须删掉默认的0.0.0.0 3260 这个端口
/> iscsi/iqn.2021-05.com.example.com.vvv.disk/tpg1/portals/ delete 0.0.0.0 3260
Deleted network portal 0.0.0.0:3260#监听服务器,创建ip端口
/> iscsi/iqn.2021-05.com.example.com.vvv.disk/tpg1/portals create 192.168.136.157
Using default IP port 3260
Created network portal 192.168.136.157:3260.#保存
/> saveconfig
Configuration saved to /etc/target/saveconfig.json
配置保存到/etc/target/saveconfig.json下
5.配置完的图:
6.主机唯一标识码:
7.进行连接:
8.查看到多出来了一块自己命名的2TB磁盘
这里算完成了!!可以添加文件。
笔记本以实际内存为准!