[分享]用Tgtadm 在EL/ RHEL5上创建一个iSCSI目标_VMware, Unix及操作系统讨论区_Weblogic技术|Tuxedo技术|中间件技术|Oracle论坛|JAVA论坛|Linux/Unix技术|hadoop论坛_联动北方技术论坛  
网站首页 | 关于我们 | 服务中心 | 经验交流 | 公司荣誉 | 成功案例 | 合作伙伴 | 联系我们 |
联动北方-国内领先的云技术服务提供商
»  游客             当前位置:  论坛首页 »  自由讨论区 »  VMware, Unix及操作系统讨论区 »
总帖数
1
每页帖数
101/1页1
返回列表
0
发起投票  发起投票 发新帖子
查看: 5220 | 回复: 0   主题: [分享]用Tgtadm 在EL/ RHEL5上创建一个iSCSI目标        下一篇 
shunzi
注册用户
等级:上尉
经验:782
发帖:133
精华:0
注册:2011-10-10
状态:离线
发送短消息息给shunzi 加好友    发送短消息息给shunzi 发消息
发表于: IP:您无权察看 2012-1-13 17:45:59 | [全部帖] [楼主帖] 楼主

用Tgtadm 在EL/ RHEL5上创建一个iSCSI目标

适用于:

Linux Kernel - Version: 5.3
Linux Itanium
Linux x86-64


目标:

如何用tgtadm和tgtd建立一个iSCSI目标。

对于这个例子,以下是必要的:

scsi-target-utils
the Partiton /dev/hdb1
Enterprise Linux / Redhat Enterprise Linux 5 Update 3


解决方案:

创建一个永久的配置

1,Install scsi-target-utils
# up2date scsi-target-utils
Name                                    Version        Rel
----------------------------------------------------------
scsi-target-utils                       0.0            5.20080917snap.el5x86_64
Testing package set / solving RPM inter-dependencies...
Downloading headers to solve dependencies...
########################################
scsi-target-utils-0.0-5.200 ########################## Done.
perl-Config-General-2.40-1. ########################## Done.
Preparing              ########################################### [100%]
Installing...
1:perl-Config-General    ########################################### [100%]
2:scsi-target-utils      ########################################### [100%]
The following packages were added to your selection to satisfy dependencies:
Name                                    Version        Release
--------------------------------------------------------------
perl-Config-General                     2.40           1.el5
2,Start the tgtd Service
# /etc/init.d/tgtd start
Starting SCSI target daemon:                               [  OK  ]


3,在/etc/TGT/targets.conf创建一个条目,我们使用的是iSCSI目标作为分区/dev/hdb1

# cat /etc/tgt/targets.conf
<target iqn.2001-04.com.mydomain:storage.disk1>
backing-store /dev/hdb1
incominguser disk1user 123456
outgoinguser disk1user 12345
</target>
4,Enable tgtd at boot
# chkconfig tgtd on


5,禁用的iptables(或配置iptables允许TCP端口3260)

# /etc/init.d/iptables stop,
# chkconfig iptables off


6,重启tgtd或系统

7,验证配置

# tgtadm --lld iscsi --op show --mode target
Target 1: iqn.2001-04.com.mydomain:storage.disk1
System information:
Driver: iscsi
State: ready
I_T nexus information:
LUN information:
LUN: 0
Type: controller
SCSI ID: deadbeaf1:0
SCSI SN: beaf10
Size: 0 MB
Online: Yes
Removable media: No
Backing store: No backing store
LUN: 1
Type: disk
SCSI ID: deadbeaf1:1
SCSI SN: beaf11
Size: 3512 MB
Online: Yes
Removable media: No
Backing store: /dev/hdb1
Account information:
ACL information:
ALL


8.与您的iSCSI客户端的新创建的目标连接,可以使用的指令Note.473179.1。

手动添加上飞行的目标

Start the tgtd Service
# /etc/init.d/tgtd start
Starting SCSI target daemon:                               [  OK  ]
Create a Target
# tgtadm --lld iscsi --op new --mode target --tid 1 -T iqn.2001-04.com.mydomain:storage.disk1
Add a Partition to the Target, we are using /dev/hdb1 as the Partition as the iSCSI Target
[root@iscsi ~]# tgtadm --lld iscsi --op new --mode logicalunit --tid 1 --lun 1 -b /dev/hdb1
Allow all iSCSI Initiators to connect to the newly created Target
# tgtadm --lld iscsi --op bind --mode target --tid 1 -I ALL
Verify your Configuration
# tgtadm --lld iscsi --op show --mode target
Target 1: iqn.2001-04.com.mydomain:storage.disk1
System information:
Driver: iscsi
State: ready
I_T nexus information:
LUN information:
LUN: 0
Type: controller
SCSI ID: deadbeaf1:0
SCSI SN: beaf10
Size: 0 MB
Online: Yes
Removable media: No
Backing store: No backing store
LUN: 1
Type: disk
SCSI ID: deadbeaf1:1
SCSI SN: beaf11
Size: 2509 MB
Online: Yes
Removable media: No
Backing store: /dev/hdb1
Account information:
ACL information:


请注意,此配置是不是永久性的,tgtd是重新启动或重新启动服务器时,将丢失。

此外,没有用户/密码是需要与此配置。




赞(0)    操作        顶端 
总帖数
1
每页帖数
101/1页1
返回列表
发新帖子
请输入验证码: 点击刷新验证码
您需要登录后才可以回帖 登录 | 注册
技术讨论