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

香港E3-1230v2 16GB 30M 326元/月 数脉科技

官方网站:https://www.shuhost.com/公司名:LucidaCloud Limited尊敬的新老客户:艰难的2021年即将结束,年终辞旧迎新之际,我们准备了持续优惠、及首月优惠,为中小企业及个人客户降低IT业务成本。我们将持续努力提供给客户更好的品质与服务,在新的一年期待与您有美好的合作。# 下列价钱首月八折优惠码: 20211280OFF (每客户限用1次) * 自助购买可复制...

Sharktech:鲨鱼机房1Gbps无限流量美国服务器;丹佛$49/月起,洛杉矶$59/月起

sharktech怎么样?sharktech鲨鱼机房(Sharktech)我们也叫它SK机房,是一家成立于2003年的老牌国外主机商,提供的产品包括独立服务器租用、VPS主机等,自营机房在美国洛杉矶、丹佛、芝加哥和荷兰阿姆斯特丹等,主打高防产品,独立服务器免费提供60Gbps/48Mpps攻击防御。机房提供1-10Gbps带宽不限流量服务器,最低丹佛/荷兰机房每月49美元起,洛杉矶机房最低59美元...

NameCheap域名转入优惠再次来袭 搜罗今年到期域名续费

在上个月的时候也有记录到 NameCheap 域名注册商有发布域名转入促销活动的,那时候我也有帮助自己和公司的客户通过域名转入到NC服务商这样可以实现省钱续费的目的。上个月续费转入的时候是选择9月和10月份到期的域名,这不还有几个域名年底到期的,正好看到NameCheap商家再次发布转入优惠,所以打算把剩下的还有几个看看一并转入进来。活动截止到9月20日,如果我们需要转入域名的话可以准备起来。 N...

红帽linux为你推荐
linux主机Linux中,用户名和主机名有什么区别?代理主机电脑店卖组装机,怎么赚钱。域名备案什么是域名备案?香港虚拟空间香港虚拟主机空间哪家最好重庆虚拟空间在重庆开一家VR体验馆价格要多少?手机网站空间谁有上手机网站刷空间人气的网址韩国虚拟主机香港虚拟主机和韩国虚拟主机比较,哪个更好?100m虚拟主机一般100-200M虚拟主机一天最多支持多少人访问啊?虚拟主机管理系统虚拟主机管理系统那一家好?北京虚拟主机虚拟主机 那个好用又实惠
域名网 万网域名注册 二级域名查询 域名服务dns的主要功能为 韩国电信 idc评测网 debian源 debian7 大容量存储 免费ftp空间申请 个人免费空间 腾讯云分析 howfile qq云端 umax120 四川电信商城 linode支付宝 金主 免备案cdn加速 国外免费网盘 更多