Even though virtual machines reside on Hyper-V servers, System Center Virtual Machine Manager makes use of a SQL Server database that contains all of the configuration data used by Virtual Machine Manager. This SQL Server database can be backed up by using the SQL Server Management Studio or by using any backup application that supports SQL Server backup. It is also possible, however, to back up the server by using tools that are native to System Center Virtual Machine Manager. You would only do this if you didn't have a backup solution in place, or if you needed to do a quick export of the configuration data.
Before I show you how to back up System Center Virtual Machine Manager, I need to point out that these backup techniques cannot be used to write a backup to a root directory because of software limitations. Furthermore, the service account under which SQL Server is running must have read/write access to the backup directory.
Performing a manual backup
There are two main techniques for backing up System Center Virtual Machine Manager. The first of these techniques involves performing a manual backup through the administrative console. To do so, switch to Administration view and click the Back Up Virtual Machine Manager link, found in the Actions pane, as shown in the figure below (click on image for full size). After doing so, you will be prompted to enter a backup path, as shown in Figure 2. Simply enter a non-root path that your SQL Server has access to and the server will be backed up.
Scripted backup
The other technique that you can use to back up your Virtual Machine Manager server is to use a PowerShell script. The advantage of using a PowerShell script is that scripts can be automated and set to run at specific dates and times. To do so, you will have to enter two separate commands. These commands can be entered manually, or you can save them to a text file with a PS1 extension so they can be used as a PowerShell script. The commands that you will have to use are Virtual Machine Manager-specific, so you will have to load the Virtual Machine Manager extensions for PowerShell.
The easiest way to do this is to click the Start button and choose the All Programs | Microsoft System Center | Virtual Machine Manager 2008 | Windows PowerShell – Virtual Machine Manager commands from the Start menu.
The commands used for backing up the server are:
$VMMServer = Get-VMMServer –ComputerName "<Your server's FQDN>"
Backup-VMMServer –Path "C:\VMMBackups" –VMMServer $VMMServer
You can see how these commands work in Figure 3 below.
If you choose to turn these commands into a PowerShell script, then it's important to remember Windows blocks PowerShell scripts from running. You can enable PowerShell scripts by setting the server's execution policy to Unrestricted. To do so, enter the following command:
Set-ExecutionPolicy Unrestricted
Restoring the Virtual Machine Manager Database
Microsoft provides a command line utility in System Center Virtual Machine Manager 2008 R2 that can be used to restore the database (this utility does not exist in the 2008 version). You would normally only do this if you needed to rebuild the server after a database crash or a hard disk failure. Assuming that you are restoring the database to the same server on which the backup was made, you will have to do a bit of housekeeping before performing the restoration. Essentially you will have to revert the server to its previous state this means that you must:
- Remove any hosts that were created since the backup was made.
- Add back any hosts that have been removed since the backup was created.
- Remove any virtual machines that were removed since the backup was created
To restore the backup, follow these steps:
- Open a command prompt window
- Go to: C:\Program Files\Microsoft System Center Virtual Machine Manager 2008 R2\bin
- Enter: SCVMRecover –Path <backup location> -Confirm
No comments:
Post a Comment