Defrag on SSD: The volume System Reserved was not optimized because an error was encountered: The parameter is incorrect. (0x80070057) - Event ID 257

Found old KB2929874 but newer is probably installed with defragsvc.dll 6.3.9600.17238. Error is reported every time Defrag runs. Disk is Samsung SSD 840 EVO 120GB. System Reserved is 350MB created during original system install. It is reported Healthy. System is 8.1 Pro 64-bit, retail. 

Details:

- <Event xmlns="...Microsoft com...">
- <System>
  <Provider Name="Microsoft-Windows-Defrag" />
  <EventID Qualifiers="32768">257</EventID>
  <Level>2</Level>
  <Task>0</Task>
  <Keywords>0x80000000000000</Keywords>
  <TimeCreated SystemTime="2015-01-05T15:39:21.000000000Z" />
  <EventRecordID>38171</EventRecordID>
  <Channel>Application</Channel>
  <Computer>xxxxxxxx</Computer>
  <Security />
  </System>
- <EventData>
  <Data>System Reserved</Data>
  <Data>The parameter is incorrect. (0x80070057)</Data>
  <Binary>00000000A40500005105000000000000629468641336AAB85B55B1B5B038000000000000</Binary>
  </EventData>
  </Event>

January 5th, 2015 5:31pm

Hi,

We don't recommend run defragmentation on SSD, I suggest you exclude SSD from the maintance:

Open the disk optimizer:

  1.        Press "Change Settings".
  2.        Press "Choose" and remove checkboxes from SSD volumes.

Free Windows Admin Tool Kit Click here and download it now
January 6th, 2015 6:14am

Found old KB2929874 but newer is probably installed with defragsvc.dll 6.3.9600.17238. Error is reported every time Defrag runs. Disk is Samsung SSD 840 EVO 120GB. System Reserved is 350MB created during original system install. It is reported Healthy. System is 8.1 Pro 64-bit, retail. 

Details:

- <EventData>
  <Data>System Reserved</Data>

It's reporting that it couldn't TRIM/RETRIM (defrag/optimize) the MSR partition. The MSR partition (almost) never changes, so, who cares ?
January 6th, 2015 7:54am

We don't recommend run defragmentation on SSD, I suggest you exclude SSD from the maintenance:

Actually, I think that's not at all accurate to say this. MSFT specifically built-in Optimizer to perform specific tasks on SSDs, and disabling that is *not* recommended at all.

Included in this blog article are some comments directly attributed to the Windows storage team, which explain what goes on and why :
http://www.hanselman.com/blog/TheRealAndCompleteStoryDoesWindowsDefragmentYourSSD.aspx

Free Windows Admin Tool Kit Click here and download it now
January 6th, 2015 7:57am

In meantime I found the reason and work around. The reason is bug in scheduled task to defrag:
<Arguments>\\?\Volume{ec14a649-2efa-11e3-be66-806e6f6e6963}\ -e -h -o -$</Arguments>
Idea here was to use option o that does the TRIM on SSD and defrag on HD. But the bug is option -$ unknown to defrag. It cannot be corrected because some maintenance finds modification and will restore -$. The right solution would be for Microsoft to correct the bug. But it is more than a year since others reported this bug and Microsoft chose to ignore it. Work around recommended by others, it wouldn't allow me to insert a link here but it is on outsidethebox pages article why-windows-8-defragments-your-ssd-and-how-you-can-avoid-this, is to exclude SSD from this defrag and create another one for SSD drives with corrected argument and using SSD specific option:
<Arguments>C: -l -h</Arguments> 

January 6th, 2015 4:18pm

Please see defrag schedule task and its options in Argument section. Here is the meaning of -o:

/O      Perform the proper optimization for each media type.

 
Free Windows Admin Tool Kit Click here and download it now
January 6th, 2015 8:47pm

After additional research I found the following:
1.Defrag.exe is no longer a defragger, it is a disk optimizer.
2.SSD usually needs defragging once a month and TRIM once a week.
3.For the same reason plus recoverability, System Reserved is also recommended to be optimized. 
4.-$ is possibly not the source of the error message. Here is the result of <Command> and <Arguments> extracted from maintenance task without -$ but with verbose (additional spaces inserted between \ to avoid link restriction of the editor):
  defrag \ \ ?\ Volume{ec14a648-2efa-11e3-be66-806e6f6e6963}\ \ \ ?\ Volume{ec14a649-2efa-11e3-be66-806e6f6e6963}\ -l -h -v
  Microsoft Drive Optimizer
  Copyright (c) 2013 Microsoft Corp.
  Invoking retrim on System Reserved...
  The parameter is incorrect. (0x80070057)
  Invoking retrim on (C:)...
  The operation completed successfully.
  Post Defragmentation Report: 
      Volume Information:
       Volume size                 = 111.44 GB
       Cluster size                = 4 KB
       Used space                  = 75.01 GB
       Free space                  = 36.42 GB

      Retrim:
       Backed allocations          = 111
       Allocations trimmed         = 470
       Total space trimmed         = 35.80 GB
Notice that volumes references are exactly the same. The long volume key defines C: and System Reserved in Registry. Parameter error is still reported for System Reserved but all is fine for C: drive. C: partition and System Reserved are on the same SSD device. I dont know what causes the error message. Maybe it is this UNC reference \ \ ? \... that I completely dont understand?

 
January 8th, 2015 10:35pm

More...

As far as I can tell running Defrag on System Reserved for the first time when Optimize Status is Never with general option -o will always end with an error "The parameter is incorrect". After forcing first time defrag (<vol> is a key from HKLM\SYSTEM\mountedDevices):

defrag <vol> -l -h -$

result is without any error and any consecutive defrag is also successful.

 Arguments in scheduler <Arguments>-c -h -o -$</Arguments> will thus generate parameter error on never optimized System Reserved but will be correct on optimized System Reserved. In this case none of the SSD volumes will be touched by defrag. It looks like -o option excludes SSD volumes even help says it suppose to do a proper optimization for each media type. Only -l option does retrim on SSD. Two mysteries remain: the -$ option and order of exclude option -e in scheduler. According to defrag help volume list suppose to follow -e but after excluding some volumes from processing scheduler generated argument is in reversed order. -$ is not documented. It seems to be needed for the first time optimization. Parameter error is generated without it. Later it is ignored. Unfortunately I did not save output from experimenting with -$ and -e and Im not 100% sure. I don't have luxury to reinstall the system and repeat all exercises. There is definitely a missmatch between defrag and schedule XML.  

Free Windows Admin Tool Kit Click here and download it now
January 9th, 2015 8:11pm

Hi Michael,

Apologize for the delay, We did numerous researches these days. but haven't found an effective solution for this issue. So far, I recommend you use command defrag <vol> -l  to separatly retrim SSD for optimization as an workaround, I will report this issue to our develop team, I will inform you if I get any resposes or any new information.

Thanks for your support.

Regards

January 16th, 2015 6:20am

This is broken at a more fundamental level.  Doing the command natively doesn't work either.

Here is an extract done via PowerShell (in Admin mode). I gave "System Reserved" a drive letter, B:, so that the PS commands could be entered.  I added bold for emphasis.

Note the following:

  1. The "System Reserved" volume is assigned B:
  2. It is properly noted as being on an SSD drive under Media Type on the Optimize Drives window.
  3. the defrag command /A is Analysis, which says B doesn't need optimization
  4. the defrag command /O is to use the appropriate optimization. This fails with the familiar "parameter is incorrect. (0x80070057)" error.  The other switches don't matter; same result.

So messing with Tasks and Scheduler isn't going to do a thing when the defrag shell command itself is BROKEN! with regard to the special case of the "System Reserved" volume.

By the way, why is there no longer a check box by each drive in the Optimize Drive window?  If that was still there, or there was another way to disable Optimize from considering "System Reserved" then I would cheerfully do that.  The contents of that volume NEVER change, so why should it even be on the list?  Or I guess I could spend half a day getting rid of the "System Reserved" volume altogether [it is a KLUDGE after all], but that is a lot of risky process for dealing with a Microsoft programming error.

Here is the PowerShell log:

  • PS C:\Windows\system32> get-volume

    DriveLetter       FileSystemLabel  FileSystem       DriveType        HealthStatus        SizeRemaining             Size
    -----------       ---------------  ----------       ---------        ------------        -------------             ----
    B                 System Reserved  NTFS             Fixed            Healthy                  90.48 MB           350 MB
    D                 HPsaR1-1T-Data   NTFS             Fixed            Healthy                 329.62 GB        931.48 GB
    O                 HPsaR5-1T-O      NTFS             Fixed            Healthy                 931.28 GB        931.48 GB
    P                 HPsaR5-1T-Q      NTFS             Fixed            Healthy                 246.94 GB        931.48 GB
    Q                 HPsaR5-1T-Q      NTFS             Fixed            Healthy                 725.85 GB        931.36 GB
    R                 HP3T-1T-R        NTFS             Fixed            Healthy                 858.02 GB        931.48 GB
    S                 HP3T-1T-S        NTFS             Fixed            Healthy                 430.97 GB        931.48 GB
    T                 HP3T-1T-T        NTFS             Fixed            Healthy                 255.65 GB        931.43 GB
    E                 WD2T Passport    NTFS             Fixed            Healthy                  57.18 GB          1.82 TB
    C                 CruM4-500-C      NTFS             Fixed            Healthy                 275.78 GB         476.6 GB
    H                                                   Removable        Healthy                       0 B              0 B
    I                                                   Removable        Healthy                       0 B              0 B
    J                                                   Removable        Healthy                       0 B              0 B
    K                                                   Removable        Healthy                       0 B              0 B
    F                                                   CD-ROM           Healthy                       0 B              0 B

  • PS C:\Windows\system32> defrag b: /a
    Microsoft Drive Optimizer
    Copyright (c) 2013 Microsoft Corp.

    Invoking analysis on System Reserved (B:)...


    The operation completed successfully.

    Post Defragmentation Report:

            Volume Information:
                    Volume size                 = 349.99 MB
                    Free space                  = 94.48 MB
                    Total fragmented space      = 0%
                    Largest free space size     = 45.08 MB

            Note: File fragments larger than 64MB are not included in the fragmentation statistics.

            You do not need to defragment this volume.


  • PS C:\Windows\system32> defrag b: /o /u /v
    Microsoft Drive Optimizer
    Copyright (c) 2013 Microsoft Corp.

    Invoking retrim on System Reserved (B:)...


    Performing pass 1:
            Retrim:  0% complete...
    The parameter is incorrect. (0x80070057)

  • PS C:\Windows\system32>
Free Windows Admin Tool Kit Click here and download it now
January 25th, 2015 11:42pm

I just saw this:

http://answers.microsoft.com/en-us/windows/forum/windows_8-performance/optimize-drives-the-parameter-is-incorrect/4d4360e7-37a8-4811-aefd-3d1e8a23b261

which linked too this:

http://superuser.com/questions/699480/defragmentation-error-the-volume-c-was-not-optimized/736338?noredirect=1#736338

June 10th, 2015 9:08am

The link goes to a KB article which when requested and ran, states that it is not applicable (Windows 8.1 and Windows Server 2012 R2). 

We are still having the same problem on our servers when it comes to defragmenting the system reserved partition. I've removed it from the schedule for the time being.

Free Windows Admin Tool Kit Click here and download it now
August 17th, 2015 8:37am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics