Linux挂载iscsi网络存储
Posted 烈火吞噬
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Linux挂载iscsi网络存储相关的知识,希望对你有一定的参考价值。
Linux挂载iscsi网络存储
iscsi网络存储简介
iSCSI
,即Internet SCSI,是IETF制订的一项标准,用于将SCSI数据块映射为以太网数据包。从根本上说,它是一种基于IP Storage理论的新型存储技术,该技术将存储行业广泛应用的SCSI接口技术与IP网络技术相结合,可以在IP网络上构建SAN。简单地说,iSCSI就是在IP网络上运行SCSI协议的一种网络存储技术
iscsi的组成
- iSCSI IniTIator或者iSCSI HBA iSCSI Target 以太网交换机 一台或者多台服务器
主机规划
名称 | IP地址 | 硬件配置 |
---|---|---|
iscsi服务端 | 192.168.100.20 | 1核2G |
iscsi客户端 | 192.168.100.19 | 1核2G |
配置iscsi网络存储挂载
iscsi服务端配置
# 安装iscsi服务端
yum install targetd targetcli -y
# 调用targetcli进行设置
[root@server ~]# targetcli
Warning: Could not load preferences file /root/.targetcli/prefs.bin.
targetcli shell version 2.1.53
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 ................................................... [Storage Objects: 0] # 存放文件
| o- pscsi .................................................... [Storage Objects: 0]
| o- ramdisk .................................................. [Storage Objects: 0]
o- iscsi .............................................................. [Targets: 0]
o- loopback ........................................................... [Targets: 0]
# 创建iscsi磁盘
/> /backstores/block create idisk1 /dev/sdb # idisk1 自定义共享磁盘名称
Created block storage object idisk1 using /dev/sdb.
/> ls
o- / ........................................................................... [...]
o- backstores ................................................................ [...]
| o- block .................................................... [Storage Objects: 1]
| | o- idisk1 .......................... [/dev/sdb (40.0GiB) write-thru deactivated]
| | o- alua ..................................................... [ALUA Groups: 1]
| | o- default_tg_pt_gp ......................... [ALUA state: Active/optimized]
| o- fileio ................................................... [Storage Objects: 0]
| o- pscsi .................................................... [Storage Objects: 0]
| o- ramdisk .................................................. [Storage Objects: 0]
o- iscsi .............................................................. [Targets: 0]
o- loopback ........................................................... [Targets: 0]
/>
# 创建服务端程序,服务器命名:日期形式:标识符
/> iscsi/ create iqn.2021-11.pip.cc:server
Created target iqn.2021-11.pip.cc:server.
Created TPG 1.
Global pref auto_add_default_portal=true
Created default portal listening on all IPs (0.0.0.0), port 3260.
/> ls
o- / ......................................................................................................................... [...]
o- backstores .............................................................................................................. [...]
| o- block .................................................................................................. [Storage Objects: 1]
| | o- idisk1 ........................................................................ [/dev/sdb (40.0GiB) write-thru deactivated]
| | o- alua ................................................................................................... [ALUA Groups: 1]
| | o- default_tg_pt_gp ....................................................................... [ALUA state: Active/optimized]
| o- fileio ................................................................................................. [Storage Objects: 0]
| o- pscsi .................................................................................................. [Storage Objects: 0]
| o- ramdisk ................................................................................................ [Storage Objects: 0]
o- iscsi ............................................................................................................ [Targets: 1]
| o- iqn.2021-11.pip.cc:server ......................................................................................... [TPGs: 1]
| o- tpg1 ............................................................................................... [no-gen-acls, no-auth]
| o- acls ........................ 创建客户端连接器.................................................................... [ACLs: 0]
| o- luns .................... 创建服务卷,存储空间.................................................................... [LUNs: 0]
| o- portals .................................................................................................... [Portals: 1]
| o- 0.0.0.0:3260 ..................................................................................................... [OK]
o- loopback ......................................................................................................... [Targets: 0]
# 创建服务卷,<才能被客户端识别>
/> cd iscsi/iqn.2021-11.pip.cc:server/tpg1/
/iscsi/iqn.20...c:server/tpg1> luns/ create /backstores/block/idisk1 # 创建服务卷
Created LUN 0.
/iscsi/iqn.20...c:server/tpgLinux网络服务——CentOS7挂载iscsi网络存储