# Defrag options in Windows Server 2012

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? ## 1 Answer 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

• Thanks for the answer. What about my "non-traditional" defrag question? Does that relate to "thin provisioning"? – anon Mar 5 '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 6 '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