SystemWindows Server

Event 257 Defrag Slab Consolidation Not Optimized

Following the installation of a new Veeam One platform on a Windows 2012 R2 server (now migrated to W2019), I encountered an issue with the deduplication and defragmentation of a partition on the HDD. An “Event 257 Slab Consolidation Not Optimized” appeared.

The volume (C:) was not optimized because an error was encountered: Neither Slab Consolidation nor Slab Analysis will run if slabs are less than 8 MB. (0x8900002D)

As a symptom, I found this message on Microsoft Support: “When you run the Disk Defragmenter utility (Defrag.exe) on a volume on a computer running Windows 8.1 or Windows Server 2012 R2, the defragmentation operation fails. In addition, event ID 257 is recorded in the application log. This event displays an error message “The setting is incorrect.”

Possible cause of Event 257 Defrag Slab Consolidation Not Optimized

There are several possible causes of the problem. But what we do know is that the problem occurs when defragmenting VM files, whether in Hyper-V or Netapp.

  • What is your file system? NTFS, REFS? or Mon?
  • the storage is shared ?
  • Is it a RAID disk? (in my case yes)
  • Are the disks SATA or is there SSD?
  • As a reminder, SSDs don’t really like defragmentation

Using the Defrag.exe program or the ScheduledDefrag task we get this error message Event 257 Slab Consolidation Not Optimized. A first solution is to modify the task.

By default, if we go to the windows task explorer we call %windir%\system32\defrag.exe -c -h -k -g -$

event ID 257 defrag.exe -c -h -k -g -$

1: How to resolve Event ID 257 Slab Consolidation Not Optimized

As in the previous picture, the first solution is to modify the task in the task scheduler.

  • search for the ScheduledDefrag task in Microsoft –> Windows –> Defrag
  • Right click and select “property”.
  • Go to the “Action” tab
  • Select the action and make it modify
  • Remove the -k
  • Save and run the task

The -k means “Perform section consolidation on specified volumes”. Here are all the options of the defrag.exe application (from microsoft)

/aPerform an analysis on the specified volumes.
/CPerform the operation on all volumes.
/dPerform traditional defragmentation (this is the default). On a tiered volume, however, traditional defragmentation is performed only on the capacity level.
/ePerform the operation on all volumes except those specified.
/gOptimize storage levels on specified volumes.
/hPerform the operation with normal priority (the default value is Low).
/i [n]The level optimization would run for at most n seconds on each volume.
/kPerform section consolidation on the specified volumes.
/lMake a readjustment on the specified volumes.
/m [n]Run the operation on each volume in parallel in the background. At most n threads optimize the storage levels in parallel.
/oPerform the appropriate optimization for each media type.
/tFollows up an operation already in progress on the specified volume.
/UPrint the progress of the operation on the screen.
/vDisplay the detailed output containing fragmentation statistics.
/xPerform a free space consolidation on the specified volumes.
/?Displays this help information.
Source : Microsoft Defrag

Now, either there are two cases, you have no more error messages and everything is ok, or you get a new error message “The volume (C:) was not optimized because an error was encountered: The operation requested is not supported by the hardware backing the volume (0x8900002A)”. In this case, I invite you to go to solution number 2. This is the most efficient one, thanks to powershell

2 : Powershell Defrag Optimize Volume

If the first solution to defragment and optimize your disk, especially for deduplication, did not work, you can switch to this much more efficient solution.

  • Open a powershell console as administrator
  • enter “Optimize-Volume -DriveLetter C -Defrag -Verbose

Normally, you should have solved your problem. If not, I invite you to leave a comment, I will answer it by trying to reproduce your system error. Also check this post on Microsoft Technet


Specialist in datacenter, powershell, virtualization, content creation and SEO is the founder of PeopleAreGeek. Passionate about video games when he was young, he was then taken by technology and knowledge sharing.

Leave a Reply

Your email address will not be published. Required fields are marked *