SQL SERVER – Steps to Migrate Clustered Disk / LUN

During my last engagement with a client, I was asked to provide steps to move SQL databases from H drive to J drive. H drive contains all user and system databases. This was a clustered instance, so we need to take care of dependency also. Here are the steps which I have outlined for Migrate Clustered Disk.

SQL SERVER - Steps to Migrate Clustered Disk / LUN roundups-800x454

  1. ALTER ALL databases except master to change the drive letter to J: drive. We used the following commands to change system database metadata before taking the SQL resource offline:

TempDB

USE master;
GO
ALTER DATABASE tempdb MODIFY FILE (
	NAME = tempdev
	,FILENAME = N'J:\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\tempdb.mdf'
	)
GO
ALTER DATABASE tempdb MODIFY FILE (
	NAME = templog
	,FILENAME = N'J:\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\templog.ldf'
	)
GO

                Model

ALTER DATABASE model MODIFY FILE (
	NAME = modeldev
	,FILENAME = N'J:\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\model.mdf'
	)
GO
ALTER DATABASE model MODIFY FILE (
	NAME = modellog
	,FILENAME = N'J:\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\modellog.ldf'
	)
GO

MSDB

ALTER DATABASE msdb MODIFY FILE (
	NAME = msdbdata
	,FILENAME = N'J:\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\msdbdata.mdf'
	)
GO
ALTER DATABASE msdb MODIFY FILE (
	NAME = msdblog
	,FILENAME = N'J:\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\msdblog.ldf'
	)
  1. Same thing is needed for ALL user databases. We have not put the command because they would vary based on your server setting.
  2. Update at this registry key on both the nodes: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server find all references to H: and change it to J:
  3. Startup parameters to be updated from SQL Server Configuration manager to reflect the new path. This is where we need to change path for MASTER database files.
  4. Shut SQL Server down by taking it offline, but leave the clustered disk resources online.
  5. Copy everything exactly from Old disk(s) H drive to New Disk(s) J drive.
  6. Change the SQL Server group dependencies, so that the SQL Server service is dependent on each disk resource.
  7. Take the old disks out of the resource group.
  8. Bring SQL resource online.

Test failover and fallback! Migrate Clustered Disk

If you think something is missing, please comment!

Reference: Pinal Dave (https://blog.sqlauthority.com), YouTube

SQL Scripts, SQL Server
Previous Post
SQL SERVER – Understanding FAILOVERCLUSTERROLLOWNERSHIP with SQL Server Cluster Rolling Upgrade
Next Post
SQL SERVER – Handling XML Documents – Notes from the Field #125

Related Posts

2 Comments. Leave new

  • wow! I was just going to do something like this, great timing ;)

    Reply
  • Great, I have one more solution for the same and it might be simple one ,Instead of copying all the Data,

    Following is the step
    1) Offline the sql server service
    2) Change the Drive letter from H to xxx
    3) and change the drive letter for J drive to H letter
    4) Bring the sql service up .

    All this will help without moving the data and also making change in registry is sometime more complicated ,might crash the system also

    What you says?

    Reply

Leave a Reply