iSCSI技术是一种由IBM公司研究开发的,是一个供硬件设备使用的可以在IP协议的上层运行的SCSI指令集,这种指令集合可以实现在IP网络上运行SCSI协议,使其能够在诸如高速千兆以太网上进行路由选择。iSCSI技术是一种新储存技术,该技术是将现有SCSI接口与以太网络(Ethernet)技术结合,使服务器可与使用IP网络的储存装置互相交换资料。
1.[root@localhost ~]#yum -y install scsi-target-utils //安装服务端target包。
Dependencies Resolved
================================================================================
Package Arch Version Repository Size ================================================================================ Installing: scsi-target-utils i686 1.0.24-2.el6 base 166 k Installing for dependencies: libibverbs i686 1.1.6-4.el6 base 45 k librdmacm i686 1.0.15-2.el6 updates 29 k lsof i686 4.82-4.el6 base 315 k perl i686 4:5.10.1-127.el6 base 9.7 M perl-Config-General noarch 2.44-1.el6 base 68 k perl-Module-Pluggable i686 1:3.90-127.el6 base 38 k perl-Pod-Escapes i686 1:1.04-127.el6 base 30 k perl-Pod-Simple i686 1:3.13-127.el6 base 210 k perl-libs i686 4:5.10.1-127.el6 base 591 k perl-version i686 3:0.77-127.el6 base 49 k sg3_utils i686 1.28-4.el6 base 471 k sg3_utils-libs i686 1.28-4.el6 base 50 kTransaction Summary
2.[root@localhost ~]# chkconfig tgtd on //tgtd开机启动
3.[root@localhost ~]# service tgtd start //启动tgtd服务
Starting SCSI target daemon: [ OK ]4.[root@localhost ~]# fdisk /dev/sdb //添加一块硬盘fdisk命令创建一个sdb1 20g 分区,或者在文件系统上创建一个镜像文件。
5.[root@localhost /]# mkdir -p /home/zh888 //创建zh888目录
[root@localhost /]# dd if=/dev/zero of=/home/zh888/zh888.img bs=1M count=1000 //创建一个zh888.img镜像文件
1000+0 records in 1000+0 records out 1048576000 bytes (1.0 GB) copied, 6.81786 s, 154 MB/s6.[root@localhost /]# restorecon -R /home/zh888/
7.[root@localhost /]# ll -Z /home/zh888
-rw-r--r-- root root ? zh888.img 8.[root@localhost tgt]# cat /etc/tgt/targets.conf default-driver iscsi <target iqn.2012-02.com.example:server.target1> backing-store /dev/sdb1 #share backing-store /var/lib/tgtd/virtualization/virtp_w_picpath.img #share2 write-cache on </target><target zh888.com:server.target2>
backing-store /home/zh888/zh888.img write-cache on </target> 9.[root@localhost ~]# tgt-admin --show Target 1: iqn.2012-02.com.example:server.target1 System information: Driver: iscsi State: ready I_T nexus information: I_T nexus: 2 Initiator: iqn.1991-05.com.microsoft:-7eec9485 Connection: 1 IP Address: 192.168.xx.xx 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: 21468 MB, Block size: 512 Online: Yes Removable media: No Prevent removal: No Readonly: No Backing store type: rdwr Backing store path: /dev/sdb1 Backing store flags: LUN: 2 Type: disk SCSI ID: IET 00010002 SCSI SN: beaf12 Size: 524 MB, Block size: 512 Online: Yes Removable media: No Prevent removal: No Readonly: No Backing store type: rdwr Backing store path: /var/lib/tgtd/virtualization/virtp_w_picpath.img Backing store flags: Account information: ACL information: ALL Target 2: zh888.com:server.target2 System information: Driver: iscsi State: ready I_T nexus information: I_T nexus: 1 Initiator: iqn.1991-05.com.microsoft-7eec9485 Connection: 1 IP Address: 192.168.xx.xx LUN information: LUN: 0 Type: controller SCSI ID: IET 00020000 SCSI SN: beaf20 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 00020001 SCSI SN: beaf21 Size: 1049 MB, Block size: 512 Online: Yes Removable media: No Prevent removal: No Readonly: No Backing store type: rdwr Backing store path: /home/zh888/zh888.img Backing store flags: Account information: ACL information: ALL10.客户端xp的连接,输入服务器的ip地址。
11.targets目标如下:
12.磁盘管理就会看到未知磁盘1g
13.初始化zh888.img磁盘1g的磁盘如下:
14.磁盘初始化好未指派状态
15.磁盘格式化好之后属性
16.磁盘管理如下
遇到的问题:刚开始tgtd启动不了原因selinux的原因。