Focusing on Application Lifecycle Management

Backing up your TFS virtual server using SCVMM

I have been working with a couple of clients recently who have been running Team Foundation Server as a virtual machine on Microsoft Virtual Server 2005 R2 w/SP1.

Recently I had a client ask me about how to backup the running virtual machine(s) and my most common answer to date is to use a scheduled task to call a vbs script to shutdown the virtual machine, copy the VHD file to an alternate server and the restart the virtual machine. There are several derivatives of this solution including suspending, using differencing disks and more.

Now there's a better answer....

With the recent release of Microsoft System Center Virtual Machine Manager (SCVMM) we have a number of new features that are perfect for the task of backing up the running virtual machines. Firstly, SCVMM includes a Powershell snapin that makes working with Virtual Server 2005 a breeze. It was never what I would call fun in the past trying to use the COM interfaces with VBScript. Secondly, SCVMM includes built-in support for P2V (Physical-to-Virtual) or in our case V2V (Virtual-to-Virtual) duplication of running servers. For the best solution, have Virtual Server 2005 running on a second (backup) server and copy your TFS virtual machine over to the second server. That way if anything catastrophic happens to your primary TFS server, you can just start the backup VM.

V2V_Backup

WOW - Does it get any better than this?

It sure can! The P2V wizard allows you to easily create a job to duplicate the running TFS virtual server. As one of the final steps of the wizard you can choose to show the Powershell script that the wizard generates to achieve the P2V. Simply copy this to a file (.ps1) and you can edit the actions to do a few more important things. In my case, add error handling, gather some performance metrics and include email reporting of the success or failure of the P2V (V2V) job.

Scheduling the V2V backup

Now that we have generated the Powershell script and edited it to add a few more steps, the next step involves creating a new scheduled task to execute the script. The backup task can be done any time as the P2V can occur on a running virtual machine without taking the server offline. It's still a good idea to run the script during a quiet time such as 4am each day.

The command to execute from the scheduled task is;

C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe  -nologo –noninteractive &’C:\PS Scripts\backupTFSVM.ps1’

Test the solution out by manually running the Powershell script and making sure the duplicate appears on your backup Virtual Server.

The bigger picture

The solution outlined above works well where you are using the P2V script to duplicate the TFS virtual server from one host machine to a backup host machine, also running Virtual Server 2005. In the event of a failure of the primary virtual machine or virtual server host, you can simply run up the duplicate copy of the machine and take steps to ensure the original virtual machine does not start up.

A few caveats

  • This solution offered some of my clients a number of benefits specific to their needs. In every occasion, this solution is NOT their primary backup solution.
  • There are existing commercial products on the market that do the things detailed above in a far more sophisticated way, more suited to enterprise customers. (Albeit at a much higher price)
  • The V2V solution can also be easily adapted to allow easy testing of patches and configuration changes using the duplicate to test these in an isolated network.

If you're interested in trying this out yourselves, here are a few links to help you get started.

» Similar Posts

  1. Its time for you to consider replacing SourceSafe
  2. Running VSTS2008SP1 VPC under Windows 7 using Windows Virtual PC
  3. Vista RC2 - mixed experiences

» Trackbacks & Pingbacks

  1. Grant Holliday on TSWA State Diagram Colors. Anthony Borton on Backing up your TFS virtual Server using...

    Team System News — October 29, 2007 6:42 AM

» Comments

  1. P.Sivakumar avatar

    Is it possible to backup TFS using P2V of SCVMM and use it w/o any modifications in another host?

    P.Sivakumar — March 7, 2008 11:59 AM
  2.  avatar

    I have used the P2V feature in SCVM quite a number of times and found it to work generally very well. Using this to create a virtual machine from your physical TFS server shouldn't be a problem at all.

    In answer to the main part of your question... The P2V wizard will make an identical copy. Like any PC though, you canot have two identical machines running at the same time due to name conflicts, address conflicts etc. Remember also that your TFS server will be tied to the original domain so movement is limited without a bit of work on your part.

    Is there a specific scenario you are considering with your question? Let me know and I might offer an alternative solution for you.

    Cheers

    — March 7, 2008 4:22 PM
  3. P.Sivakumar avatar

    Based on SLA levels, I would like to create a P2V copy. This copy will be a periodic snapshot of production. In case of production down sceanario, I would like the virual to play production with minial data loss. So in my case, the production will be down when I need to activate the virtual machine running TFS (Single server Installation)

    P.Sivakumar — March 10, 2008 7:38 AM

Comments are closed