Microsoft Team Foundation Server (SqlExpress) — How to ensure that the data is being saved on my standard HDD instead of my SSD? [closed]

StackOverflow https://stackoverflow.com/questions/8995788

Question

Basically, I installed Microsoft Visual Studio and Team Foundation Server with the default settings. It's blazing fast, which probably means that it is reading/writing from my SSD. I'd actually like to get it to work from my standard Hard Drive to avoid burning through my SSD too quickly... how would one go about this?

I should note that my SSD is my C: drive and my standard HDD is my H: (data) drive. TFS/SqlServer/VS2010 were all installed in the standard Program Files location (which reside on my SSD).

Was it helpful?

Solution

Yes, when you accept the defaults and let the TFS configuration wizard install SQL Express for you, it will place the data files in C:\Program Files\Microsoft SQL Server.

To move the data files to another location, you need to stop TFS, detach the database files, move them to a new location and then reattach them and start TFS.

To stop TFS, follow these instructions:

  1. Open a command prompt as an administrator
  2. Type: CD \Program Files\Microsoft Team Foundation Server 2010\Tools
  3. Type: TFSServiceControl quiesce

If you have installed SQL Management Studio separately, you should be able to connect to (LOCAL)\SQLExpress and perform the following steps through the UI.

However, if you don't have SQL Management Studio then you need to use the command line tools to move the SQL data files to a new location, follow these instructions:

Open a command prompt as an administrator

Run: sqlcmd -E -S (LOCAL)\SQLExpress

Once connected, detach the database by running the following commands:

use master
go
sp_detach_db 'Tfs_Configuration'
go
sp_detach_db 'Tfs_DefaultCollection'
go

Copy (or move) the data files and the log files from the current location (typically, C:\Program Files\Microsoft SQL Server\MSSQL\DATA) to the new location (H:\SQLDATA).

Re-attach the database to point to the server to the data/log files in the new location by running the following commands:

use master
go
sp_attach_db 'Tfs_Configuraiton','H:\SQLDATA\Tfs_Configuration.mdf','H:\SQLDATA\Tfs_Configuration.ldf'
go 
sp_attach_db 'Tfs_DefaultCollection','H:\SQLDATA\Tfs_DefaultCollection.mdf','H:\SQLDATA\Tfs_DefaultCollection.ldf'
go 

Then start TFS again by running: TFSServiceControl unquiesce

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top