Tech Line
Deep Freezing Virtual Server VMs
Scripting simplifies legacy VM backups.
In the coming weeks, MCPmag.com
will give your most challenging
Windows, Exchange and general networking questions to our esteemed contributing
IT experts-in-residence. Here's contributing writer Chris Wolf, once again
with a question on backing up virtual machines:
Chris: I'm thinking of consolidating two MS-DOS servers
to a single Windows 2003 server running Microsoft Virtual Server 2005.
Are there any good scripting solutions that would allow me to back up
all of the VMs on the server in one operation?
— Anonymous
Tech Help—Just An
E-Mail Away |
Got a Windows, Exchange or virtualization question
or need troubleshooting help? Or maybe you want a better
explanation than provided in the manuals? Describe
your dilemma in an e-mail to the MCPmag.com editors
at mailto:[email protected];
the best questions get answered in this column; MCPmag.com
baseball caps go to the published submitter.
When you send your questions, please include your
full first and last name, location, certifications (if
any) with your message. (If you prefer to remain anonymous,
specify this in your message but submit the requested
information for verification purposes.)
|
|
|
Anonymous: Whenever I hear of MS-DOS, I almost always find
myself clicking the remote to turn on my HDTV to make sure I'm still in
2005. Perhaps when you migrate your MS-DOS systems to VMs, you can get
someone to do some carbon dating on your old DOS server hardware to determine
its original age.
All kidding aside, your problem is not that uncommon. In the past two
years, I've run into three other organizations that have had to keep MS-DOS
boxes around in order to support a needed application that is not compatible
with any other operating system. In these situations, migrating the DOS
systems to VMs is a logical choice.
For backups, both Microsoft and VMware recommend running back-up agent
software on your virtual machines to reliably back them up. Hot backup
of virtual machine virtual disk files from the host system is not supported
because some VM write operations wind up in physical memory before making
their way to the virtual disk file. So even if you could back up a virtual
disk file by using an open file manager, it may be corrupted and thus
not worth restoring.
If you want to run a single back-up job from the host that allows all
VMs to be backed up in one operation, you can suspend all VMs on the host
prior to the backup, and then resume the VMs once the backup completes.
Of course, this can cause the VMs to be temporarily unavailable while
the backup runs, but I think that this won't be much of a problem in your
situation. I'm assuming that your DOS application is not mission-critical
and thus you can suspend your server VMs at 3 a.m. in order to back them
up from the host.
Virtual Server 2005 offers a feature that allows for VMs to be automatically
suspended, known as save state, when the Virtual Server service
is stopped. So, to solve your back-up dilemma, you'll first need to configure
each VM to automatically save its state when the Virtual Server service
stops. These settings are configured on the VM's General Properties page
in the Virtual Server Management Web UI.
From the General Properties page of the VM you want to back up, you'll
need to click the "Run the Virtual Machine Under the Following User
Account" checkbox. Then enter a user name and password of an account
with Administrative rights under which to start the virtual machine. In
the "Action When Virtual Server Starts" menu, select "Always
Automatically Turn on Virtual Machine." In the "Action When
Virtual Server Stops" menu, select Save State.
With these settings configured, your VMs will automatically pause and
save their state when the Virtual Server service stops, and will then
automatically start when the Virtual Server service restarts. Now to back
up the VMs, you need to follow these three general steps:
- Stop the Virtual Server service
- Back up the VM files
- Start the Virtual Server service
Here's a batch file that uses ntbackup.exe to back up the VMs:
@echo off
:: Set Variables
set VMRootFolder= E:\VMs
set Today=%Date:~4,2%-%Date:~7,2%-%Date:~10,4%
set BackupFolder=\\Redmond-FS2\Backups\VMs
set BackupFile=%BackupFolder%\%Today%.bkf
set JobName=%Today% Full Backup
set Description=Starting %Today%
:: Stop Virtual Server Service - Saves state of all VMs
net stop "Virtual Server"
:: Back up VMs
ntbackup backup "%VMRootFolder%" /J "%JobName%" _
/D "%Description%" /F "%BackupFile%"
:: Start Virtual Server Service - Resumes all saved
VMs
net start "Virtual Server"
Note that if you're running enterprise back-up software, you could run
the "net stop" command as a pre-backup script and then run the
net start command as a post-backup script. This allows all of the VMs
to be successfully backed up when the host system is backed up by your
backup software.
Like the great Han Solo, your VMs will become frozen in time, only to
live again!
[Chris Wolf has just released Virtualization:
From the Desktop to the Enterprise (Apress) and welcomes your virtualization
questions for this column. —Editors]