iscsi命令

来源:互联网 发布:软件外包开发规范 编辑:程序博客网 时间:2024/05/04 00:03

iscsi客户端命令  iscsiadm

1.发现target设备

iscsiadm -m discovery -t sendtargets -p 10.12.22.61


疑问:10.12.22.60:3260,1   1表示什么意思(表示portal group tag,参考补充资料1),此外,为什么连同ip为60的信息也查找出来

在另外存储平台,使用115及116ip,但是discovery116的targets信息,没有出来115的targets信息。(难道跟链路聚合\multipath有关

2.连接target设备

注意:当一个target上有多个lun时,链接target设备会将所有的lun都映射过来

如:(加载了lun1以及lun2)


3。查看连接会话


4.断开连接




target端命令

采用iet管理,配置文件 /etc/ietd.conf  ,参考 http://blog.csdn.net/cybertan/article/details/8949453


1。添加一个新的target

ietadm --op new --tid=[id] --params Name=iqn.foo.example

id为数字,必须为没有使用过。name需要自己定义,保证唯一。

2.添加一个新的lun,在一个已经存在的 target 上加入一个lun,以便共享出来给外界。

ietadm --op new --tid=[id] --lun=[lun] --params Path=/path/exported/file,Type=fileio

 [id] 必须是一个已经存在的tid 号,[lun]可以自己定义,path是共享路径

NOTE通过这种方式添加的LUN在重启服务之后会丢失。

3.停止某个target的某个connection连接

ietadm --op delete --tid=2 --sid=562950876233792 --cid=1 && ietadm --op delete --tid=2


4.停止所有target连接

ietadm --op delete

5.删除某个target(已经没有session)连接

ietadm --op delete --tid=1

6.查看当前已定义target lun 清单

cat /proc/net/iet/volume

tid:3 name:iqn.2010-10.org.openstack:volume-6ded8670-265e-4ad2-9a8d-e4e2c6f833fa
    lun:0 state:0 iotype:fileio iomode:wt blocks:2097152 blocksize:512 path:/dev/cinder-volumes/volume-6ded8670-265e-4ad2-9a8d-e4e2c6f833fa
tid:2 name:iqn.2010-10.org.openstack:volume-6bbe9d89-24ca-4ff7-9672-d0de43f04d3f
    lun:0 state:0 iotype:fileio iomode:wt blocks:2097152 blocksize:512 path:/dev/cinder-volumes/volume-6bbe9d89-24ca-4ff7-9672-d0de43f04d3f
tid:1 name:iqn.2010-10.org.openstack:volume-ce33b16d-92cb-4f6b-b558-054743753b44
    lun:0 state:0 iotype:fileio iomode:wt blocks:2097152 blocksize:512 path:/dev/cinder-volumes/volume-ce33b16d-92cb-4f6b-b558-054743753b44

7.查看当前服务器iscsi target服务以及连接状态命令

cat /proc/net/iet/sessions

tid:2 name:200M.img

        sid:562950876233792 initiator:iqn.1991-05.com.microsoft:admin-pc

                cid:1 ip:192.168.1.240 state:active hd:none dd:none

        sid:281475899523136 initiator:jacko

                cid:1 ip:192.168.1.60 state:active hd:none dd:none

tid:1 name:windows.iso

8.重启服务

service iscsitarget restart


补充资料

1.iscsi initiator and target configuration

http://www.freebsd.org/doc/handbook/network-iscsi.html

2.rfc

http://tools.ietf.org/html/rfc3720

原创粉丝点击