Windows Defrag Command Tutorial with Examples To Defrag Disks
Disk performance is very important factor for Desktops and Servers. Desktops and Servers uses disks very busy way to write and read data. While buying disk we should prefer faster disk according to our budget. There are a way to make a disk faster without paying any money. We can defrag disks in Windows operating system. Keep in mind that this won’t work for SSD. We can use defrag
command to make our disk tidy for a file system.
GUI or Command Line
defrag
can be done in two way. First one is the GUI way Windows operating systems provide a GUI tool called Disk Defragmenter
. Other way is using command line tool defrag
.
Disk Defragmenter
We can find Disk Defragmenter GUI tool in Program files -> Accessories or simply writing down to the Start
menu.
Current status of partitions are listed with related drive letters. Also last run information is given. Prevent defragmenting System Reserved
partitions.We can select partition and click Defragment disk
button to start defragmentation. This may take some time. Also we can click Configure schedule
button to configure defragmentation for future times to start automatically.
Defrag Command
defrag
is a MS-DOS or Powershell command. In order to run defrag we need Administrator privileges which means we should start the command line as Administrator.
Defrag Help
We can list detailed help information about the defrag
command like below.
1 | >defrag /? |

Defrag Help
Perform Defrag To A Volume
The most popular usage form of defrag
is operating only single volume. We need to specify volume or partition name to the command. In this example we will defrag E:
partition.
1 | >defrag E: |

Perform Defrag To A Volume
After defragmentation following information is provided.
- Volume Size
- Free Space
- Total Fragmented Space
- Largest Free Space Size
Perform Defrag In All Volumes
If we want to defrag in all volumes we can use /C
option. This will start defragmentation process in all volumes in a sequential manner.
1 | > defrag /C |
Show Progress In Screen
Defragmentation operation generally takes sometimes. We can list current situation of defragmentation in the command line with /V
option. In this example we will list defragmentation progress of volume E:
1 | >defrag E: /V |

Show Progress In Screen