cheng029 发表于 2012-7-24 09:32:53

SCSI共享存储服务器及客户端配置

测试环境:rhel 6.3 虚拟机
IP规划:
服务器:192.168.0.240
客户端:192.168.0.241 和 192.168.0.242

SCSI服务器端
1、准备共享磁盘或分区 ,此处共享出一块磁盘/dev/vdb
2、安装软件包
# yum groupinstall "Network Storage Server" -y
================================================================================================
Package                     Arch             Version                  Repository      Size
================================================================================================
Installing:
scsi-target-utils             x86_64         1.0.24-2.el6             Server         170 k
Installing for dependencies:
perl-Config-General         noarch         2.44-1.el6               Server            68 k
3、启动并启用tgtd服务
# /etc/init.d/tgtd start
Starting SCSI target daemon:                              
# chkconfig tgtd on
4、编辑scsi服务端的targets配置文件
# vi /etc/tgt/targets.conf
<target iqn.2012-07.com.example:rhcs>
   backing-store /dev/vdb
   initiator-address 192.168.0.241
   initiator-address 192.168.0.242
< /target>
5、重启tgtd服务
# /etc/init.d/tgtd restart
Stopping SCSI target daemon:                              
Starting SCSI target daemon:                              
6、显示所有targets
# tgt-admin -s
Target 1: iqn.2012-07.com.example:rhcs
    System information:
      Driver: iscsi
      State: ready
    I_T nexus information:
    LUN information:
      LUN: 0
            Type: controller
            SCSI ID: IET   00010000
            SCSI SN: beaf10
            Size: 0 MB, Block size: 1
            Online: Yes
            Removable media: No
            Prevent removal: No
            Readonly: No
            Backing store type: null
            Backing store path: None
            Backing store flags:
      LUN: 1
            Type: disk
            SCSI ID: IET   00010001
            SCSI SN: beaf11
            Size: 5369 MB, Block size: 512
            Online: Yes
            Removable media: No
            Prevent removal: No
            Readonly: No
            Backing store type: rdwr
            Backing store path: /dev/vdb
            Backing store flags:
    Account information:
    ACL information:
      192.168.0.241
      192.168.0.242

iSCSI客户端配置
1、安装软件包


================================================================================================
Package                        Arch            Version                   Repository       Size
================================================================================================
Installing:
iscsi-initiator-utils          x86_64          6.2.0.872-41.el6          Server          654 k
2、discover 发现 targets
# iscsiadm --mode discoverydb --type sendtargets --portal 192.168.0.240 --discover

Starting iscsid:                                          

192.168.0.240:3260,1 iqn.2012-07.com.example:rhcs
3、login 连接 targets
# iscsiadm --mode node --targetname iqn.2012-07.com.example:rhcs --portal 192.168.0.240:3260 --login
Logging in to (multiple)
Login to successful.
4、查看是否连接成功


# fdisk -l

……
Disk /dev/sda: 5368 MB, 5368709120 bytes
166 heads, 62 sectors/track, 1018 cylinders
Units = cylinders of 10292 * 512 = 5269504 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x65ddc4fb

   Device Boot      Start         End      Blocks   IdSystem

// 看到 sda盘,代表SCSI盘,说明客户端挂载成功!


遇到问题小记
问题描述:SCSI服务器端与客户端可相互ping通,但当iSCSI客户端discover scsi-targets时,报错 No route to host

# iscsiadm --mode discoverydb --type sendtargets --portal 192.168.0.240 --discoveriscsiadm: cannot make connection to 192.168.0.240: No route to host
iscsiadm: cannot make connection to 192.168.0.240: No route to host
iscsiadm: cannot make connection to 192.168.0.240: No route to host
iscsiadm: cannot make connection to 192.168.0.240: No route to host
iscsiadm: cannot make connection to 192.168.0.240: No route to host
iscsiadm: cannot make connection to 192.168.0.240: No route to host
iscsiadm: connection login retries (reopen_max) 5 exceeded
iscsiadm: Could not perform SendTargets discovery: encountered connection failure

问题原因:SCSI服务器端iptables限制

解决办法:清空服务器端iptables,或开放3260端口


该贴已经同步到 admin的微博

outlook 发表于 2013-3-14 04:36:29

学习了,不错,讲的太有道理了

agangliu0400 发表于 2013-5-16 00:08:29

鸳鸳相抱何时了,鸯在一边看热闹。

窝窝插件 发表于 2013-5-16 14:34:32

走过了年少,脚起了水泡

云中漫步 发表于 2013-5-17 04:00:43

我抢、我抢、我抢沙发~

gxh1968 发表于 2013-5-17 17:19:04

俺从不写措字,但俺写通假字!

xglys 发表于 2013-5-18 05:26:28

找不到恐龙,就用蜥蜴顶
页: [1]
查看完整版本: SCSI共享存储服务器及客户端配置