Windows下如何使用命令行来配置iSCSI连接
来源:互联网 发布:印度理工学院 知乎 编辑:程序博客网 时间:2024/06/08 09:27
以下内容来自"Windows Tips & Tricks UPDATE"邮件列表
Q. How can I use the command line to configure iSCSI connections?
by John Savill
5.16.08
A. I recently had a client who tried to use iSCSI to connect Server Core to SAN storage but couldn't get it to work without the iSCSI Initiator Control Panel applet. You can use the Iscsicli command-line interface to manage iSCSI. The first thing you need to do is enable iSCSI service and set it to start automatically, as you’ll see in the following code and corresponding output. The first command I entered was:
Users\john>sc config msiscsi start= auto
The output was:
[SC] ChangeServiceConfig SUCCESS
Then I entered:
Users\john>net start msiscsi
The output was:
The Microsoft iSCSI Initiator Service service is starting.
The Microsoft iSCSI Initiator Service service was started successfully.
Then, you use the Iscsicli command-line interface to connect to an iSCSI Target and list the available targets. The command I entered was:
Users\john>iscsicli QAddTargetPortal 192.168.1.31
The output was:
Microsoft iSCSI Initiator Version 6.0 Build 6000
The operation completed successfully.
Next I entered:
Users\john>iscsicli ListTargets
The output was:
Microsoft iSCSI Initiator Version 6.0 Build 6000
Targets List:
quorum
data
The operation completed successfully.
You can then connect to a target using the following code as an example:
Users\john>iscsicli qlogintarget data
The output was:
Microsoft iSCSI Initiator Version 6.0 Build 6000
Session Id is 0xfffffa800626e018-0x4000013700000006
Connection Id is 0xfffffa800626e018-0x5
The operation completed successfully.
The following code checked to make sure the operation was successful:
Users\john>iscsicli reporttargetmappings
The output was:
Microsoft iSCSI Initiator Version 6.0 Build 6000
Total of 1 mappings returned
Session Id : fffffa800626e018-4000013700000006
Target Name : data
Initiator : Root\ISCSIPRT\0000_0
Initiator Scsi Device : \\.\Scsi4:
Initiator Bus : 0
Initiator Target Id : 0
Target Lun: 0x0 OS Lun: 0x0
The operation completed successfully.
You log out by using the logouttarget switch with the session ID, as the following sample code shows:
Users\john>iscsicli logouttarget
fffffa800626e018-4000013700000006
The output was:
Microsoft iSCSI Initiator Version 6.0 Build 6000
The operation completed successfully.
To confirm the operation was successful, I entered the following code:
Users\john>iscsicli reporttargetmappings
The output was:
Microsoft iSCSI Initiator Version 6.0 Build 6000
No Mappings
The operation completed successfully.
The mappings obtained through the qlogintarget command aren’t persistent and will be lost at reboot. If you want a persistent connection, use the perssitenlogintarget switch, as the following code shows:
Users\john>iscsicli persistentlogintarget data T * * * * * * * * *
* * * * * * 0
The output was:
Microsoft iSCSI Initiator Version 6.0 Build 6000
The operation completed successfully.
To confirm that the operation was successful, I entered:
Users\john>iscsicli listpersistenttargets
The output was:
Microsoft iSCSI Initiator Version 6.0 Build 6000
Total of 1 peristent targets
Target Name : data
Address and Socket : 192.168.1.31 3260
Session Type : Data
Initiator Name : Root\ISCSIPRT\0000_0
Port Number :
++Security Flags : 0x0
++Version : 0
++Information Specified: 0x20
++Login Flags : 0x8
++Username :
The operation completed successfully.
Entering T * * * * * * * * * * * * * * * 0 specifies all the required switches. To remove a persistent target, apply the information obtained from the listpersistentargets command using the following code as an example:
Users\john>iscsicli removepersistenttarget Root\ISCSIPRT\0000_0
data * 192.168.1.31 3260
The output was:
Microsoft iSCSI Initiator Version 6.0 Build 6000
The operation completed successfully.
To confirm the success of the operation, I entered:
Users\john>iscsicli listpersistenttargets
The output was:
Microsoft iSCSI Initiator Version 6.0 Build 6000
Total of 0 peristent targets
The operation completed successfully.
You'll notice that I passed the initiator name first, then the target name, the port number (which is *), and last of all the iSCSI target server IP address and socket.
Q. How can I use the command line to configure iSCSI connections?
by John Savill
5.16.08
A. I recently had a client who tried to use iSCSI to connect Server Core to SAN storage but couldn't get it to work without the iSCSI Initiator Control Panel applet. You can use the Iscsicli command-line interface to manage iSCSI. The first thing you need to do is enable iSCSI service and set it to start automatically, as you’ll see in the following code and corresponding output. The first command I entered was:
Users\john>sc config msiscsi start= auto
The output was:
[SC] ChangeServiceConfig SUCCESS
Then I entered:
Users\john>net start msiscsi
The output was:
The Microsoft iSCSI Initiator Service service is starting.
The Microsoft iSCSI Initiator Service service was started successfully.
Then, you use the Iscsicli command-line interface to connect to an iSCSI Target and list the available targets. The command I entered was:
Users\john>iscsicli QAddTargetPortal 192.168.1.31
The output was:
Microsoft iSCSI Initiator Version 6.0 Build 6000
The operation completed successfully.
Next I entered:
Users\john>iscsicli ListTargets
The output was:
Microsoft iSCSI Initiator Version 6.0 Build 6000
Targets List:
quorum
data
The operation completed successfully.
You can then connect to a target using the following code as an example:
Users\john>iscsicli qlogintarget data
The output was:
Microsoft iSCSI Initiator Version 6.0 Build 6000
Session Id is 0xfffffa800626e018-0x4000013700000006
Connection Id is 0xfffffa800626e018-0x5
The operation completed successfully.
The following code checked to make sure the operation was successful:
Users\john>iscsicli reporttargetmappings
The output was:
Microsoft iSCSI Initiator Version 6.0 Build 6000
Total of 1 mappings returned
Session Id : fffffa800626e018-4000013700000006
Target Name : data
Initiator : Root\ISCSIPRT\0000_0
Initiator Scsi Device : \\.\Scsi4:
Initiator Bus : 0
Initiator Target Id : 0
Target Lun: 0x0 OS Lun: 0x0
The operation completed successfully.
You log out by using the logouttarget switch with the session ID, as the following sample code shows:
Users\john>iscsicli logouttarget
fffffa800626e018-4000013700000006
The output was:
Microsoft iSCSI Initiator Version 6.0 Build 6000
The operation completed successfully.
To confirm the operation was successful, I entered the following code:
Users\john>iscsicli reporttargetmappings
The output was:
Microsoft iSCSI Initiator Version 6.0 Build 6000
No Mappings
The operation completed successfully.
The mappings obtained through the qlogintarget command aren’t persistent and will be lost at reboot. If you want a persistent connection, use the perssitenlogintarget switch, as the following code shows:
Users\john>iscsicli persistentlogintarget data T * * * * * * * * *
* * * * * * 0
The output was:
Microsoft iSCSI Initiator Version 6.0 Build 6000
The operation completed successfully.
To confirm that the operation was successful, I entered:
Users\john>iscsicli listpersistenttargets
The output was:
Microsoft iSCSI Initiator Version 6.0 Build 6000
Total of 1 peristent targets
Target Name : data
Address and Socket : 192.168.1.31 3260
Session Type : Data
Initiator Name : Root\ISCSIPRT\0000_0
Port Number :
++Security Flags : 0x0
++Version : 0
++Information Specified: 0x20
++Login Flags : 0x8
++Username :
The operation completed successfully.
Entering T * * * * * * * * * * * * * * * 0 specifies all the required switches. To remove a persistent target, apply the information obtained from the listpersistentargets command using the following code as an example:
Users\john>iscsicli removepersistenttarget Root\ISCSIPRT\0000_0
data * 192.168.1.31 3260
The output was:
Microsoft iSCSI Initiator Version 6.0 Build 6000
The operation completed successfully.
To confirm the success of the operation, I entered:
Users\john>iscsicli listpersistenttargets
The output was:
Microsoft iSCSI Initiator Version 6.0 Build 6000
Total of 0 peristent targets
The operation completed successfully.
You'll notice that I passed the initiator name first, then the target name, the port number (which is *), and last of all the iSCSI target server IP address and socket.
- Windows下如何使用命令行来配置iSCSI连接
- 纯命令行配置scst向windows提供iSCSI存储资源
- iscsi使用命令行
- 如何在Windows中通过Cygwin来使用Linux命令行
- Linux下iscsi的配置与使用
- Linux存储实验三:iSCSI target配置[windows下使用linux的存储设备]
- Windows Server8下补丁分发配置与iSCSI配置
- 使用linux连接ISCSI
- 使用命令行方式查看windows下机器的配置
- 如何在windows下像在linux使用命令行
- ubuntu下使用iscsi
- linux下iscsi连接脚本
- ubuntu 下连接iSCSI Volume
- Ubuntu 下连接iSCSI Volume
- Windows命令行下配置Windows XP防火墙
- windows下使用svn命令行
- windows下使用svn命令行
- windows下如何在plsql中配置连接实例
- 调用系统的短信和邮件分享功能
- iOS - webView检测电话和邮箱问题
- C++ Config 配置文件类
- perl读写文件
- 理解offsetparent
- Windows下如何使用命令行来配置iSCSI连接
- Core Data 数据出现Fault
- #pragma comment( lib , "libTest.lib" )的意思
- 螺旋队列
- 常用linux命令
- Android系统添加新的字体
- 我也学别人模拟一下PHP多线程
- spring使用编程式事务
- 暑假开始