SQL: Replacing a drive

Calum Morrison 21 Reputation points
2021-11-12T14:48:54.693+00:00

I have SQL installed on a Hyper-V VM but whoever created it, has made a mess of it. The data drive was originally 250Gb and when the data has outgrown that, rather than increasing the size of the disk, he's added another and spanned the two together to make one larger drive. Within Windows, both drives are set as dynamic and that's what's causing me issues; Veeam backup doesn't seem to like that mode and is unable to back up the VM.

My plan is to:

  1. Stop SQL services.
  2. Create one large drive
  3. Change the letter of the existing drive (S becomes T)
  4. Give the new drive the letter of the existing drive (S)
  5. Restart SQL
  6. Get a backup of the VM with Veeam
  7. Delete the old drive(s)
  8. Pat myself on the back

This seems almost too easy - am I missing something? I'll obviously have a full backup and snapshot/checkpoint to begin with and be doing this out of hours, but is there anything that could cause problems? As far as I can tell (server rather than SQL guy here), everything in SQL is done via drive letter rather than a disk ID so, assuming SQL comes back up and the letter is the same, what can go wrong?

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
14,490 questions
0 comments No comments
{count} votes

Accepted answer
  1. Erland Sommarskog 117.2K Reputation points MVP
    2021-11-12T23:27:16.537+00:00

    You will have to copy the databases to the new drive, but I guess that you have figured that out. But else I think it should work.

    But I would certainly test on a copy of the VM first.

    0 comments No comments

3 additional answers

Sort by: Most helpful
  1. CathyJi-MSFT 22,346 Reputation points Microsoft Vendor
    2021-11-15T02:56:24.307+00:00

    Hi @Calum Morrison ,

    Please make sure that the new files location are same as old. If not, you need to modify the files location information that store in master database. Move the files to the new location and verify the SQL Server service account still has permission to access it.

    There are some notes for moving SQL database files. Suggest you reading below MS document to get detail steps to move SQL server database to another drive.

    Move System Databases
    Move User Databases


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

  2. Calum Morrison 21 Reputation points
    2021-11-15T08:40:47.403+00:00

    Thanks for the responses folks - it's my intention for the new drive to take the name of the existing one so files / databases will be in the "same" location in that respect. I'll read through those guides on moving files first though; all help appreciated!

    0 comments No comments

  3. Calum Morrison 21 Reputation points
    2021-11-17T10:57:59.577+00:00

    Just as an update, I carried this work out per the above plan and it worked perfectly with the only bumps on the way being permissions-based errors: I had to give NT SERVICE\MSSQLSERVER Full Control of the following folders:
    S:\SQL2017\MSSQL14.MSSQLSERVER\MSSQL (to get the SQL services to start)
    C:\Windows\system32\LogFiles\Sum\ (to give SQL server write permissions on Api.chk

    After clearing those up, the server worked perfectly and I am now able to get a full backup using Veeam - the original source of my error as it was having issues with the original spanned disk being dynamic.

    thanks for the help and advice.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.