8

I am looking at the command line options for defrag.exe as well as the "ScheduledDefrag" task on Windows Server 2012, and I don't understand some of the arguments. In particular, when I view defrag /? I see:

/D      Perform traditional defrag (this is the default).
/L      Perform retrim on the specified volumes.

What would a "non-traditional" defrag consist of? What is a retrim?

Also, under the scheduled task, the command line is

%windir%\system32\defrag.exe -c -h -k -$  

I see that -c means "all volumes," -h means "normal priority," -k means "slab consolidation," and apparently, -$ means "defrag.exe is being called from the task scheduler."

Why is -$ important?

anon
  • 404
  • 1
  • 5
  • 15
  • check following blog for explanation: http://blogs.technet.com/b/askcore/archive/2014/02/17/what-39-s-new-in-defrag-for-windows-server-2012-2012r2.aspx – Christophe Lams Apr 15 '15 at 13:55

1 Answers1

2

Retrim and SlabConsolidate are for thinly provisioned storage volumes.

-ReTrim Generates TRIM and Unmap hints for all currently unused sectors of the volume, notifying the underlying storage that the sectors are no longer needed and can be purged. This can recover unused capacity on thinly provisioned drives.

-SlabConsolidate Indicates that the cmdlet performs slab consolidation on the storage to optimize slab allocations and to reduce the number of used slabs.

I don't know for certain but my guess is the -$ changes the IO priority to run as a back ground process.

Powershell guide for optimising volumes. http://technet.microsoft.com/en-us/library/hh848675.aspx

Sam
  • 617
  • 1
  • 5
  • 14
  • Thanks for the answer. What about my "non-traditional" defrag question? Does that relate to "thin provisioning"? – anon Mar 05 '14 at 14:21
  • I'll be honest, I have not seen the term "non-traditional defrag" in any of the documentation so I do not know. – Sam Mar 06 '14 at 14:22
  • The blog in the answer that is now a comment has the details. – Jim B Jul 21 '15 at 11:43