Article
RSS
The Virtual Machine Burden of Backing Up

Having problems backing up virtual machines?  This has been a problem since the beginning.  Luckily, people are flocking to this issue to offer advice, help, and product solutions.  Commercial, open-source, and home brewed scripting solutions are showing up on a somewhat regular basis these days.

Here is another option from Chris Wolf, check out the article on MCPmag, here:

For those of you running Virtual Server 2005, there is no way to back up a hot VM without running a back-up agent inside the VM. However, one alternative that you may consider would be to suspend the VM, back up its related files, and then resume the VM following the completion of the backup. Here’s a VBscript that gets the job done:

Option Explicit
'Declare variables
Dim strVMName, strVMFolder, strToday
Dim strBackupFolder, strBackupFile
Dim strJobName, strDescription, strNTBackupCommand
Dim objVirtualServer, objVirtualMachine, objShell, errBackup

'Load current date (formatted as mm-dd-yyyy)
'into variable strToday
strToday = Month(Date) & "-" & Day(Date) & "-" & Year(Date)

'Define Script Variables
strVMName = "W2K3-DC1"
strVMFolder = """E:\VMs\W2K3-DC1"""
strBackupFolder = "F:\Backup\VMs"
strBackupFile = Chr(34) & strBackupFolder _
   & "\" & strVMName & "_" & strToday _
   & ".bkf" & Chr(34) 'Chr(34) is used to
                      'include a quote in the string
strJobName = Chr(34) & strToday & " Full Backup" & Chr(34)
strDescription = Chr(34) & "Starting " & strToday &Chr(34)
strNTBackupCommand = "ntbackup backup " & _
   strVMFolder & " /J " strJobName & " /D " & _
   strDescription & " /F " & strBackupFile

'Instantiate Virtual Server Object
Set objVirtualServer = _
   CreateObject("VirtualServer.Application")

'Instantiate Virtual Machine Object
Set objVirtualMachine = _
   objVirtualServer.FindVirtualMachine(strVMName)

'Save VM State
objVirtualMachine.Save()

'Instantiate command shell object
Set objShell = WScript.CreateObject("Wscript.shell")

'Use ntbackup.exe to back up saved VM
errBackup = objShell.Run(strNTBackupCommand,1,True)

'Restart VM
objVirtualMachine.Startup()

Note that the script backs up the VM’s files using NTbackup.exe; however, you could modify the script to work with your existing back-up product.

Published Wednesday, February 15, 2006 12:55 PM by
Filed under:
Share this post: del.ici.ousDel.ici.ous Digg ThisDigg Newsvine ThisNewsvine Reddit ThisReddit Slashdot It!Slashdot TechnoratiTechnorati
Comments
There are no comments for this post.
To post a comment, you must be a registered user. Registration is free and easy! Sign up now!
Calendar
<February 2006>
SuMoTuWeThFrSa
2930311234
567891011
12131415161718
19202122232425
2627281234
567891011