Defrag scheduler entry not enabled by default, and has unknown options -i and -g. best settings for defrag? RRS feed

  • Question

  • So apparently Microsoft provides a pre-made entry in the Task Scheduler for "ScheduledDefrag" on Windows Server 2008 (SBS in my case) but doesn't enable it by default for some strange reason.

    The Defragment Now... option under the Tools tab of the disk properties has an option to schedule a regular defrag, but that appears to setup the scheduled task with parameters -c -i -g. The -c is to defrag all volumes, but the -i and -g are unknown. The available documentation makes no mention of those parameters:

    in fact, when I run defrag /? from the command line, I get:

    C:\Windows\system32>defrag /?
    Description:  Locates and consolidates fragmented files on local volumes to
                  improve system performance.
    Syntax:  defrag <volume> -a [-v]
             defrag <volume> [{-r | -w}] [-f] [-v]
             defrag       -c [{-r | -w}] [-f] [-v]
    Value         Description
    <volume>      Specifies the drive letter or mount point path of the volume to
                  be defragmented or analyzed.
    -c            Defragments all volumes on this computer.
    -a            Performs fragmentation analysis only.
    -r            Performs partial defragmentation (default). Attempts to
                  consolidate only fragments smaller than 64 megabytes (MB).
    -w            Performs full defragmentation. Attempts to consolidate all file
                  fragments, regardless of their size.
    -f            Forces defragmentation of the volume when free space is low.
    -v            Specifies verbose mode. The defragmentation and analysis output
                  is more detailed.
    -?            Displays this help information.
    defrag d:
    defrag d:\vol\mountpoint -w -f
    defrag d: -a -v
    defrag -c -v

    which again, makes no mention of -i and -g.

    And idea what those do? Any advice for better parameters for defrag?

    Tuesday, March 24, 2015 4:50 PM

All replies

  • Hi James,

    The -i option means that unless the machine is idle, defrag.exe will pause.

    For more detailed information, please refer to this article:

    A quick note about Defrag.exe parameters in Windows Vista

    If there is anything else regarding this issue, please feel free to post back.

    Best Regards,

    Anna Wang

    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Support, contact

    Wednesday, March 25, 2015 10:46 AM
  • Thank you Anna,

    So, from your link:
    "The -i option means that unless the machine is idle, defrag.exe will pause. If the machine is idle (no interactive user input) for a few minutes, defrag will continue. The option is not documented since it was added late in the Windows Vista development cycle when resource changes were not possible (otherwise localization will be delayed). The option will be documented in a KB article once Windows Vista is released. On a similar note, the scheduled defrag task is configured to only start when the machine is idle."

    That seems useful.

    I would still love to understand what the -g option does, and even more than that, I'd like to understand why the option to defrag would be disabled by default.

    But most of all, I'd like to understand what else Microsoft didn't turn on that should be. We already know that the WSUS database will grow without bounds and never be cleaned despite there being a cleaner available for it and a pretty easy way to setup an automatic cleaner.

    What about SQL? Or log files? Are there things we should be doing to keep our servers running well?

    Wednesday, March 25, 2015 5:58 PM
  • I've just noticed that the task which is automatically created when you use the GUI tool to schedule defrags has a condition that it will not start the task unless the machine has been idle for 3 minutes... AND it automatically stops the task if the computer stops being idle. (!) So the -i switch is rather useless isn't it? Wouldn't we be better off to setup the task ourselves without that "stop if not idle" switch and then depend on the -i sent to the program to keep it from loading down the server? Anyone have experience with this?
    Wednesday, March 25, 2015 6:54 PM