Cloning a Team Foundation Server
This weekend we upgraded our production servers running Team Foundation Server (the “Whidbey” release) to the Beta 2 of the Team Foundation Server “Orcas” release.
First, I have to say, the upgrade experience compared to the beta 1 is much, much better. Just run the installer, fill out some account information and wait a while until the upgrade is done.
We encountered no problems during the upgrade, but unfortunately after the upgrade things took a bad turn. The first server we upgraded crashed. The operating system was completely deleted from the hard drive. In turned out that we ran into a nasty bug on TFS “Orcas” that is very hard to run into. My colleague Marcel de Vries wrote a blog post about it. You can read it here.
So with the server gone, we had to install our server from scratch.
To prevent these kind of production problems and because of the need to store our customer code separately from our own codebase, we had already decided to split our big Team Foundation Server in two. To accomplish this, we created a clone of our main Team Foundation server and upgraded the cloned server to the “Orcas” Beta 2 bits. As the server had crashed, we needed to run this process again.
There is a nice guide available from Microsoft to clone a (Whidbey) Team Foundation Server. You can read it here.
There is one imported thing to note when using this guide. This guide is meanly meant to re-install your server after it crashed or for whatever other reason. But it assumes that after (or even during) the cloning process the “source” server is no longer available.
In our case we wanted the “source” server to be up and running next to the newly cloned server. To accomplish this you need to give one of the Team Foundation servers a new instance id. This can be accomplished with the following commands:
“%TFSInstallDir%ToolsInstanceInfo.exe" stamp /setup /install /rollback /d TFSWorkItemTracking,TFSBuild,TFSVersionControl,TFSIntegration /s <<your new data tier>>
"% TFSInstallDir %ToolsInstanceInfo.exe" stamp /d TFSWorkItemTracking,TFSBuild,TFSVersionControl,TFSIntegration /s <<your new data tier>>
The first command is the clear the instance id, the second to stamp a new instance id. After executing these commands you have a newly cloned server side-by-side with the original server.
The cloning process can take up quite some time. It took us about 4 hours to clone the server. This might take less or more time depending on the size of the Team System databases. We have a TfsVersionControl database of over 6 gigabytes and it took about 25 minutes to create a backup of this database and another 25 minutes to restore it.
Because of the server crashes (It crashed twice before we understood what was causing the problem) we cloned our production server three times in the last few days. Since the backup and restore actions for the Team System databases took us so much time, we created a T-SQL script to restore the databases and move them to a new location. You can download the script here. (Note that the location and names of the backup files will be different on your machine.)
Our servers our now al up and running with the Team System “Orcas” Beta 2 bits, thanks to the guys of Microsoft that helped is fix the data that was causing the server crash.
Hope this helps.