分区RHEL 6-ISCSI 红帽linux连接iSCSI存储

红帽linux  时间:2021-01-14  阅读:()

下面我来看一下在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-uti ls-1 .0.24-2.el6.x86_64.rpm warning:scsi-target-uti ls-1 .0.24-2.el6.x86_64.rpm:Header V3 RSA/SHA256Signature,key ID fd431d51 :NOKEY

Preparing. . .###########################################

[100%]package scsi-target-uti ls-1 .0.24-2.el6.x86_64 is already instal led

用yum命令安装需自己配置YUM源

[root@racscsi home]#yum-y instal l scsi-target-uti ls

启服并且添加到机自启 。

[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 Qual ified 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:b36381 1441 a

Connection:0

IP Address: 192.168.10.212

LUN information:

LUN:0

Type:control ler

SCSI ID: IET 00010000

SCSI SN:beaf10

Size:0 MB,Blocksize: 1

Onl ine:Yes

Removable media:No

Prevent removal :No

Readonly:No

Backing store type:nul l

Backing store path:None

Backing store flags:

LUN: 1

Type:disk

SCSI ID: IET 00010001

SCSI SN:beaf1 1

Size:2147 MB,Blocksize:512

Onl ine: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,Blocksize:512

Onl ine: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

注意 服端的I PTABLES,以免客端无法正常

二、客端挂

客端需安装的包iscsi-initiator-uti ls

[root@rac2 home]#rpm-ivh iscsi-initiator-uti ls-6.2.0.872-41 .el6.x86_64.rpm warning: iscsi-initiator-uti ls-6.2.0.872-41 .el6.x86_64.rpm:Header V3RSA/SHA256 Signature,key ID fd431d51 :NOKEY

Preparing. . .###########################################

[100%]

1 : iscsi-initiator-uti ls ###########################################

[100%]

用yum命令安装需自己配置YUM源

[root@rac2 home]#yum-y instal l iscsi-initiator-uti ls

启服并且添加到机启 。

[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 cyl inders

Units=cyl inders 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 cyl inder boundary.

/dev/sda2 39 549 4096000 82 Linux swap/Solaris Partition 2 does not end on cyl inder boundary.

/dev/sda3 549 261 1 16567296 83 Linux

Disk/dev/sdb:2147 MB,2147483648 bytes

67 heads,62 sectors/track, 1009 cyl inders

Units=cyl inders 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 cyl inders

Units=cyl inders 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 cyl inders

Units=cyl inders 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 cyl inders

Units=cyl inders 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 cyl inders

Units=cyl inders 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 cyl inders

Units=cyl inders 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 cyl inders

Units=cyl inders 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 cyl inders

Units=cyl inders 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 00

充:

如果在服端/etc/tgt/targets.conf文件配置了用名密 比如

<target iqn.2008-09.com.example:server.target3>backing-store /dev/sdb initiator-address 192.168.10.0/24incoming 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

ZJI(月付480元),香港阿里云专线服务器

ZJI是成立于2011年原Wordpress圈知名主机商—维翔主机,2018年9月更名为ZJI,主要提供香港、日本、美国独立服务器(自营/数据中心直营)租用及VDS、虚拟主机空间、域名注册业务。本月商家针对香港阿里云线路独立服务器提供月付立减270-400元优惠码,优惠后香港独立服务器(阿里云专线)E3或者E5 CPU,SSD硬盘,最低每月仅480元起。阿里一型CPU:Intel E5-2630L...

Gigsgigscloud($9.8)联通用户优选日本软银VPS

gigsgigsCloud日本东京软银VPS的大带宽配置有100Mbps、150Mbps和200Mbps三种,三网都走软银直连,售价最低9.8美元/月、年付98美元。gigsgigscloud带宽较大延迟低,联通用户的好选择!Gigsgigscloud 日本软银(BBTEC, SoftBank)线路,在速度/延迟/价格方面,是目前联通用户海外VPS的最佳选择,与美国VPS想比,日本软银VPS延迟更...

RAKsmart新年钜惠:E3服务器秒杀$30/月起,新上韩国服务器,香港/日本/美国站群服务器,VPS月付$1.99起,GPU服务器,高防服务器_vps香港

RAKsmart发布了新年钜惠活动,即日起到2月28日,商家每天推出限量服务器秒杀,美国服务器每月30美元起,新上了韩国服务器、GPU服务器、香港/日本/美国常规+站群服务器、1-10Gbps不限流量大带宽服务器等大量库存;VPS主机全场提供7折优惠码,同时针对部分特惠套餐无码直购每月仅1.99美元,支持使用PayPal或者支付宝等方式付款,有中英文网页及客服支持。爆款秒杀10台/天可选精品网/大...

红帽linux为你推荐
域名查询怎样查看域名是在哪个平台备案的虚拟主机价格谁知道虚拟主机的价格?海外主机租用哪有国外(欧洲)虚拟主机出租免费注册域名求一个免费的注册域名。企业虚拟主机购买虚拟主机要注意些什么?企业网站有什么好的虚拟主机推荐吗?info域名注册info域名什么时候出现的?海外主机美国主机哪个好,最好是速度和稳定性能跟得上?网站空间域名网站、域名空间三者的关系海外域名怎样注册国外域名?php虚拟空间虚拟空间怎么修改php.ini配置
域名交易 域名中介 cybermonday 阿里云搜索 东莞电信局 360抢票助手 淘宝双十一2018 12306抢票助手 主机合租 一元域名 警告本网站美国保护 促正网秒杀 赞助 泉州电信 秒杀汇 微软服务器操作系统 安徽双线服务器 七夕快乐英语 美国独立日 创建邮箱 更多