Centos 6.5下配置tgt后端存储为ceph

操作环境


Centos 6.5
ceph 0.87
tgt 

操作步骤

安装tgt
#wget http://ceph.com/packages/ceph-extras/rpm/centos6/x86_64/scsi-target-utils-1.0.38-48.bf6981.ceph.el6.x86_64.rpm
#rpm -ivh scsi-target-utils-1.0.38-48.bf6981.ceph.el6.x86_64.rpm

查看当前tgt对于rbd driver是否支持
[root@ceph-osd-3 ~]# tgtadm --lld iscsi --mode system --op show
System:
    State: ready
    debug: off
LLDs:
    iser: error
    iscsi: ready
Backing stores:
    rbd (bsoflags sync:direct)
    rdwr (bsoflags sync:direct)
    ssc
    null
    bsg
    sg
    sheepdog
Device types:
    passthrough
    tape
    changer
    controller
    osd
    cd/dvd
    disk
iSNS:
    iSNS=Off
    iSNSServerIP=
    iSNSServerPort=3205
    iSNSAccessControl=Off

在Backing stores栏中可以看见rbd,说明该tgt可对rbd支持

创建tgt所需的pool以及rbd

[root@ceph-osd-1 ~]ceph osd pool create iscsi 256
[root@ceph-osd-1 ~]rbd create tgt --size 10240 --pool iscsi

查看rbd

[root@ceph-osd-1 ~]# rbd ls --pool iscsi
tgt

添加以下内容至gt配置文件中

include /etc/tgt/conf.d/*.conf

    driver iscsi
    bs-type rbd
    backing-store iscsi/tgt  


重启tgtd

[root@ceph-osd-3 ~]# /etc/init.d/tgtd restart
Stopping target framework daemon
Starting target framework daemon

在iscsi initiator端连接该iscsi target

[root@ceph-osd-1 ~]# iscsiadm -m discovery -t sendtargets -p 10.10.200.165
Starting iscsid:                                           [  OK  ]
10.10.200.165:3260,1 iqn.2014-11.rbdstore.com:iscsi
[root@ceph-osd-1 ~]# iscsiadm -m node -T iqn.2014-11.rbdstore.com:iscsi -l
Logging in to [iface: default, target: iqn.2014-11.rbdstore.com:iscsi, portal: 10.10.200.165,3260] (multiple)
Login to [iface: default, target: iqn.2014-11.rbdstore.com:iscsi, portal: 10.10.200.165,3260] successful.
[root@ceph-osd-1 ~]# fdisk -l

Disk /dev/sdb: 5788.2 GB, 5788206759936 bytes
255 heads, 63 sectors/track, 703709 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/sda: 209.7 GB, 209715068928 bytes
255 heads, 63 sectors/track, 25496 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: 0x0009a9dd

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1         131     1048576   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2             131        1176     8392704   82  Linux swap / Solaris
/dev/sda3            1176       25497   195356672   8e  Linux LVM

Disk /dev/mapper/vg_swift-LogVol00: 200.0 GB, 200043134976 bytes
255 heads, 63 sectors/track, 24320 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/mapper/docker-253:0-3539142-pool: 107.4 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 65536 bytes
Disk identifier: 0x00000000


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 / 4194304 bytes
I/O size (minimum/optimal): 4194304 bytes / 4194304 bytes
Disk identifier: 0x00000000

可以发现sdc为映射过来的新硬盘





你可能感兴趣的:(ceph,iscsi)