1.安装服务

[root@server ~]# yum -y install targetd targetcli      #安装服务

2.启动服务

[root@localhost qtx]# systemctl start target
[root@localhost qtx]# systemctl enable target
[root@localhost qtx]# systemctl status target

3.设置防火墙

[root@localhost qtx]# firewall-cmd --add-port=3260/tcp --permanent
success
[root@localhost qtx]#  firewall-cmd --reload
success
[root@localhost qtx]#  firewall-cmd --list-ports
3260/tcp

一、客户端

1.指定磁盘

[root@localhost qtx]# targetcli
targetcli shell version 2.1.53
Copyright 2011-2013 by Datera, Inc and others.
For help on commands, type 'help'./>  /backstores/block create fwq0.disk1 /dev/sdb
Created block storage object fwq0.disk1 using /dev/sdb.
/> exit
Global pref auto_save_on_exit=true
Configuration saved to /etc/target/saveconfig.json

2.创建iqn名字和iscsi对象

[root@localhost qtx]# targetcli
targetcli shell version 2.1.53
Copyright 2011-2013 by Datera, Inc and others.
For help on commands, type 'help'./> /iscsi create iqn.2022-04.com.qtx:sdb1
Created target iqn.2022-04.com.qtx:sdb1.
Created TPG 1.
Global pref auto_add_default_portal=true
Created default portal listening on all IPs (0.0.0.0), port 3260.
/> exit
Global pref auto_save_on_exit=true
Last 10 configs saved in /etc/target/backup/.
Configuration saved to /etc/target/saveconfig.json

3.设置iscsi对象和客户端ip

[root@localhost qtx]# targetcli
targetcli shell version 2.1.53
Copyright 2011-2013 by Datera, Inc and others.
For help on commands, type 'help'./> /iscsi/iqn.2022-04.com.qtx:sdb1/tpg1/acls create iqn.2022-04.com.qtx:user1
Created Node ACL for iqn.2022-04.com.qtx:user1
/> exit
Global pref auto_save_on_exit=true
Last 10 configs saved in /etc/target/backup/.
Configuration saved to /etc/target/saveconfig.json

4.创建lun    绑定块

[root@localhost qtx]# targetcli
targetcli shell version 2.1.53
Copyright 2011-2013 by Datera, Inc and others.
For help on commands, type 'help'./> /iscsi/iqn.2022-04.com.qtx:sdb1/tpg1/luns create

二、客户端

1.安装工具

[root@localhost qtx]# yum -y install targetd targetcli

2.initiator命名

[root@client ~]# vim /etc/iscsi/initiatorname.iscsi
InitiatorName=iqn.2022-04.com.qts:sdb1

3.启动服务

[root@localhost qtx]# systemctl start iscsi
[root@localhost qtx]# systemctl enable iscsi
[root@localhost qtx]# systemctl status iscsi

4.发现存储

[root@localhost qtx]# iscsiadm -m discovery -t st -p 192.168.190.129
192.168.190.129:3260,1 iqn.2022-04.com.qtx:sdb1

5.登陆存储     连接

[root@localhost qtx]# iscsiadm -m discovery -t st -p 192.168.190.129 -l

6.验证

[root@localhost qtx]# lsscsi
[root@localhost qtx]# gdisk /dev/sdb
Number Start (sector) End (sector) Size Code Name
1 2048 10487807 5.0 GiB 8300 Linux filesystem
2 10487808 20971486 5.0 GiB 8300 Linux filesystem
[root@localhost qtx]# partprobe /dev/sdb
[root@localhost qtx]# partprobe /dev/sdb
[root@localhost qtx]# partprobe /dev/sdb
[root@localhost qtx]# cat /proc/partitions
major minor #blocks name
8 16 10485760 sdb
8 17 5242880 sdb1
8 18 5241839 sdb2
[root@localhost qtx]# mkdir /mnt/iscsi
[root@localhost qtx]# mkfs.xfs /dev/sdb1
[root@localhost qtx]# mount /dev/sdb1 /mnt/iscsi/
[root@localhost qtx]# mount | tail -1
[root@localhost qtx]# df -hT /mnt/iscsi/
[root@localhost qtx]# targetcli
/> cd /iscsi/iqn.2022-04.com.qtx:disk1/tpg1/portals/
/iscsi/iqn.20.../tpg1/portals> delete 0.0.0.0 3260
Deleted network portal 0.0.0.0:3260
/iscsi/iqn.20.../tpg1/portals> create 192.168.192.129 3260
Using default IP port 3260
Created network portal 192.168.190.:3260.
/iscsi/iqn.20.../tpg1/portals> exit
Global pref auto_save_on_exit=true
Last 10 configs saved in /etc/target/backup/.
Configuration saved to /etc/target/saveconfig.json
[root@localhost qtx]# systemctl restart target.service

Linux 磁盘共享存储相关推荐

  1. Linux NFS共享存储

    Linux NFS共享存储 一.NFS共享存储服务 概述 NFS是一种基于TCP/IP传输的网络文件系统协议.通过使用NFS协议,客户机可以像访问本地目录一样访问远程服务器中的共享资源. 优缺点 对于 ...

  2. 搭建nfs,实现linux之间共享存储

    一句话介绍nfs:网络文件系统,实现linux之间共享存储 准备环境 关闭防火墙: systemctl stop firewalld.service 临时关闭防火墙(临时关闭): systemctl ...

  3. linux怎么共享存储,什么是ISCSI,及Linux下怎么样通过ISCSI实现共享存储

    什么是ISCSI iSCSI(iSCSI = internet Small Computer System Interface )小型计算机接口.是由IEETF开发的网络存储标准,目的是为了用IP协议 ...

  4. 共享存储集群规范化部署

    搭建 2 节点 DMDSC(DMASM) DMDSC 启动.关闭流程 DMDSC 是基于共享存储的数据库集群系统,包含多个数据库实例,因此,与单节点的 达梦数据库不同,DMDSC 集群需要在节点间进行 ...

  5. linux——ISCSI 网络磁盘共享

    ISCSI ISCSI技术实现了物理硬盘设备与TCP/TP网络传输协议的相互结合,使得用户可以通过互联网方便的获取到远程机房提供的共享存储资源 ISCSI target:就是储存设备端,存放磁盘或 R ...

  6. Linux系统编程---5(共享存储映射,存储映射I/O,mmap函数,父子进程间通信,匿名映射)

    共享存储映射 文件进程间通信 使用文件也可以完成 IPC,理论依据是,fork 后,父子进程共享文件描述符.也就共享打开的文件. 编程:父子进程共享打开的文件.借助文件进行进程间通信. 测试代码 /* ...

  7. Linux下搭建iSCSI共享存储详细步骤(服务器模拟IPSAN存储)

    一.简介 iSCSI(internet SCSI)技术由IBM公司研究开发,是一个供硬件设备使用的.可以在IP协议的上层运行的SCSI指令集,这种指令集合可以实现在IP网络上运行SCSI协议,使其能够 ...

  8. Linux下搭建iSCSI共享存储

    一.简介 iSCSI(internet SCSI)技术由IBM公司研究开发,是一个供硬件设备使用的.可以在IP协议的上层运行的SCSI指令集,这种指令集合可以实现在IP网络上运行SCSI协议,使其能够 ...

  9. 【Linux进程间通信】四、mmap共享存储映射

    欢迎加入[Linux C/C++/Python社区]一起探讨和分享Linux C/C++/Python/Shell编程.机器人技术.机器学习.机器视觉.嵌入式AI相关领域的知识和技术. mmap共享存 ...

最新文章

  1. Linux离线时间设置(NTP)
  2. 启动 Eclipse 弹出“Failed to load the JNI shared library jvm.dll”错误的解决方法!
  3. how to consume a webservice via ABAP proxy
  4. 牛客练习赛44 A 小y的序列 (模拟,细节)
  5. javafx阴影_JavaFX技巧来节省内存! 属性和可观察对象的阴影场
  6. cos大乱斗服务器维护,《COS大乱斗》服务器数据互通公告
  7. c语言翁凯中程序,程序设计入门——C语言(翁凯老师)(基础部分)(总结)...
  8. 发现 nios2-elf-gcc 一处 bug
  9. oracle open 101,解决oracle数据库ORA-65101 container database set up incorrectly
  10. yalmip-cplex学习总结+亲测算例(一)
  11. 一个大学计算机教师的英文简历,大学教师英文简历模板范文
  12. IntelliJ IDEA配置Groovy教程
  13. python 柱状图 内部颜色_matplotlib画柱状图,设置同一幅图上的柱子呈现不同颜色...
  14. About 速溶咖啡
  15. 实现SDT(software-defined Things)的IOT案例(2)
  16. 关于element-plus的Dropdown 下拉菜单属性的修改
  17. 量子计算机游戏,第3章 量子计算机中的游戏
  18. python中0x是什么意思_弱问下,以0x开头的数值表示什么意思?
  19. 黑白液晶COG与COB的区别
  20. 线性表之线性表与数组的区别

热门文章

  1. 贪心+线性基 [BeiJing2011]元素
  2. unittest测试框架
  3. spring-cloud-netflix学习笔记(一):Eureka Server
  4. 【文献阅读12】:稀疏ReRAM引擎:基于ReRAM的高效稀疏神经网络加速架构
  5. OLED防烧屏指南:让OLED屏幕用得更久?看这一篇就够了
  6. C语言 之编译器优化
  7. 30岁中国男人对婚姻的思考
  8. POJ - 1611(并查集)
  9. CentOS 7查看防火墙状态及开/关防火墙命令
  10. RTOS任务调度思想汇总