分区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

无忧云:服务器100G高防云服务器,bgpBGP云,洛阳BGP云服务器2核2G仅38.4元/月起

无忧云怎么样?无忧云值不值得购买?无忧云,无忧云是一家成立于2017年的老牌商家旗下的服务器销售品牌,现由深圳市云上无忧网络科技有限公司运营,是正规持证IDC/ISP/IRCS商家,主要销售国内、中国香港、国外服务器产品,线路有腾讯云国外线路、自营香港CN2线路等,都是中国大陆直连线路,非常适合免备案建站业务需求和各种负载较高的项目,同时国内服务器也有多个BGP以及高防节点。目前,四川雅安机房,4...

PacificRack:洛杉矶KVM月付1.5美元起,1G内存套餐年付12美元起

PacificRack在本月发布了几款特价产品,其中最低款支持月付仅1.5美元,基于KVM架构,洛杉矶机房,PR-M系列。PacificRack简称PR,QN机房旗下站点,主要提供低价VPS主机产品,基于KVM架构,数据中心为自营洛杉矶机房,现在只有PR-M一个系列,分为了2个类别:常规(Elastic Compute Service)和多IP产品(Multi IP Server)。下面列出几款秒...

阿里云金秋上云季,云服务器秒杀2C2G5M年付60元起

阿里云(aliyun)在这个月又推出了一个金秋上云季活动,到9月30日前,每天两场秒杀活动,包括轻量应用服务器、云服务器、云数据库、短信包、存储包、CDN流量包等等产品,其中Aliyun轻量云服务器最低60元/年起,还可以99元续费3次!活动针对新用户和没有购买过他们的产品的老用户均可参与,每人限购1件。关于阿里云不用多说了,国内首屈一指的云服务器商家,无论建站还是学习都是相当靠谱的。活动地址:h...

红帽linux为你推荐
免费美国主机哪里有免费不限流量的国外主机info域名注册INFO域名有没有注册价值?com域名注册com域名是永久注册的吗域名申请申请域名需要什么条件?具体点!急!急!!!虚拟主机管理系统急!高分!比较好用的虚拟主机管理系统有哪些?天津虚拟主机天津哪个是新网互联代理呢,我打算购买邮局?深圳虚拟主机需要一个虚拟主机???很急!!青岛虚拟主机阿里云主机青岛好还是杭州好四川虚拟主机哪些网站适合租用独立服务器?虚拟主机提供商那个提供商的虚拟主机比较便宜,不要小牌子,服务要好
域名注册查询 备案域名查询 域名主机空间 服务器租用托管 2017年黑色星期五 灵动鬼影 cpanel空间 bgp双线 免费全能主机 免费mysql数据库 空间租赁 免费的域名 新加坡空间 lamp的音标 稳定空间 测试网速命令 中国电信宽带测速 闪讯网 hdsky 贵州电信 更多