C drive is a system drive and it shouldn’t be used for any storage of data. Even more, you can achieve up to 30% better operations with the MS SQL server when the database and its log are on separate physical drives or virtual disks.
Let’s start the optimization process.
Preparation of migration
We can’t choose the location of WSUS database during the installation. The default location is C:\Windows\WID\Data. The good news is that we can change this location later.
You will find here two files – SUSDB.mdf and SUSDB_log.ldf. Don’t be confused, I already moved them on my screenshot.
I prepared the new folders on the different virtual disks for both the database and log file. Again, this screenshot is made after moving the database files.
Here is the special trick. There is a special account named NT Service\MSSQL$MICROSOFT##WID that must have the read and write permissions over the WSUS database.
I needed to manually add this account on the Security tab for both folders. I used the following procedure:
- I clicked on [ Edit… ]
- I clicked on [ Add… ]
- In the new window, I checked that I’m working with the local server users
- In the large text box I typed this account name
- I pressed [ OK ] (The new account appeared in the list without the part NT Service\)
- I assigned the write permission to this account and kept only the read permission
My new folders are ready.
The last step is to install MS SQL Management Studio. You may download it here. We need it to manage the WSUS database.
Moving the files
Before I explain this process, I need to warn you. I performed this process as I think it is safe. It will alter the system configuration and may have a serious impact on the further operations of your equipment. Therefore, if you proceed with the below steps you must accept all responsibility for any consequences; this author cannot be held accountable for any negative impacts.
I stopped the WSUS server using services.msc.
As the next step, I opened MS SQL Management Studio. I needed to connect to WSUS database and here is the mighty trick – the server name is \.\pipe\MICROSOFT##WID\tsql\query.
I expanded the Databases branch and found the WSUS database – SUSDB.
I detached this database (right-clicked on the name > Tasks > Detach…). It took a shorter time for SQL to finish the job.
I minimized SQL Studio and then I raised the Explorer window. I made an archive file on the original location, then moved both mdf and lfd files to the new destinations.
When Windows Explorer finished operations, I minimized it again and again opened SQL Studio. The next step was to attach the database (right-clicked on Databases > Attach… > found the database (mdf) file > edited the path for the log file).
Checking the results
I picked again the Services GUI console and started the WSUS service.
I opened the WSUS console, connected to the server and waited for contents.
I started the synchronization process and it worked fine.
This operation had an additional effect on the server – it became faster in response and consumed fewer resources.
Additionally, as you could already see in the second screenshot, I later optimized the entire SCCM server. I’ve moved all SQL databases to these drives, but this is just part of the story which I will reveal to you in another article.