rhel6.3搭建iscsi-target服务器实战
iSCSI技术是一种由IBM公司研究开发的,是一个供硬件设备使用的可以在IP协议的上层运行的SCSI指令集,这种指令集合可以实现在IP网络上运行SCSI协议,使其能够在诸如高速千兆以太网上进行路由选择。iSCSI的最大好处是能提供快速的网络环境,虽然其性能和带宽跟光纤网络还有一些差距,但能节省企业约30-40%的成本。
下面我们来看一下在RHEL6.3上如何搭建iscsi-target服务器和客户端如何挂载.
一、服务端操作
服务端版本:
[root@racscsi home]# uname -r
2.6.32-279.el6.x86_64
[root@racscsi home]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.3 (Santiago)
安装iscsi server软件包。
用RPM的方式安装。
[root@racscsi home]# rpm -ivh scsi-target-utils-1.0.24-2.el6.x86_64.rpm
warning: scsi-target-utils-1.0.24-2.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing... ########################################### [100%]
package scsi-target-utils-1.0.24-2.el6.x86_64 is already installed
用yum命令安装(需自己配置YUM源)
[root@racscsi home]#yum -y install scsi-target-utils
启动服务并且添加到开机自启动。
[root@racscsi home]# /etc/init.d/tgtd start
Starting SCSI target daemon: [ OK ]
[root@racscsi home]# chkconfig tgtd on
使用fdisk命令创建几个分区,或者通过外部存储映射共享分区。
现在这台服务器已划分好/dev/sdb、 /dev/sdc、 /dev/sdd、 /dev/sde、 /dev/sdf、 /dev/sdg 、/dev/sdh、/dev/sdi分区,用于客户端的挂载
下面我们需要编辑配置文件/etc/tgt/targets.conf,并设置下iSCSI Qualified Name (IQN).
[root@racscsi home]#vim /etc/tgt/ targets.conf
在文件末尾添加如下内容
<target iqn.2008-09.com.example:asm> #iqn名字可任意
backing-store /dev/sdb
backing-store /dev/sdc
backing-store /dev/sdd
backing-store /dev/sde
backing-store /dev/sdf
backing-store /dev/sdg
backing-store /dev/sdh
backing-store /dev/sdi
initiator-address 192.168.10.0/24 #限定允许访问的客户端地址段或具体IP
write-cache off #是否开启或关闭快取
</target>
重启服务,使修改后的配置生效。
[root@racscsi home]#/etc/init.d/tgtd restart
确定iscsi server是否成功。如果显示如下说明配置iscsi server已经成功。
[root@racscsi home]# tgt-admin --show
Target 1: iqn.2008-09.com.example:asm
System information:
Driver: iscsi
State: ready
I_T nexus information:
I_T nexus: 1
Initiator: iqn.1994-05.com.redhat:b363811441a
Connection: 0
IP Address: 192.168.10.212
LUN information:
LUN: 0
Type: controller
SCSI ID: IET 00010000
SCSI SN: beaf10
Size: 0 MB, Block size: 1
Online: Yes
Removable media: No
Prevent removal: No
Readonly: No
Backing store type: null
Backing store path: None
Backing store flags:
LUN: 1
Type: disk
SCSI ID: IET 00010001
SCSI SN: beaf11
Size: 2147 MB, Block size: 512
Online: Yes
Removable media: No
Prevent removal: No
Readonly: No
Backing store type: rdwr
Backing store path: /dev/sdb
Backing store flags:
。。。。。。。。。。。。 #中间内容省略
LUN: 8
Type: disk
SCSI ID: IET 00010008
SCSI SN: beaf18
Size: 5369 MB, Block size: 512
Online: Yes
Removable media: No
Prevent removal: No
Readonly: No
Backing store type: rdwr
Backing store path: /dev/sdi
Backing store flags:
Account information:
ACL information:
192.168.10.0/24
注意:关闭服务端的IPTABLES,以免客户端无法正常访问
二、客户端挂载
客户端需安装的包iscsi-initiator-utils
[root@rac2 home]# rpm -ivh iscsi-initiator-utils-6.2.0.872-41.el6.x86_64.rpm
warning: iscsi-initiator-utils-6.2.0.872-41.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing... ########################################### [100%]
1:iscsi-initiator-utils ########################################### [100%]
用yum命令安装(需自己配置YUM源)
[root@rac2 home]#yum -y install iscsi-initiator-utils
启动服务并且添加到开机启动。
[root@rac2 Desktop]# /etc/init.d/iscsid start
[root@rac2 Desktop]# chkconfig iscsid on
发现服务器端iscsi server的共享分区。
[root@rac2 Desktop]# iscsiadm --mode discovery --type sendtargets --portal 192.168.10.220
192.168.10.220:3260,1 iqn.2008-09.com.example:asm
已发现
登陆到iscsi server共享的分区。
[root@rac2 Desktop]# iscsiadm -m node -T iqn.2008-09.com.example:asm -p 192.168.10.220 -l
Logging in to [iface: default, target: iqn.2008-09.com.example:asm, portal: 192.168.10.220,3260] (multiple)
Login to [iface: default, target: iqn.2008-09.com.example:asm, portal: 192.168.10.220,3260] successful.
再使用fdisk -l命令查看分区,发现共享出来的分区都已经挂过来了。
[root@rac2 Desktop]# fdisk -l
Disk /dev/sda: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000586f0
Device Boot Start End Blocks Id System
/dev/sda1 * 1 39 307200 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 39 549 4096000 82 Linux swap / Solaris
Partition 2 does not end on cylinder boundary.
/dev/sda3 549 2611 16567296 83 Linux
Disk /dev/sdb: 2147 MB, 2147483648 bytes
67 heads, 62 sectors/track, 1009 cylinders
Units = cylinders of 4154 * 512 = 2126848 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Disk /dev/sdc: 2147 MB, 2147483648 bytes
67 heads, 62 sectors/track, 1009 cylinders
Units = cylinders of 4154 * 512 = 2126848 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Disk /dev/sdd: 2147 MB, 2147483648 bytes
67 heads, 62 sectors/track, 1009 cylinders
Units = cylinders of 4154 * 512 = 2126848 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Disk /dev/sde: 10.7 GB, 10737418240 bytes
64 heads, 32 sectors/track, 10240 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Disk /dev/sdf: 10.7 GB, 10737418240 bytes
64 heads, 32 sectors/track, 10240 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Disk /dev/sdg: 10.7 GB, 10737418240 bytes
64 heads, 32 sectors/track, 10240 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Disk /dev/sdh: 5368 MB, 5368709120 bytes
166 heads, 62 sectors/track, 1018 cylinders
Units = cylinders of 10292 * 512 = 5269504 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Disk /dev/sdi: 5368 MB, 5368709120 bytes
166 heads, 62 sectors/track, 1018 cylinders
Units = cylinders of 10292 * 512 = 5269504 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
最后你可以格式化分区,挂载在本地相应目录。如果要实现开机自动挂载,要在fstab文件添加记录。
注意添加_netdev参数,要不你在重启iscsi server后,启动时会报错。
示例: /dev/sdb /crs ext4 default,_netdev 0 0
补充:
如果在服务端/etc/tgt/targets.conf文件配置了用户名密码,比如
<target iqn.2008-09.com.example:server.target3>
backing-store /dev/sdb
initiator-address 192.168.10.0/24
incoming grid 123@passwd
write-cacheoff
</target>
则在客户端/etc/iscsi/iscsid.conf配置文件
需要添加相应的账号和密码
node.session.auth.username = grid
node.session.auth.password = 123@passwd
discovery.sendtargets.auth.username = grid
discovery.sendtargets.auth.password = 123@passwd
转载于:https://blog.51cto.com/ecloud/1387017
rhel6.3搭建iscsi-target服务器实战相关推荐
- Centos7 搭建LNMP架构服务器实战
Centos7 搭建LNMP架构服务器实战 前言 需求分析 拓朴设计及各服务器地址规划 配置部分 后端服务器实现 Web-1 nginx整合 Web-2 nginx整合 后端服务器测试 高可用Web集 ...
- linux 建立lun分区,系统运维|在 iSCSI Target 服务器中使用LVM创建和设置LUN(二)
LUN是逻辑单元号,它与iSCSI存储服务器共享.iSCSI 目标器通过TCP/IP网络共享它的物理驱动器给发起程序(initiator).这些来自一个大型存储(SAN:Storage Area Ne ...
- SUSE11 搭建iscsi target 配置
https://www.suse.com/documentation/sles11/stor_admin/data/sec_inst_system_iscsi_target.html#sec_inst ...
- 配置iscsi服务器_在Windows Server 2016上安装和配置iSCSI目标服务器
配置iscsi服务器 In this article, I am going to explain how we can install and configure the iSCSI Target ...
- 在linux挂载网络驱动器,利用centos 6.6 搭建iscsi服务器并在centos挂载iscsi网络驱动器...
################################################################## 搭建iscsi服务器: 参考自:http://www.linuxi ...
- 搭建ISCSI服务器
搭建ISCSI服务器 在iscsi服务端将大小为4G逻辑卷共享给客户端,在客户端系统启动期间,该iscsi设备自动加载.该块设备上包含一个大小为2300MB的分区,文件系统类型为ext4,此分区在系统 ...
- Linux下搭建iSCSI共享存储详细步骤(服务器模拟IPSAN存储)
一.简介 iSCSI(internet SCSI)技术由IBM公司研究开发,是一个供硬件设备使用的.可以在IP协议的上层运行的SCSI指令集,这种指令集合可以实现在IP网络上运行SCSI协议,使其能够 ...
- linux 6 dns,RHEL6下搭建DNS服务器
DNS是大部分网络服务基石,DNS解释的主要作用就是让域名替换IP,即:人们通过记忆的域名找到该域名所对应的物理主机的真实地址,可以方便人记忆.所以说DNS解释是大部分网络服务的基石,可想而知,人记I ...
- 搭建iscsi存储系统
搭建iscsi存储系统 NAS和SAN服务器概述 NAS网络附属存储: NAS(Network Attached Storage),NAS服务器是连接在网络上,具备资料存储功能的服务器,一种 ...
- Windows/Linux搭建ISCSI协议存储服务(IPSAN存储)并对接给虚拟化平台
Linux/Windows搭建ISCSI协议存储服务(IPSAN存储)并对接给虚拟化平台 1. Windows Server系统部署ISCSI存储服务 2. Linux系统部署ISCSI存储服务 2. ...
最新文章
- RAC rac_liftSelector
- C语言程序的内存四区模型
- 显式(静态)调用: LIB + DLL + .H
- 编写组件,使用JavaScript更新UpdatePanel
- c++fabs函数_支持向量机(SVM)模型python复现 - SMO算法;核技巧;高斯核函数
- HDFS常用命令(总结)
- 程序设计原则之SOLID原则
- 国产CPU 申威1621 异数OS基础组件理论性能测试报告
- 踩坑指南!pytorch1.2.0安装!又是猛男落泪的一天!
- 解决合并压缩包分卷无法解压 错误信息:文件格式未知或者压缩文件数据已经损坏
- 电机位置、速度检测方法大合集
- win10系统怎么无线连接投影仪,win10笔记本无线连接
- java实现购物券消费方案
- exit和return的区别
- 编译android-x86-froyo
- 2020数据分析师学习路径
- 通达信F10主图指标
- resources目录下文件加载失败,class path resource [***] cannot be resolved to URL because it does not exist
- 【论文笔记 · RL】Learning Phase Competition for Traffic Signal Control
- word2010设置多级别标题