If you are using dynamic disks for some reason, and please avoid using them if you don’t have to, the partitions on it are likely to be misaligned for SQL server. I discovered this while trying to configure an AO Availability Group where one of the replicas were using local SSD drives configured with software RAID 1.
Problem
Since this was a new setup for me, I ran the old “wmic partition get BlockSize, StartingOffset, Name, Index” just to make sure everything was in order. To my astonishment, it was not:
For some reason, the partition is using the old Win 2003 31,5 KB offset! To make it worse, I discovered this AFTER I had installed SQL server. Since dynamic disk and software raid basically sucks, information about this on the great interweb was sparse. But after some searching I found a cure, at least for volumes without RAID, at http://blogs.utexas.edu/alex/2013/04/04/windows-aligning-dynamic-disks/. (Link dead as of 2016.10)
Solution
Based on the above mentioned blog post, with my comments and changes for RAID. Be aware, this process may be destructive. This guide assumes that you, as I did, already have an active mirror with the wrong alignment. If you have fresh drives, just ignore the parts about breaking the mirror and moving data.
- Make sure you have a valid backup
- Be prepared to do a clean install if necessary
- Break the mirror
- Give both drives new drive-letters and restart the server to make sure no active application/service is using the drive
- Run diskpart, and select one of the drives that was part of the mirror. If you don’t know how to do this, STOP and ask someone to help you or read up on diskpart BEFORE you continue.
- Execute the following diskpart commands against the selected drive. This guide expects that you want one volume to fill the entire drive. If you don’t want this, think long and hard about why and consider changing your mind.
- clean
- online disk
- attributes disk clear readonly
- convert gpt
- select part 1
- delete part override
- create partition msr size 128
- convert dynamic
- create volume simple align=1024
- Screenshots

- Then, format the new partition with 64K allocation unit size
- Move the data from the other partition that was part of the mirror, and hope this will work
- Run the diskpart commands against the other disk. Be aware, this will delete the data, so make sure the move command was successful. And this time, skip the last create volume command.
- Select second disk
- clean
- online disk
- attributes disk clear readonly
- convert gpt
- select part 1
- delete part override
- create partition msr size 128
- convert dynamic
You should now have two dynamic disks, one with the data and one unallocated. Now, to add the mirror. I discovered that I was unable to add the second drive back as a mirror, the add mirror option was grayed out. I solved this by first shrinking the original by 50MB, and then creating the mirror. I didn’t test this extensively, but I would guess that 5 or 10 megabytes of free space would have been enough.
Last edit: Tuesday, October 25, 2016
Like this:
Like Loading...