Moving Databases to New Volume
Here are steps to move databases from one volume to another.
NOTE: These steps assume that you can take the SQL engine offline as needed for this activity.
Moving TempDb
The TempDb database is recreated on service startup.
So, you can simply update its path, and restart SQL Server.
Do this to update the paths for it:
USE master;
GO
ALTER DATABASE tempdb MODIFY FILE ( NAME = tempdev, FILENAME = N'F:\MSSQL\DATA\tempdb.mdf' );
ALTER DATABASE tempdb MODIFY FILE ( NAME = templog, FILENAME = N'F:\MSSQL\DATA\templog.ldf' );
Once that is done, restart the SQL engine service, for the change to take effect.
Once the SQL engine service is restarted, you can verify the tempDb has moved with this:
SELECT name, physical_name FROM sys.master_files WHERE database_id = DB_ID('tempdb');
Moving Model and msdb
These are the master databases for the SQL engine host.
Here are steps to move them.
NOTE: They require a service restart to be moved.
Get their current paths with this:
USE master;
GO
SELECT DB_NAME(database_id) AS DbName, name, physical_name
FROM sys.master_files
WHERE DB_NAME(database_id) IN ('model','msdb');
Update their paths with this:
USE master;
GO
ALTER DATABASE model MODIFY FILE ( NAME = modeldev, FILENAME = N'F:\MSSQL\DATA\model.mdf' );
ALTER DATABASE model MODIFY FILE ( NAME = modellog, FILENAME = N'F:\MSSQL\DATA\modellog.ldf' );
ALTER DATABASE msdb MODIFY FILE ( NAME = MSDBData, FILENAME = N'F:\MSSQL\DATA\MSDBData.mdf' );
ALTER DATABASE msdb MODIFY FILE ( NAME = MSDBLog, FILENAME = N'F:\MSSQL\DATA\MSDBLog.ldf' );