当前位置:DOS资源站资料中心批处理教程 → StarWind虚拟磁盘批处理配置代码

StarWind虚拟磁盘批处理配置代码

减小字体 增大字体 作者:佚名  来源:本站整理  发布时间:2008-5-12 15:55:41

首先我的starwind是装在e:\\starwind下面的,

安装完以后先用第一个批处理生成IMG文件,

第一个批处理:

xcopy E:\\StarWind\\mksparse.exe c:\\windows\\system32

xcopy E:\\StarWind\\IBVolumeCtl.exe c:\\windows\\system32

mksparse -o E:\\game.img 1G

再用第二个批处理文件生成IBV文件

第二个批处理:

md D:\\WORK
start /w IBVolumectl image D:\\WORK\\B1.ibv 0 . E:\\game.img
start /w IBVolumectl image D:\\WORK\\B2.ibv 0 . E:\\game.img
start /w IBVolumectl image D:\\WORK\\B3.ibv 0 . E:\\game.img
start /w IBVolumectl image D:\\WORK\\B4.ibv 0 . E:\\game.img
start /w IBVolumectl image D:\\WORK\\B5.ibv 0 . E:\\game.img
start /w IBVolumectl image D:\\WORK\\B6.ibv 0 . E:\\game.img
start /w IBVolumectl image D:\\WORK\\B7.ibv 0 . E:\\game.img

。。。。。。。

如果你的game.img文件是80G的话,,大概可以建150个左右的IBV联接的,

第三个批处理,就是如果你要往IMG文件里面添加游戏或者更新游戏的时候用的,

第三个批处理:

::说明,starwind装在E:\\starwind下面,
::E:\\下面建一个game.img
::d:\\work下面建ibv文件
:: -_-

net stop "starwind iscsi service"                                 
::生成conf文件
echo [parameters] >e:\\starwind\\starwind.conf
echo LogLevel = "1"               >>e:\\starwind\\starwind.conf
echo LogMask = "0x8fffffff"               >>e:\\starwind\\starwind.conf
echo Port = "3260"               >>e:\\starwind\\starwind.conf
echo Interface = "192.168.0.21"               >>e:\\starwind\\starwind.conf
echo DefTargetName = "iqn.2003-06.com.rocketdivision.starwind:$(host).$(symid)"               >>e:\\starwind\\starwind.conf
echo Login = "test"               >>e:\\starwind\\starwind.conf
echo Password = "##CY9rzUYh03PK3k6DJie09g=="               >>e:\\starwind\\starwind.conf
echo Echo = "no"               >>e:\\starwind\\starwind.conf
echo MinBufferSize = "65536"               >>e:\\starwind\\starwind.conf
echo AlignmentMask = "0x0000"               >>e:\\starwind\\starwind.conf
echo MaxPendingRequests = "64"               >>e:\\starwind\\starwind.conf
echo   [plugins]               >>e:\\starwind\\starwind.conf
echo addplugin -module:"ImageFile.dll" -symlink:"ImageFile" -type:"Image file" -imagedir:"*|cmdfv|My Computer|img,dat" -volumes:"no"               >>e:\\starwind\\starwind.conf
echo [devices]               >>e:\\starwind\\starwind.conf
echo add "ImageFile0" "game" -file:"My Computer\\e\\game.IMG" -asyncmode:"yes" -clustered:"yes" -readonly:"no"               >>e:\\starwind\\starwind.conf
echo [permissions]               >>e:\\starwind\\starwind.conf

net start "starwind iscsi service"  
start /w e:\\starwind\\starwind.exe

运行这个批处理后,就直接打开starwind了,你再点starwind里面的localhost右键,点connect

test的密码也是test,这样服务端就准备好了,可以往IMG里面添加游戏或者以后更新游戏也是这样子准备。

再把ISCSI的客户端装好,客户端也可以在另外一台机器上面装的,联接上服务器上的game

这时候,客户机上还不会出盘的,打开客户机上的磁盘管理,出来一个安装框,点取消,在新出的那个盘(上面有红色的警告的左面那一部份)点右键,点签名,再点右面那一部份,格式化、把盘符啊什么的都设好,这样子就新出一个盘了,接下来就跟你本地磁盘一样的操作了,把游戏啊什么的往里面加吧,

第四个批处理就是starwind服务端联上IBV文件准好游戏的,

第四个批处理:

::说明,starwind装在E:\\starwind下面,
::E:\\下面建一个game.img
::d:\\work下面建ibv文件
::-_-
net stop "starwind iscsi service"                               
::生成conf文件
echo [parameters] >e:\\starwind\\starwind.conf
echo LogLevel = "1"               >>e:\\starwind\\starwind.conf
echo LogMask = "0x8fffffff"               >>e:\\starwind\\starwind.conf
echo Port = "3260"               >>e:\\starwind\\starwind.conf
echo Interface = "192.168.0.21"               >>e:\\starwind\\starwind.conf
echo DefTargetName = "iqn.2003-06.com.rocketdivision.starwind:$(host).$(symid)"               >>e:\\starwind\\starwind.conf
echo Login = "test"               >>e:\\starwind\\starwind.conf
echo Password = "##CY9rzUYh03PK3k6DJie09g=="               >>e:\\starwind\\starwind.conf
echo Echo = "no"               >>e:\\starwind\\starwind.conf
echo MinBufferSize = "65536"               >>e:\\starwind\\starwind.conf
echo AlignmentMask = "0x0000"               >>e:\\starwind\\starwind.conf
echo MaxPendingRequests = "64"               >>e:\\starwind\\starwind.conf
echo   [plugins]               >>e:\\starwind\\starwind.conf
echo addplugin -module:"IBVolume.dll" -symlink:"IBV" -type:"IBV" -imagedir:"*|cdfmv|My Computer|ibv" -imagedir:"*|v|Readonly ImageFiles|img,dat"           >>e:\\starwind\\starwind.conf
echo   [devices]           >>e:\\starwind\\starwind.conf
echo add "IBV1" "B1" -file:"My Computer\\d\\work\\B1.ibv" -mode:"3" -clustered:"no"           >>e:\\starwind\\starwind.conf
echo add "IBV2" "B2" -file:"My Computer\\d\\work\\B2.ibv" -mode:"3" -clustered:"no"           >>e:\\starwind\\starwind.conf
echo add "IBV3" "B3" -file:"My Computer\\d\\work\\B3.ibv" -mode:"3" -clustered:"no"           >>e:\\starwind\\starwind.conf
echo add "IBV4" "B4" -file:"My Computer\\d\\work\\B4.ibv" -mode:"3" -clustered:"no"           >>e:\\starwind\\starwind.conf
echo add "IBV5" "B5" -file:"My Computer\\d\\work\\B5.ibv" -mode:"3" -clustered:"no"           >>e:\\starwind\\starwind.conf
echo add "IBV6" "B6" -file:"My Computer\\d\\work\\B6.ibv" -mode:"3" -clustered:"no"           >>e:\\starwind\\starwind.conf
echo add "IBV7" "B7" -file:"My Computer\\d\\work\\B7.ibv" -mode:"3" -clustered:"no"           >>e:\\starwind\\starwind.conf
echo add "IBV8" "B8" -file:"My Computer\\d\\work\\B8.ibv" -mode:"3" -clustered:"no"           >>e:\\starwind\\starwind.conf
echo add "IBV9" "B9" -file:"My Computer\\d\\work\\B9.ibv" -mode:"3" -clustered:"no"           >>e:\\starwind\\starwind.conf
echo add "IBV10" "C1" -file:"My Computer\\d\\work\\C1.ibv" -mode:"3" -clustered:"no"           >>e:\\starwind\\starwind.conf
echo add "IBV11" "C2" -file:"My Computer\\d\\work\\C2.ibv" -mode:"3" -clustered:"no"           >>e:\\starwind\\starwind.conf
echo add "IBV12" "C3" -file:"My Computer\\d\\work\\C3.ibv" -mode:"3" -clustered:"no"           >>e:\\starwind\\starwind.conf
echo add "IBV13" "C4" -file:"My Computer\\d\\work\\C4.ibv" -mode:"3" -clustered:"no"           >>e:\\starwind\\starwind.conf
echo add "IBV14" "C5" -file:"My Computer\\d\\work\\C5.ibv" -mode:"3" -clustered:"no"           >>e:\\starwind\\starwind.conf
echo add "IBV15" "C6" -file:"My Computer\\d\\work\\C6.ibv" -mode:"3" -clustered:"no"           >>e:\\starwind\\starwind.conf
echo add "IBV16" "C7" -file:"My Computer\\d\\work\\C7.ibv" -mode:"3" -clustered:"no"           >>e:\\starwind\\starwind.conf
echo add "IBV17" "C8" -file:"My Computer\\d\\work\\C8.ibv" -mode:"3" -clustered:"no"           >>e:\\starwind\\starwind.conf
echo add "IBV18" "C9" -file:"My Computer\\d\\work\\C9.ibv" -mode:"3" -clustered:"no"           >>e:\\starwind\\starwind.conf
echo add "IBV19" "F1" -file:"My Computer\\d\\work\\F1.ibv" -mode:"3" -clustered:"no"           >>e:\\starwind\\starwind.conf
echo add "IBV20" "F2" -file:"My Computer\\d\\work\\F2.ibv" -mode:"3" -clustered:"no"           >>e:\\starwind\\starwind.conf
echo add "IBV21" "F3" -file:"My Computer\\d\\work\\F3.ibv" -mode:"3" -clustered:"no"           >>e:\\starwind\\starwind.conf
echo add "IBV22" "F4" -file:"My Computer\\d\\work\\F4.ibv" -mode:"3" -clustered:"no"           >>e:\\starwind\\starwind.conf
echo add "IBV23" "F5" -file:"My Computer\\d\\work\\F5.ibv" -mode:"3" -clustered:"no"           >>e:\\starwind\\starwind.conf
echo add "IBV24" "F6" -file:"My Computer\\d\\work\\F6.ibv" -mode:"3" -clustered:"no"           >>e:\\starwind\\starwind.conf
echo add "IBV25" "F7" -file:"My Computer\\d\\work\\F7.ibv" -mode:"3" -clustered:"no"           >>e:\\starwind\\starwind.conf
echo add "IBV26" "F8" -file:"My Computer\\d\\work\\F8.ibv" -mode:"3" -clustered:"no"           >>e:\\starwind\\starwind.conf
echo add "IBV27" "F9" -file:"My Computer\\d\\work\\F9.ibv" -mode:"3" -clustered:"no"           >>e:\\starwind\\starwind.conf
echo add "IBV28" "N1" -file:"My Computer\\d\\work\\N1.ibv" -mode:"3" -clustered:"no"           >>e:\\starwind\\starwind.conf
echo add "IBV29" "N2" -file:"My Computer\\d\\work\\N2.ibv" -mode:"3" -clustered:"no"           >>e:\\starwind\\starwind.conf
echo add "IBV30" "N3" -file:"My Computer\\d\\work\\N3.ibv" -mode:"3" -clustered:"no"           >>e:\\starwind\\starwind.conf
echo add "IBV31" "N4" -file:"My Computer\\d\\work\\N4.ibv" -mode:"3" -clustered:"no"           >>e:\\starwind\\starwind.conf
echo add "IBV32" "N5" -file:"My Computer\\d\\work\\N5.ibv" -mode:"3" -clustered:"no"           >>e:\\starwind\\starwind.conf
echo add "IBV33" "N6" -file:"My Computer\\d\\work\\N6.ibv" -mode:"3" -clustered:"no"           >>e:\\starwind\\starwind.conf
echo add "IBV34" "N7" -file:"My Computer\\d\\work\\N7.ibv" -mode:"3" -clustered:"no"           >>e:\\starwind\\starwind.conf
echo add "IBV35" "N8" -file:"My Computer\\d\\work\\N8.ibv" -mode:"3" -clustered:"no"           >>e:\\starwind\\starwind.conf
echo add "IBV36" "N9" -file:"My Computer\\d\\work\\N9.ibv" -mode:"3" -clustered:"no"           >>e:\\starwind\\starwind.conf
echo add "IBV37" "W2K1" -file:"My Computer\\d\\work\\W2K1.ibv" -mode:"3" -clustered:"no"           >>e:\\starwind\\starwind.conf
echo add "IBV38" "W2K2" -file:"My Computer\\d\\work\\W2K2.ibv" -mode:"3" -clustered:"no"           >>e:\\starwind\\starwind.conf
echo add "IBV39" "W2K3" -file:"My Computer\\d\\work\\W2K3.ibv" -mode:"3" -clustered:"no"           >>e:\\starwind\\starwind.conf
echo add "IBV40" "W2K4" -file:"My Computer\\d\\work\\W2K4.ibv" -mode:"3" -clustered:"no"           >>e:\\starwind\\starwind.conf
echo add "IBV41" "W2K5" -file:"My Computer\\d\\work\\W2K5.ibv" -mode:"3" -clustered:"no"           >>e:\\starwind\\starwind.conf
echo add "IBV42" "W2K6" -file:"My Computer\\d\\work\\W2K6.ibv" -mode:"3" -clustered:"no"           >>e:\\starwind\\starwind.conf
echo add "IBV43" "W2K7" -file:"My Computer\\d\\work\\W2K7.ibv" -mode:"3" -clustered:"no"           >>e:\\starwind\\starwind.conf
echo add "IBV44" "W2K8" -file:"My Computer\\d\\work\\W2K8.ibv" -mode:"3" -clustered:"no"           >>e:\\starwind\\starwind.conf
echo add "IBV45" "W2K9" -file:"My Computer\\d\\work\\W2K9.ibv" -mode:"3" -clustered:"no"           >>e:\\starwind\\starwind.conf
echo add "IBV46" "W2K10" -file:"My Computer\\d\\work\\W2K10.ibv" -mode:"3" -clustered:"no"           >>e:\\starwind\\starwind.conf
echo [permissions]           >>e:\\starwind\\starwind.conf
net start "starwind iscsi service"  
start /w e:\\starwind\\starwind.exe

再输入test,你就会看到你starwind窗口里面已经有了很多的ibv连接了,再到别的客户机上装上客户端,分别连服务器上的

B1、B2、B3..............一一对应,连接上后,客户机上就直接出盘了,IMG里面有的,都能玩了,

OK就这个样子,但愿能帮到你们。

有什么问题,可以问,要是我看到了,一定回答,不过,我声明,我是个菜菜,别打击我,我就万分感谢了。

客户端动态连接脚本:

if not exist %windir%\system32\iscsiexe.exe goto exit
if exist c:\iscsiok.txt goto loadiscsi
net start "Microsoft iSCSI Initiator Service"
ipconfig|find /i "194.168.0"
if not errorlevel 1 goto Net194
iscsicli AddTargetPortal 192.168.0.148 3260
iscsicli LoginTarget %computername% T * * * * * * * * * * * * * * * 0
@echo iscsi is ok>c:\iscsiok.txt
goto loadiscsi
:Net194
iscsicli AddTargetPortal 194.168.0.148 3262
iscsicli LoginTarget %computername% T * * * * * * * * * * * * * * * 0
@echo iscsi is ok>c:\iscsiok.txt
:loadiscsi
if not exist g:\iscsidrvok.txt goto loadiscsi
start \\Server\网络游戏\cmd\shlnk
:exit
exit

客户机关机脚本:关机通知服务器释放资源的作用:

FOR /F "usebackq eol=; tokens=2 delims=:" %%I in (`iscsicli SessionList^|find /i "Session Id"`) do iscsicli LogoutTarget %%I
iscsicli RemoveTarget %computername%
ipconfig|find /i "194.168.0"
if not errorlevel 1 goto Net194
iscsicli RemoveTargetPortal 192.168.0.148 3260
goto exit
:Net194
iscsicli RemoveTargetPortal 194.168.0.148 3262
:exit
exit