Defrag options in Windows Server 2012

command-line-interfacedefragmentationoptionsscheduled-taskwindows-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?

Best 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