感谢支持
我们一直在努力

RHCA>>学习篇>>3>>ISCSI RHEL5

一。配置ISCSI Target 服务端


1.安装ISCSI Target 软件包


CentOS ,RHEL5


[root@server1 ~]# yum install iscsi-initiator-utils –y


[root@server1 ~]# yum install scsi-target-utils  -y


2.新增加两个分区/dev/sdb1,/dev/sdb2 使用ISCSI 共享。


[root@server1 ~]# fdisk -l


Disk /dev/sda: 8589 MB, 8589934592 bytes


255 heads, 63 sectors/track, 1044 cylinders


Units = cylinders of 16065 * 512 = 8225280 bytes


Device Boot      Start         End      Blocks   Id  System


/dev/sda1   *           1          13      104391   83  Linux


/dev/sda2              14        1044     8281507+  8e  Linux LVM


Disk /dev/sdb: 8589 MB, 8589934592 bytes


255 heads, 63 sectors/track, 1044 cylinders


Units = cylinders of 16065 * 512 = 8225280 bytes


Device Boot      Start         End      Blocks   Id  System


/dev/sdb1               1         512     4112608+  83  Linux


/dev/sdb2             513        1044     4273290   83  Linux


[root@server1 ~]#


3. 启动服务端tgtd


[root@server1 ~]# chkconfig tgtd on


[root@server1 ~]# service tgtd start


Starting SCSI target daemon: [确定]


[root@server1 ~]#


4.使用tgtadm 定义iscsi target 的qualified


root@server1 ~]# tgtadm –lld iscsi –op new –mode target –tid 1 -T iqn.2009-12.com.example.com.disk1


[root@server1 ~]# tgtadm –lld iscsi –op new –mode target –tid 2 -T iqn.2009-12.com.example.com.disk2


5.使用tgtadm 往已创建的目标里增加分区


[root@server1 ~]# tgtadm –lld iscsi –op new –mode logicalunit –tid 1 –lun 1 -b /dev/sdb1


[root@server1 ~]# tgtadm –lld iscsi –op new –mode logicalunit –tid 2 –lun 1 -b /dev/sdb2


6.使用tgtadm 允许客户端访问


[root@server1 ~]# tgtadm –lld iscsi –op bind –mode target –tid 1 -I ALL


[root@server1 ~]# tgtadm –lld iscsi –op bind –mode target –tid 2 -I ALL


7.使用tgtadm 验证目标逻辑卷


[root@server1 ~]# tgtadm –lld iscsi –op show –mode target | grep Target


Target 1: iqn.2009-12.com.example.com.disk1


Target 2: iqn.2009-12.com.example.com.disk2


[root@server1 ~]#


8.为了重启后有效,将上述命令加到/etc/rc.d/rc.local文件。


二.配置ISCSI 客户端


1. [root@station1 ~]# chkconfig iscsi on


[root@station1 ~]# service iscsi start


iscsid (pid 1705 1704) 正在运行…


设置 iSCSI 目标:iscsiadm: No records found!


[确定]


[root@station1 ~]#


2.发现ISCSI 服务端资源


[root@station1 ~]# iscsiadm -m discovery -t sendtargets -p 192.168.0.254


192.168.0.254:3260,1 iqn.2009-12.com.example.com.disk1


192.168.0.254:3260,1 iqn.2009-12.com.example.com.disk2


[root@station1 ~]#


3.使用iscsiadm 登录target


[root@station1 ~]# iscsiadm -m node -T iqn.2009-12.com.example.com.disk1 -p 192.168.0.254 -l


Logging in to [iface: default, target: iqn.2009-12.com.example.com.disk1, portal: 192.168.0.254,3260]


Login to [iface: default, target: iqn.2009-12.com.example.com.disk1, portal: 192.168.0.254,3260]: successful


[root@station1 ~]# iscsiadm -m node -T iqn.2009-12.com.example.com.disk2 -p 192.168.0.254 -l


Logging in to [iface: default, target: iqn.2009-12.com.example.com.disk2, portal: 192.168.0.254,3260]


Login to [iface: default, target: iqn.2009-12.com.example.com.disk2, portal: 192.168.0.254,3260]: successful


[root@station1 ~]#


4.查看当前磁盘分区,可以看到新加入的两个分区/dev/sdb  /dev/sdc


[root@station1 ~]# fdisk -l


Disk /dev/sda: 8589 MB, 8589934592 bytes


255 heads, 63 sectors/track, 1044 cylinders


Units = cylinders of 16065 * 512 = 8225280 bytes


Device Boot      Start         End      Blocks   Id  System


/dev/sda1   *           1          13      104391   83  Linux


/dev/sda2              14        1044     8281507+  8e  Linux LVM


Disk /dev/sdb: 4211 MB, 4211311104 bytes


130 heads, 62 sectors/track, 1020 cylinders


Units = cylinders of 8060 * 512 = 4126720 bytes


Disk /dev/sdb doesn’t contain a valid partition table


Disk /dev/sdc: 4375 MB, 4375848960 bytes


135 heads, 62 sectors/track, 1021 cylinders


Units = cylinders of 8370 * 512 = 4285440 bytes


Disk /dev/sdc doesn’t contain a valid partition table


[root@station1 ~]#

赞(0) 打赏
转载请注明出处:服务器评测 » RHCA>>学习篇>>3>>ISCSI RHEL5
分享到: 更多 (0)

听说打赏我的人,都进福布斯排行榜啦!

支付宝扫一扫打赏

微信扫一扫打赏