Windows NT/2000/XP/2003/2008 PageWindows Server 2003のページ > EQUALLOGICのスナップショットのバックアップ
EQUALLOGICのスナップショットのバックアップ


EQUALLOGICのスナップショットをスクリプトを使用して自動でドライブに割り当て、 NTBACKUPやバックアップソフトのオプションを使わずに、自動でバックアップする方法です。

環境

イコールロジックのボリュームは、それぞれのサーバーにvol01、vol02が割り当ててあります。
スナップショットのtarget名は、vol01-日付、vol02-日付になっています。
スナップショットは、Auto-Snapshot Managerで作成し、オンラインに設定しています。

diskpartで、iSCSIのボリューム番号が実行するたびに変わる場合は下記の情報を参照してHotFixを入手してください。
The Diskpart.exe tool returns error code 4 on a Windows Server 2003 Service Pack 2-based computer that has a DVD-ROM drive or a CD-ROM drive installed

注)このページは書き掛けです。内容は変更になる場合があります。

プレコマンド(バックアップ前に実行)
・マウントの確認をするためにメールを送付するようになっています。
<?XML version="1.0" encoding="shift_jis" ?> <package> <job id="iSCSI"> <comment> iSCSI Mount </comment> <script language="VBScript"> <![CDATA[ main() Function main() ' ***** 初期設定 ***** Dim b_Month,b_Day,b_Year,b_Date Dim WSHShell,bobj,oMsg ' ***** 設定 ***** set WSHShell = WScript.CreateObject("WScript.Shell") Set Fs = WScript.CreateObject("Scripting.FileSystemObject") Set oMsg = WScript.CreateObject("CDO.Message") iscsi_info = "" iscsiList = Array(Array("vol01-","Z"),Array("vol02-","Y")) ' ***** 日付曜日の取得 ***** b_Month = Right("00" & Month(Date),2) b_Day = Right("00" & Day(Date),2) b_Year = Year(Date) today = b_Year & "-" & b_Month & "-" & b_Day iscsi_path = "c:\windows\system32\" exec_cmd = iscsi_path & "iscsicli.exe ListTargets T" set rc = WSHShell.Exec(exec_cmd) iscsi_target = rc.Stdout.ReadAll iscsi_info = iscsi_info & iscsi_target for j = 0 to UBound(iscsiList) split_iscsi_target = split(iscsi_target,vbCrLf) for i = 0 to UBound(split_iscsi_target) - 1 if Instr(split_iscsi_target(i),iscsiList(j)(0) & today) > 0 then exec_cmd = iscsi_path & "iscsicli LoginTarget" _ & split_iscsi_target(i) & " T * * * * * 0x02 * * * * * * * * * 0" set rc = WSHShell.Exec(exec_cmd) iscsi_target_vol1 = rc.stdout.ReadAll end if next exec_cmd = iscsi_path & "iscsicli SessionList" set rc = WSHShell.Exec(exec_cmd) Target_flag = 0 Disk_flag = 0 Do Until rc.stdout.AtEndOfStream strLine = rc.stdout.ReadLine if (Instr(strLine,"Target Name") > 0) and (Instr(strLine,iscsiList(j)(0)) > 0) and (Target_flag = 0) then Target_flag = 1 end if if (Instr(strLine,"Device Number") > 0) and (Target_flag = 1) and (Disk_flag = 0) then Disk_flag = 1 Disk_number = Replace(strLine," Device Number :","") sc_line = "select disk " & Disk_number & vbCrLf sc_line = sc_line & "detail disk" & vbCrLf sc_line = sc_line & "exit" &vbCrLf set FS_text = FS.CreateTextFile(iscsiList(j)(0) & "d1.txt") FS_text.write sc_line exit Do end if if (Instr(strLine,"Volume Path Names") > 0) and (Target_flag = 1) and (Disk_flag = 0) then Target_flag = 0 end if Loop exec_cmd = iscsi_path & "diskpart /s c:\at\" & iscsiList(j)(0) & "d1.txt" set rc = WSHShell.Exec(exec_cmd) Do while rc.Status = 0 WScript.Sleep 10 Loop Diskpart_flag = 0 Do Until rc.stdout.AtEndOfStream strLine = rc.stdout.ReadLine if (Instr(strLine,"NTFS") > 0) and (Diskpart_flag = 0) then DiskPart = 1 dp_split = Split(trim(strLine)," ") Volume_number = dp_split(1) sc_line = "select disk " & Disk_number & vbCrLf sc_line = sc_line & "detail disk" & vbCrLf sc_line = sc_line & "select volume " & Volume_number & vbCrLf sc_line = sc_line & "assign letter=" & iscsiList(j)(1) & vbCrLf sc_line = sc_line & "exit" &vbCrLf set FS_text = FS.CreateTextFile(iscsiList(j)(0) & "assign.txt") FS_text.write sc_line FS_text.close sc_line = "select volume " & Volume_number & vbCrLf sc_line = sc_line & "remove letter=" & iscsiList(j)(1) & vbCrLf sc_line = sc_line & "select disk " & Disk_number & vbCrLf sc_line = sc_line & "detail disk" & vbCrLf sc_line = sc_line & "exit" &vbCrLf set FS_text = FS.CreateTextFile(iscsiList(j)(0) & "delete.txt") FS_text.write sc_line FS_text.close exit Do end if Loop exec_cmd = iscsi_path & "diskpart /s c:\at\" & iscsiList(j)(0) & "assign.txt" set rc = WSHShell.Exec(exec_cmd) Do while rc.Status = 0 WScript.Sleep 10 Loop iscsi_info = iscsi_info & rc.stdout.ReadAll next oMsg.From = "okushima.yoshimichi@tycoelectronics.com" oMsg.To = "okushima.yoshimichi@tycoelectronics.com" oMsg.Subject = "iSCSI Mount(" & Today & ")" mailbody = iscsi_info & vbCrLf oMsg.TextBody = mailbody oMsg.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 oMsg.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "temailhost.tycoelectronics.net" oMsg.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 oMsg.Configuration.Fields.Update oMsg.Send End Function ]]> </script> </job> </package>
ポストコマンド(バックアップ後に実行)
<?XML version="1.0" encoding="shift_jis" ?> <package> <job id="iSCSI Dismount"> <comment> iSCSI Dismount </comment> <script language="VBScript"> <![CDATA[ main() Function main() ' ***** 初期設定 ***** Dim b_Month,b_Day,b_Year,b_Date Dim WSHShell,bobj,oMSG ' ***** 設定 ***** set WSHShell = WScript.CreateObject("WScript.Shell") Set Fs = Wscript.CreateObject("Scripting.FileSystemObject") Set oMsg = WScript.CreateObject("CDO.Message") iscsi_info = "" iscsiList = Array(Array("vol01-","Z"),Array("vol02-","Y")) ' ***** 日付曜日の取得 ***** b_Month = Right("00" & Month(Date),2) b_Day = Right("00" & Day(Date),2) b_Year = Year(Date) today = b_Year & "-" & b_Month & "-" & b_Day iscsi_path = "c:\windows\system32\" ' ***** ドライブマップ削除 ***** for j = 0 to UBound(iscsiList) exec_cmd = iscsi_path & "diskpart /s c:\at\" & iscsiList(j)(0) & "delete.txt" set rc = WSHShell.Exec(exec_cmd) Do while rc.Status = 0 WScript.Sleep 10 Loop iscsi_info = iscsi_info & rc.stdout.ReadAll next ' ***** iSCSIセッションIDを取得してTargetをLogOff***** exec_cmd = iscsi_path & "iscsicli SessionList" set rc = WSHShell.Exec(exec_cmd) Do Until rc.stdout.AtEndOfStream strLine = rc.stdout.ReadLine if Instr(strLine,"Session Id") > 0 then SessionID = Replace(strLine,"Session Id : ","") iscsi_Session = iscsi_Session & SessionID strLine = rc.stdout.ReadLine Do Until Instr(strLine,"Target Name") > 0 strLine = rc.stdout.ReadLine Loop if (Instr(strLine,"vol01") > 0) or (Instr(strLine,"vol02") > 0) then exec_cmd = iscsi_path & "iscsicli LogoutTarget " & SessionID set rc_end = WSHShell.Exec(exec_cmd) iscsi_logout = iscsi_logout & rc_end.stdout.ReadAll end if end if Loop oMsg.From = "okushima.yoshimichi@tycoelectronics.com" oMsg.To = "okushima.yoshimichi@tycoelectronics.com" oMsg.Subject = "iSCSI Unmount(" & Today & ")" mailbody = iscsi_info & vbCrLf mailbody = mailbody & iscsi_Session & vbCrLf mailbody = mailbody & iscsi_logout & vbCrLf oMsg.TextBody = mailbody oMsg.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 oMsg.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "temailhost.tycoelectronics.net" oMsg.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 oMsg.Configuration.Fields.Update oMsg.Send End Function ]]> </script> </job> </package>
関連記事
Equallogicのシャットダウン

FreeのiSCSI Targetソフトウェア

iscsicli.exe の使い方

EqulLogicに関する記述です。