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

Hosteons - 限时洛杉矶/达拉斯/纽约 免费升级至10G带宽 低至年$21

Hosteons,一家海外主机商成立于2018年,在之前还没有介绍和接触这个主机商,今天是有在LEB上看到有官方发送的活动主要是针对LEB的用户提供的洛杉矶、达拉斯和纽约三个机房的方案,最低年付21美元,其特点主要在于可以从1G带宽升级至10G,而且是免费的,是不是很吸引人?本来这次活动是仅仅在LEB留言提交账单ID才可以,这个感觉有点麻烦。不过看到老龚同学有拿到识别优惠码,于是就一并来分享给有需...

RAKsmart推出7.59美元/月,云服务器产品Cloud Server,KVM架构1核1G内存40G硬盘1M带宽基础配置

近期RAKsmart上线云服务器Cloud Server产品,KVM架构1核1G内存40G硬盘1M带宽基础配置7.59美元/月!RAKsmart云服务器Cloud Server位于美国硅谷机房,下单可选DIY各项配置,VPC网络/经典网络,大陆优化/精品网线路,1-1000Mbps带宽,支持Linux或者Windows操作系统,提供Snap和Backup。RAKsmart机房是一家成立于2012年...

ShockHosting日本机房VPS测试点评

这个月11号ShockHosting发了个新上日本东京机房的邮件,并且表示其他机房可以申请转移到日本,刚好赵容手里有个美国的也没数据就发工单申请新开了一个,这里做个简单的测试,方便大家参考。ShockHosting成立于2013年,目前提供的VPS主机可以选择11个数据中心,包括美国洛杉矶、芝加哥、达拉斯、杰克逊维尔、新泽西、澳大利亚、新加坡、日本、荷兰和英国等。官方网站:https://shoc...

红帽linux为你推荐
网站空间租赁网站空间租用好一些还是云主机好一些?网站空间租赁如何租用网站空间?怎么查看空间支持那些功能呢? 一般多少钱?cm域名注册CM域名后缀怎么样啊?百度对CM域名收录友好吗?linux主机【windows主机换Linux主机该怎么弄啊?需要注意些什么呢?】info域名注册INFO域名有没有注册价值?中文域名注册查询哪里有可以查询中文域名是否被注册的地方?香港虚拟空间香港空间,香港虚拟主机,香港虚拟空间推荐一家,公司要做一个网站,需要1G的,不限流量的,其它的空间不要网站空间价格我想自己弄个小网站,但我不会懂域名和买空间价格,便宜一点的一共要多少钱?北京网站空间自己弄一个简单的网站,大概需要办理什么,大概需要多少钱?虚拟主机评测网求推荐一些适合个人博客网站的虚拟主机的服务商
虚拟主机评测网 虚拟主机管理软件 免费国际域名 n点虚拟主机管理系统 希网动态域名 2019年感恩节 photonvps locvps 10t等于多少g 宕机监控 dropbox网盘 卡巴斯基官方免费版 idc是什么 域名和空间 太原网通测速平台 1美金 路由跟踪 lamp什么意思 空间服务器 腾讯网盘 更多