SQL Data Migration Between LUNS – Change Cluster LUNS ID’s and Drive Letters


In this specific we could not extend the LUN so we need to migrate data from LUNS, and keep the same ID’s and Drive letters, because SQL Services does not use Drive letter’s, instead use the LUNS ID. we have a Two node Windows 2003 Cluster and Two SQL 2005 Instances.

Note: Before starting this procedure don’t forget to backup all the registry, in case of failure is one of the best and fastest way to Roll back the operation. See in this link how to backup registry keys. http://windows.microsoft.com/en-US/windows-vista/Back-up-the-registry.

 

To execute this procedure we will need Cluster Server Recovery Utility to migrate LUN’s ID’s.

Can be downloaded here http://www.microsoft.com/download/en/details.aspx?id=10047.

we also will need ROBOCOPY tool to copy data between LUNS.,

Can be downloaded here http://www.microsoft.com/download/en/details.aspx?id=17657 .

Step 1 – We need to fail-over all the resources to the Node A, and stop all the SQL and MSDTC resources in cluster. and pause Nod B. Don’t forget that there are some resources that must be available, such as, (“Cluster IP” and “Cluster Name”).

Step 2 –Now we can present LUN only to active node. In my case hall the connectivity to storage and “Multipath Software”, are ok.

a) Initialize LUN, using Disk Management.

b) Format LUN, and assign drive letter, use Diskpart tool.

From command line run:

Diskpart
list disk
select disk <DiskNumber>
create partition primary align=<Offset_in_KB>
assign letter=<DriveLetter>
format fs=ntfs unit=64K label="<label>" nowait

Check this http://msdn.microsoft.com/en-us/library/dd758814.aspx, about  Disk Partition Alignment Best Practices for SQL Server.

Check this http://technet.microsoft.com/en-us/library/cc766465%28v=ws.10%29.aspx, about Diskpart tool options.

Step 3 –Now we are going to copy the data between LUNS using ROBOCOPY

example: ROBOCOPY [drive-origem] [drive-destino] *.* /E  /COPYALL  /V  /TS  /FP  /ETA  /TEE  /LOG:C:\DRIVE-X.TXT

You can read more about Robocopy Syntax here http://technet.microsoft.com/en-us/library/cc733145%28v=ws.10%29.aspx

Step 4 – There are some files that are in use such as “System Drive Information” and “Recycler”, this errors can be ignored or use /xf parameter in robocopy to exclude files (/xf <FileName>[ …]).

Step 5 – The data is copyed to the destination LUN so we can present it to the node B.

Use Diskpart to rescan Disks.

Step 6 – Add disk Resource to cluster. I normally create a group ‘Maintenance group’  to test fail-overs when new Disk Resources are added to cluster.

Add the new Disk as an cluster resource and test fail-overs, to ensure that everything is ok, after finishing all the tests that you pretend to do take resource off-line and move it to the final group where LUN will be used.

I also in this process add another txt file to old and new Disk and name it ‘old_disk.txt’ and ‘new_Disk.txt’, to ensure that we know every time witch disk we are working on.

I will use cluster command line tool ,

example: c:\>Cluster . res “Disk X:” /create /group:”Disk Group 1″ /type:”physical disk”

You can read more about adding disk resources to cluster here http://support.microsoft.com/kb/555312/en-us

Step 6 – In this point is important that you have Node A and Node B active and on-line.

Step 7 – Now we are ready to change Disk Id’s between LUNS, and to proceed we will use Cluster Recovery Tool

In the cluster Recovery GUI choose drives that you want to change and press OK in the end.

Step 8 – Delete old resource disk from cluster, that appears like Disk-X (lost), if the drive was X:\.

Step 9- Remove Drive Letters from the old Disk, use disk management or diskpart tool.

Step 9- Bring on-line the new disk resource in the cluster, and assign the drive letter you want to the LUN, use disk management or diskpart tool.

Step 10 – In both Nodes run in the command line this:

MSDTC -resetlog

Step 11 – All the resources still are in the same Node, so you must reboot both Nodes, start from Node B that has any resources on-line and after that node be on-line, fail-over all resources from node A to B, and reboot node A.

In this point the process was finished and you can remove all LUNS that are not needed to the Hosts A and B. I normally wait a few days to execute this procedure.

Note: Before starting this procedure don’t forget to backup all the registry, in case of failure is one of the best and fastest way to Roll back the operation. See in this link how to backup registry keys. http://windows.microsoft.com/en-US/windows-vista/Back-up-the-registry

Just to finish I would like To say thank you to Rui Abel, that Helped me with this process at the first time I’ve executed it.

Hope that this information be useful to your work.

Advertisements

About rodvars
Been working in IT Services/Consulting for the past 15 years. My main areas of work are planning, development, managing and administration System infrastructures focusing on optimizing user processes, enforcing business security, performance enhancements, high availabilty and infrastucture scalability.

One Response to SQL Data Migration Between LUNS – Change Cluster LUNS ID’s and Drive Letters

  1. JOHN MILLER says:

    Thank for the post, you saved my day…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: