COMSTAR 全称 CommonMultiprotocol SCSI TARget,支持 iSCSI,FiberChannel,FCoE,Infiniband,SAS 等协议。
通过COMSTAR,我们可已将一个裸盘或ZFS卷 (zvol)作为LUN,通过iSCSI协议共享给其他任意操作系统类型的主机,只要客户主机上安装了iSCSI Initiator !
以下验证必要的软件包是否已经安装:
- root@egoodbtr:~# pkginfo |grep iscsi
- system SUNWiscsidmr Sun iSCSI Data Mover (Root)
- system SUNWiscsidmu Sun iSCSI Data Mover (Usr)
- system SUNWiscsir Sun iSCSI Device Driver (root)
- system SUNWiscsitgtr Sun iSCSI Target (Root)
- system SUNWiscsitgtu Sun iSCSI Target (Usr)
- system SUNWiscsitr Sun iSCSI COMSTAR Port Provider (root)
- system SUNWiscsitu Sun iSCSI COMSTAR Port Provider
- system SUNWiscsiu Sun iSCSI Management Utilities (usr)
复制代码
opensolaris可以通过 IPS 按装 storage-server 软件包组来活动COMSTAR的完整功能。
COMSTAR 通过 stmf 服务存放配置,LUN mapping 等,所以必须启动 stmf 服务。
- root@egoodbtr:~# svcs stmf
- STATE STIME FMRI
- disabled 15:49:00 svc:/system/stmf:default
- root@egoodbtr:~# svcadm enable stmf
- root@egoodbtr:~# svcs stmf
- STATE STIME FMRI
- maintenance 15:55:36 svc:/system/stmf:default
- must reboot if not stmf cannt online
- root@egoodbtr:~#reboot
- root@egoodbtr:~# svcs stmf
- STATE STIME FMRI
- online 15:57:49 svc:/system/stmf:default
- root@egoodbtr:~# stmfadm list-state
- Operational Status: online
- Config Status: initialized
复制代码
配置iSCSI Targer
验证iSCSI 相关系统服务的状态
- root@egoodbtr:~# svcs -a |grep -i iscsi
- disabled 15:57:31 svc:/network/iscsi_initiator:default
- disabled 15:57:38 svc:/network/iscsi/target:default
- disabled 15:57:38 svc:/system/iscsitgt:default
复制代码
启用iSCSI Target 服务
- root@egoodbtr:~# svcadm enable -r svc:/network/iscsi/target:default
- svcadm: svc:/milestone/network depends on svc:/network/physical, which has multiple instances.
复制代码
验证iSCSI Target服务已启用
- root@egoodbtr:~# svcs -a |grep iscsi
- disabled 15:57:31 svc:/network/iscsi_initiator:default
- disabled 15:57:38 svc:/system/iscsitgt:default
- online 16:06:11 svc:/network/iscsi/target:default
复制代码
创建iSCSI Target
- root@egoodbtr:~# ifconfig -a
- lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
- inet 127.0.0.1 netmask ff000000
- e1000g0: flags=1004843<UP,BROADCAST,RUNNING,MULTICAST,DHCP,IPv4> mtu 1500 index 2
- inet 122.133.160.77 netmask ffffff00 broadcast 122.133.160.255
- //创建 Target Portal Group 以在期望的网卡上进行iSCSI 数据通信 。
- root@egoodbtr:~# itadm create-tpg e1000g0
- root@egoodbtr:~# itadm create-target -t e1000g0
- Target iqn.1986-03.com.sun:02:4b262dba-44cc-6540-fa45-acd6287500be successfully created
- root@egoodbtr:~# itadm list-target –t e1000g0
- TARGET NAME STATE SESSIONS
- iqn.1986-03.com.sun:02:4b262dba-44cc-6540-fa45-acd6287500be online 0
-
- Configure a Target for Static Discovery
- root@egoodbtr:~# itadm list-target -v
- TARGET NAME STATE SESSIONS
- iqn.1986-03.com.sun:02:4b262dba-44cc-6540-fa45-acd6287500be online 0
- alias: -
- auth: none (defaults)
- targetchapuser: -
- targetchapsecret: unset
- tpg-tags: default
- root@egoodbtr:~# devfsadm -i iscsi
- root@egoodbtr:~# iscsiadm list initiator-node
- Initiator node name: iqn.1986-03.com.sun:01:8327c9a5ebd2.4b5391ef
- Initiator node alias: -
- Login Parameters (Default/Configured):
- Header Digest: NONE/-
- Data Digest: NONE/-
- Authentication Type: NONE
- RADIUS Server: NONE
- RADIUS Access: disabled
- Configured Sessions: 1
复制代码
创建LUN
以下示例中将创建两个LUN,一个是基于物理磁盘(裸盘),一个是基于ZFS Zvol 创建的裸设备!
使用solaris 磁盘盘片创建裸设备
- root@egoodbtr:~# sbdadm create-lu /dev/rdsk/c3t2d0s2
复制代码
- Created the following LU:
-
- GUID DATA SIZE SOURCE
- --------------------------------------------------- ------------------- ---------------------------
- 600144f0000c294bfb424a487ba80001 1071579136 /dev/rdsk/c3t2d0s2
复制代码
使用ZFS zvol 创建裸设备
1)创建ZFS 存储池 zpool
- root@egoodbtr:~# zpool create iscsi raidz c10t1d0 c20t1d0 c30t1d0
复制代码
2)创建 zvol
- root@egoodbtr:~# zfs create -V 2g iscsi/vol1
复制代码
3)将zvol配置为裸设备
- root@egoodbtr:~# sbdadm create-lu /dev/zvol/rdsk/iscsi/vol1
复制代码
- Created the following LU:
-
- GUID DATA SIZE SOURCE
- -------------------------------------------------- ------------------- ---------------------------------------
- 600144f0000c294bfb424a4886fa0002 1610547200 /dev/zvol/rdsk/iscsi/vol1
复制代码
4)设定LUN对网络上的所有主机可见
- root@egoodbtr:~/# stmfadm add-view 600144f0000c294bfb424a487ba80001
- root@egoodbtr:~/# stmfadm add-view 600144f0000c294bfb424a4886fa0002
复制代码
或设定LUN对指定的网络主机可见
- root@egoodbtr:~# stmfadm create-hg Host-A
- root@egoodbtr:~# stmfadm add-hg-member -g Host-A wwn.50014ee00274cbe wwn.50014ee00281dca
复制代码
//hg -(host group) ,wwn是远程主机节点iSCSI Initiator的wwn
- root@egoodbtr:~# stmfadm create-tg Targets-0
- root@egoodbtr:~# stmfadm add-tg-member -g Targets-0 wwn.50014ef00359bae
- root@egoodbtr:~# stmfadm add-view -h Host-A -t Targets-0 -n 1 GUID_number
复制代码
|
|
|
备份和恢复 COMSTAR 配置的方法
- # svccfg export -a stmf > COMSTAR.backup
- # svccfg import COMSTAR.backup
- # Reboot
复制代码
关于如何使用iSCSI Initiator 访问Target 端共享出来的iSCSI磁盘(LUN)
请参见以下IXPUB【技术之家】-【群主话题】中的文章:
[服务器&存储] iSCSI initiator使用-Linux
[服务器&存储] iSCSI initiator使用-Solaris
[服务器&存储] iSCSI initiator的使用-Windows
![COMSTAR iSCSI 共享配置实例指南_Comstar](https://s2.51cto.com/attachment/201012/160449435.jpg?x-oss-process=image/resize,m_fixed,w_1184)
Oracle Freeware for your Art Life orafreeware@gmail.com