基于ipsan 的iscsi存储

 
192.168.3.128 target 端
192.168.3.129 intiator端
192.168.3.133 intiator端(winXP)


128上安装iscis target 软件
yum install scsi-target-utils
目录结构如下
[root@target ~]# rpm -qal  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.14
/usr/share/doc/scsi-target-utils-1.0.14/README
/usr/share/doc/scsi-target-utils-1.0.14/README.iscsi
/usr/share/doc/scsi-target-utils-1.0.14/README.iser
/usr/share/doc/scsi-target-utils-1.0.14/README.lu_configuration
/usr/share/doc/scsi-target-utils-1.0.14/README.mmc
/usr/share/man/man8/tgt-admin.8.gz
/usr/share/man/man8/tgt-setup-lun.8.gz
/usr/share/man/man8/tgtadm.8.gz


设置开机启动
chkconfig tgtd on
启动target
/etc/init.d/tgtd start
配置一个简单的ISCSI TARGet
tgtadm --lld iscsi --op new --mode target --tid 1 -T iqn.2012-04.name.zhoutao:iscsi-disk1 #增加一个target 设备命令
[root@localhost ~]# tgtadm --lld iscsi --op show --mode target #查询target设备命令
Target 1: iqn.2012-04.name.zhoutao:iscsi-disk1
    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
            Readonly: No
            Backing store type: null
            Backing store path: None
            Backing store flags:
    Account information:
    ACL information:

将sdb1 加入到target设备中去
[root@localhost ~]# tgtadm --lld iscsi --op new --mode logicalunit --tid 1 --lun 1 -b /dev/sdb1

查看target信息
[root@localhost ~]# tgtadm --lld iscsi --op show --mode target
Target 1: iqn.2012-04.name.zhoutao:iscsi-disk1
    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
            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: 10010 MB, Block size: 512
            Online: Yes
            Removable media: No
            Readonly: No
            Backing store type: rdwr
            Backing store path: /dev/sdb1
            Backing store flags:
    Account information:
    ACL information:

允许192.168.3.129 这个主机可以存取target设备
tgtadm --lld iscsi --op bind --mode target --tid 1 --initiator-address 192.168.3.129
查看acl列表
           Type: disk
            SCSI ID: IET     00010001
            SCSI SN: beaf11
            Size: 10010 MB, Block size: 512
            Online: Yes
            Removable media: No
            Readonly: No
            Backing store type: rdwr
            Backing store path: /dev/sdb1
            Backing store flags:
    Account information:
    ACL information:
        192.168.3.129
将以上命令添加到开机启动
[root@localhost ~]# cat /etc/rc.local
tgtadm --lld iscsi --op new --mode target --tid 1 -T iqn.2012-04.name.zhoutao:iscsi-disk1
tgtadm --lld iscsi --op new --mode logicalunit --tid 1 --lun 1 -b /dev/sdb1
tgtadm --lld iscsi --op bind --mode target --tid 1 --initiator-address 192.168.3.129

winxp 下initiator安装
具体地址
http://www.microsoft.com/download/en/details.aspx?DisplayLang=en&id=18986
下载应个人版本决定
具体设置请参阅以下地址
http://wenku.baidu.com/view/62a4ce46a8956bec0975e367.html


在linux上配置initiaor端
yum安装iscsi-initiator-utils
[root@localhost ~]# rpm -qal iscsi-initiator-utils
/etc/iscsi
/etc/iscsi/iscsid.conf
/etc/logrotate.d/iscsiuiolog
/etc/rc.d/init.d/iscsi
/etc/rc.d/init.d/iscsid
/sbin/iscsi-iname
/sbin/iscsiadm
/sbin/iscsid
/sbin/iscsistart
/sbin/iscsiuio
/usr/include/fw_context.h
/usr/include/iscsi_list.h
/usr/include/libiscsi.h
/usr/lib64/libfwparam.a
/usr/lib64/libiscsi.so
/usr/lib64/libiscsi.so.0
。。。。。。。。。。。。。。。。。。。略
启动initiaor端
/etc/init.d/iscsi start

使用如下命令查看target主机划分的lun
[root@localhost ~]# iscsiadm -m discovery --type sendtargets -p 192.168.3.128
192.168.3.128:3260,1 iqn.2012-04.name.zhoutao:iscsi-disk1

执行一个target发现后会将查询记录写道以下目录下
[root@localhost ~]# cd /var/lib/iscsi/send_targets/
[root@localhost send_targets]# ls
192.168.3.128,3260

通过如下指令与iscsitaget端建立连接,
[root@localhost send_targets]# iscsiadm -m node -T iqn.2012-04.name.zhoutao:iscsi-disk1 -P 192.168.3.128 -l
Logging in to [iface: default, target: iqn.2012-04.name.zhoutao:iscsi-disk1, portal: 192.168.3.128,3260] (multiple)
Login to [iface: default, target: iqn.2012-04.name.zhoutao:iscsi-disk1, portal: 192.168.3.128,3260] successful.

如果有多个target 主机,可以使用如下命令一次性登录到所有的target主机上
[root@localhost send_targets]# iscsiadm -m node --loginall=all
Logging in to [iface: default, target: iqn.2012-04.name.zhoutao:iscsi-disk1, portal: 192.168.3.128,3260] (multiple)
Login to [iface: default, target: iqn.2012-04.name.zhoutao:iscsi-disk1, portal: 192.168.3.128,3260] successful.



断开连接
[root@localhost send_targets]# iscsiadm -m node -T iqn.2012-04.name.zhoutao:iscsi-disk1 -P 192.168.3.128 -u
Logging out of session [sid: 1, target: iqn.2012-04.name.zhoutao:iscsi-disk1, portal: 192.168.3.128,3260]
Logout of [sid: 1, target: iqn.2012-04.name.zhoutao:iscsi-disk1, portal: 192.168.3.128,3260] successful.

查看fdisk
[root@localhost ~]# fdisk -l

Disk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14        2610    20860402+  8e  Linux LVM

Disk /dev/sdb: 10.0 GB, 10010133504 bytes
64 heads, 32 sectors/track, 9546 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes

Disk /dev/sdb doesn't contain a valid partition table



 

你可能感兴趣的:(安装,职场,存储,target,休闲)