Windows Defrag Command Tutorial – POFTUT

Windows Defrag Command Tutorial

Disk performance is a very important factor for Desktops and Servers. Desktops and Servers use disks very busy way to write and read data. While buying disk we should prefer a faster disk according to our budget. There is 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 defragcommand to make our disk tidy for a file system.

GUI or Command Line

defrag can be done in two ways. The first one is the GUI way Windows operating systems provide a GUI tool called Disk Defragmenter. Another way is using the 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.

Disk Defragmenter
Disk Defragmenter

The current status of partitions is listed with related drive letters. Also, last run information is given. Prevent defragmenting System Reserved partitions. We can select a partition and click the Defragment disk button to start the 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 an 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.

> defrag /?
Defrag Help
Defrag Help

Perform Defrag To A Volume

The most popular usage form of defrag is operating only a single volume. We need to specify the volume or partition name to the command. In this example, we will defrag E: partition.

> defrag E:
Perform Defrag To A Volume
Perform Defrag To A Volume

After defragmentation following information is provided.

  • Volume Size
  • Free Space
  • Total Fragmented Space
  • Largest Free Space Size
LEARN MORE  Linux iostat Command Tutorial With Examples

Perform Defrag In All Volumes

If we want to defrag in all volumes we can use /C option. This will start the defragmentation process in all volumes in a sequential manner.

> defrag /C

Show Defrag Progress In Screen

Defragmentation operation generally takes sometimes. We can list the current situation of defragmentation in the command line with /V option. In this example, we will list defragmentation progress of volume E:

> defrag E: /V
Show Progress In Screen
Show Progress In Screen

Leave a Comment