Linux下应用iSCSI 技术

[不指定 2008/07/15 15:39 | by askwan ]
iSCSI 技术,顾名思义,即internet SCSI,这样就比较容易理解和记忆,是IETF制订的一项标准,用于将SCSI数据块映射成以太网数据包。这样就可以使用iSCSI协议通过IP网络来传输SCSI数据块,使我们可以用以太网来构建IP存储局域网。通过网友的张图,可以更清晰的理解这种存储架构了
Open in new window

现在iscsi也有开源社区的支持,使我们可以利用软件的方式体验这种技术了
官方网站是:http://iscsitarget.sourceforge.net/
需要用到的软件iscsi-target包也需要在这里下载,貌似,连接已经实效,
大家用svn直接download源代码下来编译也是一样的。

官方要求linux系统内核版本必须是>=2.6.14,做试验就用Centos 5,RHEL5,FC8,FC9吧,这些系统内核都支持
解压,然后编译和安装
Quotation
[root@localhost ~]# make
[root@localhost ~]# make install


这里“两个端”要搞清楚一个是Target,存储设备端(理解为“服务器端”);一个是Initiator(理解为“客户端”)。

下面配置target端
编译/etc/ietd.conf文件
其他的不用看,就看这段


Target iqn.2001-04.com.example:storage.disk2.sys1.xyz
        # Users, who can access this target. The same rules as for discovery
        # users apply here.
        # Leave them alone if you don't want to use authentication.
        #IncomingUser joe secret
        #OutgoingUser jim 12charpasswd
        # Logical Unit definition
        # You must define one logical unit at least.
        # Block devices, regular files, LVM, and RAID can be offered
        # to the initiators as a block device.
        Lun 0 Path=/dev/sdb,Type=fileio
        # Alias name for this target
        # Alias Test
        # various iSCSI parameters
        # (not all are used right now, see also iSCSI spec for details)
        #MaxConnections         1
        #InitialR2T             Yes
        #ImmediateData          No
        #MaxRecvDataSegmentLength 8192


Target iqn.2001-04.com.example:storage.disk2.sys1.xyz 这个每台机器都不一样,可以修改,简称主机Iqn,即iSCSI Qualified Name

Lun 0 Path=/dev/sdb,Type=fileio  这里设定存储设备和名称

设定完了 启动
Quotation
[root@localhost ~]# /etc/init.d/iscsi-target start


设定开机自动启动
Quotation
[root@localhost ~]# chkconfig iscsi-target on


这样,我说的target端(“服务端") 就配置完了

客户端,如果是win,可以到这里去下载iSCSI Initiator支持软件
http://www.microsoft.com/WindowsServer2003/technologies/storage/iscsi/default.mspx
安装完了,设置一下就可以使用了

我这里主要是做一下linux做为Initiator端的使用方法,
这里假设target端IP为 192.168.0.30

先来查找
Quotation
[root@localhost ~]# iscsiadm -m discovery --type sendtargets --portal 192.168.0.30
192.168.0.30:3260,1 iqn.2001-04.com.example:storage.disk2.sys1.xyz
以上信息,表明找到

下面重启客户端
Quotation
[root@localhost ~]# service iscsi restart


Stopping iSCSI daemon: /etc/init.d/iscsi: line 33:  2436 Killed                  /etc/init.d/iscsid stop
iscsid dead but pid file exists
Turning off network shutdown. Starting iSCSI daemon: [  OK  ]
[  OK  ]
Setting up iSCSI targets: Logging in to [iface: default, target: iqn.2001-04.com.example:storage.disk2.sys1.xyz, portal: 192.168.0.30,3260]
Login to [iface: default, target: iqn.2001-04.com.example:storage.disk2.sys1.xyz, portal: 192.168.0.30,3260]: successful
[  OK  ]



然后查看是否已经挂过来了
[root@localhost ~]# fdisk -l

Disk /dev/sdb: 2147 MB, 2147483648 bytes
67 heads, 62 sectors/track, 1009 cylinders
Units = cylinders of 4154 * 512 = 2126848 bytes
Disk identifier: 0x00000000

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

这样客户端下就有target端共享出来的存储设备sdb了!

接下来是杀是剐就由你控制了,^_^^_^

作者:askwan@『AskWan』
地址:http://www.askwan.com/post/75/
可以转载,转载时请以链接形式注明作者和原始出处及本声明!

Oprating System | Comments(1) | Trackbacks(0) | Reads(1670)
收藏到网摘:百度搜藏 Google书签 Yahoo收藏 新浪ViVi收藏夹 365天天网摘 天极网摘 我摘·网摘·网络书签 POCO网摘 和讯网摘 Bolaa博拉博客收录中心 天下图摘
kinshen Email
2008/07/17 10:36
iscsi和windows的磁盘映射差距在哪里?
iSCSI Cake与网络邻居共享有什么不同?网络邻居是文件级共享,iSCSI是裸设备级共享。网络邻居映射的盘不支持数据库和运行某些游戏,iSCSI支持所有磁盘操作和应用程序。而且iSCSI Cake的性能要高于网络邻居。
Pages: 1/1 First page 1 Final page
Add a comment
Emots
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
Enable HTML
Enable UBB
Enable Emots
Hidden
Remember
Nickname   Password   Optional
Site URI   Email   [Register]