A quick note about Defrag.exe parameters in Windows Vista

A customer in the public Windows Vista newsgroups recently asked us about the –i and –w parameters in the command-line tool Defrag.exe. Georgi Matev provided some helpful answers below:

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.

Although it is documented, I thought I’d use this post to clarify the meaning of the -w option. Without the -w option, defrag will perform partial defragmentation, which means that it will only try to coalesce file fragments smaller that 64 MB. Further coalescing of these extents is expensive both in terms of defragmentation time and free space requirements, while the performance benefit is small. At 64 MB, the additional seek time associated with reading 2 disjoint fragments of this size is negligible compared to the rotational latency to actually read the contiguous portions of the extents. The -w option allows you to bypass the partial defragmentation behavior and try to defragment all extents regardless of size.