Use of "defrag" within Windows

  • Article ID: 109226
  • Updated: 11 Feb 2016

This article explains how and why to use "defrag" within Windows. 

Sophos Disk Encryption
SafeGuard Device Encryption

What to do

To prepare a system for a Sophos SafeGuard Disk Encryption installation, we recommend to use the Windows on-board tools "defrag" & "chkdsk" to obtain a clean file system.
A detailed description how to use "chkdsk" can be found in SGI 109277.

The Windows built-in "defrag" tool locates and consolidates fragmented boot files, data files, and folders on local volumes.
It should be used as follows:


defrag volume

defrag volume [/a]

defrag volume [/a] [/v]

defrag volume [/v]

defrag volume [/f]


volume : The drive letter or a mount point of the volume to be defragmented.

/a : Analyzes the volume and displays a summary of the analysis report.

/v : Displays the complete analysis and defragmentation reports.

When used in combination with /a, displays only the analysis report. When used alone, displays both the analysis and defragmentation reports.

/f : Forces defragmentation of the volume regardless of whether it needs to be defragmented.

/? : Displays help at the command prompt.


- A volume must have at least 15% free space to be completely and adequately defragmented. Defrag uses this space as a sorting area for file fragments. If a volume has less than 15% free space, defrag will only partially defragment it. To increase the free space on a volume, delete unneeded files or move them to another disk.
- You cannot defragment volumes that the file system has marked as dirty, which indicates possible corruption. You must run chkdsk (see SGI 109277) on a dirty volume before you can defragment it. You can determine if a volume is dirty by using the "fsutil dirty" query command.
- While defrag is analyzing and defragmenting a volume, it displays a blinking cursor. When defrag is finished analyzing and defragmenting the volume, it displays the analysis report, the defragmentation report, or both reports, and then exits to the command prompt.
- By default, defrag displays a summary of both the analysis and defragmentation reports if you do not specify the /a or /v parameters.
- You can send the reports to a text file by typing >filename.txt, where filename.txt is a file name you specify. For example:

defrag volume /v >filename.txt

- To interrupt the defragmentation process, at the command line, press CTRL+C.
Related documents:
- 109277 Performing detailed check of the NTFS file system













If you need more information or guidance, then please contact technical support.

Rate this article

Very poor Excellent