System Optimize and Defragment Drives in Windows 11


  • Staff
Defrag_banner.png

Optimizing your drives can help your PC run smoother and boot up faster.

Windows 11 includes Optimize Drives that will automatically retrim a SSD or defrag a HDD as needed.
  • Retrim = Generates TRIM and Unmap hints for all currently unused sectors of the SSD or NVMe volume, notifying the underlying storage that the sectors are no longer needed and can be purged. This can recover unused capacity on thinly provisioned drives.
  • Defrag = Locates and consolidates fragmented files on local HDD volumes to improve system performance.
Optimize Drives runs automatically on a weekly schedule at the time set in automatic maintenance. You can also manually run Optimize Drives on demand as needed.

This tutorial will show you how to optimize and defragment drives in Windows 11.


You must be signed in as an administrator to optimize and defrag drives.

If the drive is being used by another program, or is formatted using a file system other than ReFS, NTFS, FAT, or FAT32, it can't be optimized.

Network drives can't be optimized.



Contents

  • Option One: Optimize and Defragment Drives in Settings
  • Option Two: Optimize and Defragment Drives in File Explorer
  • Option Three: Optimize and Defragment Drives using defrag command
  • Option Four: Optimize and Defragment Drives in PowerShell




Option One

Optimize and Defragment Drives in Settings


1 Open Settings (Win+I).

2 Click/tap on System on the left side, and click/tap on Storage on the right side. (see screenshot below)


Optimize_drives_Settings-1.png

3 Click/tap on Advanced storage settings to expand it open, and click/tap on Drive optimization. (see screenshot below)

Optimize_drives_Settings-2.png

4 In Optimize Drives, select a drive (ex: "C") you want or need to optimize, and click/tap on the Optimize button. (see screenshots below)
  • Checking Advanced View will list all volumes including hidden volumes.
  • You can select a drive and click/tap on the Analyze button to see if it needs to be optimized.
  • If the drive is more than 10% fragmented, then it should be optimized.
  • Optimizing a drive might take anywhere from several minutes to a few hours to finish, depending on the size of the drive and degree of optimization needed.
  • You can still use your PC during the optimization process.
Optimize_Drives-1.png
Optimize_Drives-2.png

5 When finished, you can close Settings and Optimize Drives if you like.




Option Two

Optimize and Defragment Drives in File Explorer


1 Open This PC in File Explorer (Win+E).

2 Right click or press and hold on a drive, and click/tap on Properties. (see screenshot below)

Optimize_drives_This-PC-1.png

3 Click/tap on the Tools tab, click/tap on Optimize, and click/tap on OK. (see screenshot below)

Optimize_drives_This-PC-2.png

4 In Optimize Drives, select a drive (ex: "C") you want or need to optimize, and click/tap on the Optimize button. (see screenshots below)
  • Checking Advanced View will list all volumes including hidden volumes.
  • You can select a drive and click/tap on the Analyze button to see if it needs to be optimized.
  • If the drive is more than 10% fragmented, then it should be optimized.
  • Optimizing a drive might take anywhere from several minutes to a few hours to finish, depending on the size of the drive and degree of optimization needed.
  • You can still use your PC during the optimization process.
Optimize_Drives-1.png
Optimize_Drives-2.png

5 When finished, you can close File Explorer and Optimize Drives if you like.




Option Three

Optimize and Defragment Drives using defrag command


For more defrag command usage details, see: defrag | Microsoft Docs


1 Open Windows Terminal (Admin), and select either Windows PowerShell or Command Prompt.

2 Type the command you want to use below into Windows Terminal (Admin), and press Enter. (see screenshots below)

(For specific SSD or HDD drive)​
defrag <drive letter>: /O

OR​

(For all SSD and HDD drives)​
defrag /C /O

Substitute <drive letter> in the command above the actual drive letter (ex: "C") of the drive you want to optimize.

For example: defrag C: /O


3 When finished, you can close Windows Terminal (Admin)s if you like.

defrag_command.png

defrag_HDD.png





Option Four

Optimize and Defragment Drives in PowerShell


For more Optimize-Volume command usage details, see: Optimize-Volume | Microsoft Docs


1 Open Windows Terminal (Admin), and select Windows PowerShell.

2 Type the command below into Windows Terminal (Admin), and press Enter. (see screenshot below)

Optimize-Volume -DriveLetter <drive letter> -Verbose

Substitute <drive letter> in the command above the actual drive letter (ex: "C") of the drive you want to optimize.

For example: Optimize-Volume -DriveLetter C -Verbose


3 When finished, you can close Windows Terminal (Admin)s if you like.

Optimize-Volume_command.png



That's it,
Shawn Brink


 

Attachments

  • Defrag.png
    Defrag.png
    97.2 KB · Views: 51
Last edited:
Top Bottom