码迷,mamicode.com
首页 > 其他好文 > 详细

iSCSI服务器以及客户端安装配置

时间:2016-04-13 00:43:42      阅读:403      评论:0      收藏:0      [点我收藏+]

标签:linux   iscsi   initiator   target   

操作系统:CentOS 6.5 x86_64

软件版本:scsi-target-utils-1.0.24

      iscsi-initiator-utils-6.2.0.873


1.安装iSCSI target

yum install scsi-target-utils -y

service tgtd start

chkconfig tgtd on


2.创建虚拟磁盘文件

dd if=/dev/zero of=/iscsi_data/ocr1.img bs=1M count=1024

dd if=/dev/zero of=/iscsi_data/ocr2.img bs=1M count=1024

dd if=/dev/zero of=/iscsi_data/ocr3.img bs=1M count=1024

dd if=/dev/zero of=/iscsi_data/data1.img bs=1M count=20480

dd if=/dev/zero of=/iscsi_data/fra1.img bs=1M count=10240


3.编辑配置文件

[root@target ~]# rpm -ql scsi-target-utils

/etc/rc.d/init.d/tgtd

/etc/sysconfig/tgtd

/etc/tgt/targets.conf

/usr/sbin/tgt-admin

/usr/sbin/tgt-setup-lun

/usr/sbin/tgtadm

/usr/sbin/tgtd

/usr/sbin/tgtimg

/usr/share/doc/scsi-target-utils-1.0.24

/usr/share/doc/scsi-target-utils-1.0.24/README

/usr/share/doc/scsi-target-utils-1.0.24/README.iscsi

/usr/share/doc/scsi-target-utils-1.0.24/README.iser

/usr/share/doc/scsi-target-utils-1.0.24/README.lu_configuration

/usr/share/doc/scsi-target-utils-1.0.24/README.mmc

/usr/share/man/man5/targets.conf.5.gz

/usr/share/man/man8/tgt-admin.8.gz

/usr/share/man/man8/tgt-setup-lun.8.gz

/usr/share/man/man8/tgtadm.8.gz


[root@target ~]# vi /etc/tgt/targets.conf

<target iqn.2016-04.target:vdisk>

    backing-store /iscsi_data/ocr1.img

    backing-store /iscsi_data/ocr2.img

    backing-store /iscsi_data/ocr3.img

    backing-store /iscsi_data/data1.img

    backing-store /iscsi_data/fra1.img

</target>


4.重新启动tgtd服务

[root@target ~]# service tgtd restart

停止 SCSI target daemon:                                  [确定]

正在启动 SCSI target daemon:                              [确定]

[root@target ~]# tgtadm --mode target --op show

Target 1: iqn.2016-04.target:vdisk

    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: 21475 MB, Block size: 512

            Online: Yes

            Removable media: No

            Prevent removal: No

            Readonly: No

            Backing store type: rdwr

            Backing store path: /iscsi_data/data1.img

            Backing store flags: 

        LUN: 2

            Type: disk

            SCSI ID: IET     00010002

            SCSI SN: beaf12

            Size: 10737 MB, Block size: 512

            Online: Yes

            Removable media: No

            Prevent removal: No

            Readonly: No

            Backing store type: rdwr

            Backing store path: /iscsi_data/fra1.img

            Backing store flags: 

        LUN: 3

            Type: disk

            SCSI ID: IET     00010003

            SCSI SN: beaf13

            Size: 1074 MB, Block size: 512

            Online: Yes

            Removable media: No

            Prevent removal: No

            Readonly: No

            Backing store type: rdwr

            Backing store path: /iscsi_data/ocr1.img

            Backing store flags: 

        LUN: 4

            Type: disk

            SCSI ID: IET     00010004

            SCSI SN: beaf14

            Size: 1074 MB, Block size: 512

            Online: Yes

            Removable media: No

            Prevent removal: No

            Readonly: No

            Backing store type: rdwr

            Backing store path: /iscsi_data/ocr2.img

            Backing store flags: 

        LUN: 5

            Type: disk

            SCSI ID: IET     00010005

            SCSI SN: beaf15

            Size: 1074 MB, Block size: 512

            Online: Yes

            Removable media: No

            Prevent removal: No

            Readonly: No

            Backing store type: rdwr

            Backing store path: /iscsi_data/ocr3.img

            Backing store flags: 

    Account information:

    ACL information:

        ALL


5.在Windows客户端发现服务器

技术分享

登录到target,可以看到磁盘

技术分享

技术分享

6.Linux客户端操作

安装iscsi initiator

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

配置客户端的initiatorname

[root@rac1 ~]# vi /etc/iscsi/initiatorname.iscsi

设置开机启动

[root@rac1 ~]# chkconfig iscsid on

发现target服务器

[root@rac1 ~]# iscsiadm -m discovery -t sendtargets -p 192.168.253.200:3260

192.168.253.200:3260,1 iqn.2016-04.target:vdisk

接入iscsi target

[root@rac1 ~]# iscsiadm -m node -T iqn.2016-04.target:vdisk -l 

Logging in to [iface: default, target: iqn.2016-04.target:vdisk, portal: 192.168.253.200,3260] (multiple)

Login to [iface: default, target: iqn.2016-04.target:vdisk, portal: 192.168.253.200,3260] successful.

查看磁盘正常

[root@rac1 ~]# fdisk -l

Disk /dev/sdi: 21.5 GB, 21474836480 bytes

64 heads, 32 sectors/track, 20480 cylinders

Units = cylinders 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/sdj: 10.7 GB, 10737418240 bytes

64 heads, 32 sectors/track, 10240 cylinders

Units = cylinders 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/sdk: 1073 MB, 1073741824 bytes

34 heads, 61 sectors/track, 1011 cylinders

Units = cylinders of 2074 * 512 = 1061888 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x00000000


Disk /dev/sdl: 1073 MB, 1073741824 bytes

34 heads, 61 sectors/track, 1011 cylinders

Units = cylinders of 2074 * 512 = 1061888 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x00000000


Disk /dev/sdm: 1073 MB, 1073741824 bytes

34 heads, 61 sectors/track, 1011 cylinders

Units = cylinders of 2074 * 512 = 1061888 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x00000000


本文出自 “Linux Oracle and future” 博客,请务必保留此出处http://childres.blog.51cto.com/11420270/1763069

iSCSI服务器以及客户端安装配置

标签:linux   iscsi   initiator   target   

原文地址:http://childres.blog.51cto.com/11420270/1763069

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!