1.安装环境
centos 6.4 x86_64
vmware esxi 5.1
tgt
sheepdog
linux iscsi-initiator
2.安装步骤
2.1sheepdog创建vdi
创建vdi
# collie vdi create -P -r -c 2 iscsivol 2G
查看vdi
[root@sheepdog-1 doc]# collie vdi list
Name Id Size Used Shared Creation time VDI id Copies Tag
centos6 0 4.0 GB 2.1 GB 0.0 MB 2013-08-26 10:54 6c3ecd 2
test 0 10 GB 10 GB 0.0 MB 2013-08-26 10:54 7c2b25 2
iscsivol 0 10 GB 10 GB 0.0 MB 2013-08-26 13:14 edea1b 2
2.2 安装tgt
在sheepdog 任一节点上安装tgt
$ git clone git://github.com/fujita/tgt.git -b sheepdog
$ cd tgt
$ make
# make install
2.3 配置tgtd
启动tgtd
#tgtd
创建target
# tgtadm --op new --mode target --tid 1 --lld iscsi -T iqn.2001-04.com.example:storage.sr.rose.sys1.xyz
创建lun
#tgtadm --op new --mode logicalunit --tid 1 --lun 1 -b iscsivol --bstype sheepdog
访问权限
# tgtadm --lld iscsi --op bind --mode target --tid 1 -I ALL
查看tgt target配置
[root@sheepdog-1 doc]# tgtadm --lld iscsi --op show --mode target
Target 1: iqn.2001-04.com.example:storage.sr.rose.sys1.xyz
System information:
Driver: iscsi
State: ready
I_T nexus information:
I_T nexus: 1
Initiator: iqn.1994-05.com.redhat:7b5a1aaa4f5e
Connection: 0
IP Address: 10.10.200.217
LUN information:
LUN: 0
Type: controller
SCSI ID: IET 00010000
SCSI SN: beaf10
Size: 0 MB
Online: Yes
Removable media: 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: 10737 MB
Online: Yes
Removable media: No
Readonly: No
Backing store type: sheepdog
Backing store path: iscsivol
Backing store flags:
Account information:
ACL information:
ALL
2.4 访问iscsitarget
查找target
#iscsiadm -m discovery -t sendtargets -p 10.10.200.213:3260
连接targets
#iscsiadm -m node -T iqn.2001-04.com.example:storage.sr.rose.sys1.xyz -l
查看scsi设配信息
[root@test ~]# cat /proc/scsi/scsi
Attached devices:
Host: scsi0 Channel: 00 Id: 01 Lun: 00
Vendor: ATA Model: QEMU HARDDISK Rev: 1.6.
Type: Direct-Access ANSI SCSI revision: 05
Host: scsi1 Channel: 00 Id: 00 Lun: 00
Vendor: QEMU Model: QEMU DVD-ROM Rev: 1.6.
Type: CD-ROM ANSI SCSI revision: 05
Host: scsi1 Channel: 00 Id: 01 Lun: 00
Vendor: ATA Model: QEMU HARDDISK Rev: 1.6.
Type: Direct-Access ANSI SCSI revision: 05
Host: scsi2 Channel: 00 Id: 00 Lun: 00
Vendor: IET Model: Controller Rev: 0001
Type: RAID ANSI SCSI revision: 05
Host: scsi2 Channel: 00 Id: 00 Lun: 01
Vendor: IET Model: VIRTUAL-DISK Rev: 0001
Type: Direct-Access ANSI SCSI revision: 05
查看HDD信息
[root@test ~]# fdisk -l
Disk /dev/sda: 4294 MB, 4294967296 bytes
43 heads, 32 sectors/track, 6096 cylinders
Units = cylinders of 1376 * 512 = 704512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00021a3e
Device Boot Start End Blocks Id System
/dev/sda1 * 2 6097 4193280 83 Linux
Disk /dev/sdb: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Disk /dev/sdb doesn't contain a valid partition table
Disk /dev/sdc: 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/sdc doesn't contain a valid partition table
/dev/sdc为sheepdog通过iscsi分配过来的HDD