系统环境:RHEL6.0
Server: 192.168.0.218
# rpm -qa |grep scsi
scsi-target-utils-1.0.4-3.el6.x86_64
# /etc/init.d/tgtd start
# tgtadm --lld iscsi --op new --mode target --tid 1 -T iqn.2011.10.com.example:lv0
# tgtadm --lld iscsi --op new --mode logicalunit --tid 1 --lun 1 -b /dev/vol0/lv0
# tgtadm --lld iscsi --op bind --mode target --tid 1 -I ALL
# tgt-admin -s
# netstat -antulp |grep 3260
tcp 0 0 0.0.0.0:3260 0.0.0.0:* LISTEN 17229/tgtd
tcp 0 0 :::3260 :::* LISTEN 17229/tgtd
这样的话,我们就已经做好了一个简单的iscsi服务器了,但是重启会失效的,我们可以把这些命令写到/etc/rc.local 里,或者给/etc/tgt/targets.conf加入如下内容:
backing-store /dev/vol0/lv0
initiator-address 192.168.0.126 //访问控制
client: 192.168.0.126
# rpm -qa |grep iscsi
iscsi-initiator-utils-6.2.0.872-10.el6.x86_64
# iscsiadm -m discovery -t st -p 192.168.0.218
192.168.0.218:3260,1 iqn.2011.10.com.example:lv0
scsiadm -m node -l
Logging in to [iface: default, target: iqn.2011.10.com.example:lv0, portal: 192.168.0.218,3260]
Login to [iface: default, target: iqn.2011.10.com.example:lv0, portal: 192.168.0.218,3260] successful.
# ll /dev/sda
brw-rw----. 1 root disk 8, 0 Oct 19 15:15 /dev/sda
# fdisk -cu /dev/sda //分一个区,过程略
然后就可以格式化挂载了!
阅读(1441) | 评论(0) | 转发(0) |