How to Defrag a Drive in Windows 10

This post explains various methods you can use to defragment a drive in Windows 10, including the graphical tool 'MMC', the console defrag command, and PowerShell.


Optimizing your PC's internal hard drive is a very important process that improves the performance of your computer. Fortunately, Windows includes tools to complete this important process.

Windows 10 automatically performs disk defragmentation using the following schedule:

  • for NTFS hard drives - once a week.
  • SSD TRIM operation for SSD(s) - also once a week.

During active use, hard disk performance suffers due to file system fragmentation, which significantly slows down access time. SSDs have very fast access time to data stored in any part of the disk and do not need to be defragmented, but they need to send a TRIM command, which tells the SSD controller to erase unused blocks that are no longer in use, so that when it comes time to actually write new ones data in these blocks, performance is not affected.

Modern Windows versions are smart enough to pick the right optimization method and time period depending on your drive specifications. If you want, you can optimize your drives manually to ensure that you have the best performance of the OS.

To defrag a drive in Windows 10,

  1. Open File Explorer.
  2. Click on This PC in the left pane.
  3. Right-click on the drive you want to defragment.
  4. Select Properties from the context menu.Windows 10 Defrag Drive 1
  5. Open the Tools tab and click/tap on the button Optimize under Optimize and defragment drive.Windows 10 Defrag Drive 2
  6. Click on the Analyze button to see if the drive needs to be optimized. The button is not available if you have already analyzed the drive.
  7. To optimize the drive, click the Optimize button. If the file system on drive is more than 10% fragmented, then you should optimized it.Windows 10 Defrag Drive 4

Defrag a Drive in Command Prompt

There is a way to optimize drives in the command prompt. Here is how it can be done.

  1. Open a command prompt as Administrator.
  2. Type the following command to optimize your C: drive:
    defrag C: /O
  3. Replace the C: portion with the drive letter you need to optimize and defrag,

The defrag command supports the following command line arguments and options.

Syntax:

defrag <volumes> | /C | /E <volumes> [<task(s)>] [/H] [/M [n] | [/U] [/V]] [/I n]

Where <task(s)> is omitted (traditional defrag), or as follows:
/A | [/D] [/K] [/L] | /O | /X

Or, to track an operation already in progress on a volume:
defrag <volume> /T

Parameters:

Value Description

/A Perform analysis on the specified volumes.

/C Perform the operation on all volumes.

/D Perform traditional defrag (this is the default).

/E Perform the operation on all volumes except those specified.

/G Optimize the storage tiers on the specified volumes.

/H Run the operation at normal priority (default is low).

/I n Tier optimization would run for at most n seconds on each volume.

/K Perform slab consolidation on the specified volumes.

/L Perform retrim on the specified volumes.

/M [n] Run the operation on each volume in parallel in the background.
At most n threads optimize the storage tiers in parallel.

/O Perform the proper optimization for each media type.

/T Track an operation already in progress on the specified volume.

/U Print the progress of the operation on the screen.

/V Print verbose output containing the fragmentation statistics.

/X Perform free space consolidation on the specified volumes.

For example, you can optimize all your partitions at once, run the command:

defrag /C /O

Defrag a Drive in PowerShell

It is possible to defrag a drive in Windows 10 using PowerShell. You need to use the Optimize-Volume cmdlet. Open an elevated PowerShell and type the command below.

Optimize-Volume -DriveLetter drive_letter -Verbose

Replace the "drive_letter" portion with the actual drive letter of your partition. For example, the following command will optimize the drive D:

Optimize-Volume -DriveLetter D -Verbose

Using this cmdlet, you can analyze the specified partition for fragmentation statistics. The command looks as follows:

Optimize-Volume -DriveLetter C -Analyze -Verbose

This will show the fragmentation statistics for drive C.

If you are using an SSD drive, the following command should be used.

Optimize-Volume -DriveLetter DriveLetter -ReTrim -Verbose

Replace the DriveLetter portion with your solid state drive partition letter.

Summary
How to Defrag a Drive in Windows 10
Article Name
How to Defrag a Drive in Windows 10
Description
This post explains various methods you can use to defragment a drive in Windows 10, including the graphical tool 'MMC', the console defrag command, and PowerShell.
Author
Publisher Name
MFTNEXT
Publisher Logo

Author: MFTNEXT Team

MSFTNEXT is a small team of authors who love to engage with the latest technology and gadgets. Being passionate Windows bloggers, we are happy to help others fix their system issues.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.