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

操作系统: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

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

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客户端发现服务器

1490e0baf6f732b78243bd87c6a4e9cb.png

登录到target,可以看到磁盘

1a3c31cfaf01418c923db692873e6b10.png

044ff2911d187d4a626c15ce1e7991bb.png

6.Linux客户端操作

安装iscsiinitiator

[root@rac1 ~]# yum install -yiscsi-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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值