In Windows Server 2012 R2 I used the standard dfrgui.exe
to turn the scheduled optimization on. After several months I looked at the Defrag UI again and noticed that drives were never optimized since I left the machine unattended. After I performed the optimization manually, last run time was updated.
I decided to look at the scheduler task that is responsible for the optimization and found that triggers for this task weren’t set at all. Ok, I added trigger manually. Optimization should start at 03:00 every Wednesday … but drives weren’t optimized.
When I attempted to start Defrag UI again, it reported me, that some other software set optimization parameters and Defrag UI cannot be run (what for a nonsense!). Otherwise I could agree that Defrag UI resets the scheduler task to the original (not working) state and then I will be allowed to see Defrag UI (what for nonsense again!).
So, I found out that with the standard routines I will never be able to organize scheduled defragmentation, so I created my own task, 1:1 as the original task, but with my custom triggers. This time I had a scheduled task and no interference with Defrag UI. But drives still weren’t optimized!
Then I looked at command line used to run the optimization. It was:
%windir%system32defrag.exe -c -h -k -g -$
When I ran this command line from console window, defrag.exe displayed its banner and exited immediately, without optimizing anything!
After some experimenting I found out, that it never optimizes, when any of the keys -k
or -g
is in the command line. So, the final command line that actually did optimize my HDDs is
%windir%system32defrag.exe -c -h -$
but SSD wasn’t trimmed. It is shown as “20 days since last run”.
Now I have several questions:
- How to get SSD trimmed on a scheduled basis?
- what do the keys
-k
or-g
actually do? Is it Ok to run without these keys?
- /G Optimize the storage tiers on the specified volumes.
- /K Perform slab consolidation on the specified volumes.
Ok, I can read the help, but what are “storage tiers” and “slab”?