2/26/2015

The slab consolidation / trim operation cannot be performed because the volume alignment is invalid

I recently had an interesting issue running diskdefrag on SQL 2012 R2.  When I ran a defrag analysis (defrag L: -a -v), the result was as follows:

The slab consolidation / trim operation cannot be performed because the volume alignment is invalid.

Searching the internet for answers only yielded recommendations to contact NetApp about OptimalUnmapGranularity.

This particular configuration was with clustered drives on Windows 2012 R2 with a NetApp back-end.  The disks are thin-provisioned.

Unsatisfied with the recommendation to contact NetApp I dug a bit further.  Testing defrag analysis with DiskKeeper 12 was successful.

Long story short I discovered and tried running the Power Shell Optimize-Volume Cmdlet:

Optimize-Volume -DriveLetter L -Analyze -Defrag -Verbose

This worked without issue.

I still have some digging to do on why defrag fails but Optimize-Volume is successful, but at least if you need to run defrag analysis and are getting the slab consolidation error, you can successfully work around this with the Optimize-Volume Cmdlet.

Happy Defrag's!

P.S.
More info here: