Optimize and Defrag Drives in Windows 10  

Page 1 of 16 12311 ... LastLast
    Optimize and Defrag Drives in Windows 10

    Optimize and Defrag Drives in Windows 10

    How to Optimize and Defragment Drives in Windows 10
    Published by Category: Performance & Maintenance
    05 Dec 2021
    Designer Media Ltd

    How to Optimize and Defragment Drives in Windows 10


    One of the best ways you can improve your PC's performance is by optimizing the drive. Windows includes features to help optimize the different types of drives that PCs use today. No matter which type of drive your PC uses, Windows automatically chooses the optimization that's right for your drive.

    By default, Optimize Drives, previously called Disk Defragmenter, runs automatically on a weekly schedule at the time set in automatic maintenance. But you can also optimize drives on your PC manually.

    See also: The real and complete story - Does Windows defragment your SSD? | SCOTT HANSELMAN

    This tutorial will show you how to manually optimize drives to defrag a HDD or TRIM a SSD in Windows 10.

    You must be signed in as an administrator to be able to optimize 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.

    If a drive isn't appearing in Optimize Drives, it might be because it contains an error. Try to repair the drive with chkdsk first, then return to Optimize Drives to try again.


    The Defrag log file is saved in Event Viewer > Windows Logs > Application, right click on Application, click on Filter Current Log, select Defrag in the Event sources drop menu, and click on OK.



    Contents







    OPTION ONE

    To Optimize Drives in Optimize Drives Tool


    1 Do step 2 (File Explorer ribbon), or step 3 (drive properties), or step 4 (Settings) below for how you would like to open Optimize Drives.


     2. Optimize Drives from File Explorer Ribbon

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

    B) Select any hard drive, click/tap on the Drive Tools Manage tab, click/tap on Optimize button in the ribbon, and go to step 5 below. (see screenshot below)

    Optimize and Defrag Drives in Windows 10-optimize_drive-1.png


     3. Optimize Drives from Drive Properties

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

    B) Right click or press and hold on any hard drive, and click/tap on Properties. (see screenshot below)

    Optimize and Defrag Drives in Windows 10-optimize_drive-2a.png

    C) Click/tap on the Tools tab, click/tap on the Optimize button, and go to step 5 below. (see screenshot below)

    Optimize and Defrag Drives in Windows 10-optimize_drive-2b.png


     4. Optimize Drives from Settings

    A) Open Settings, and click/tap on the System icon.

    B) Click/tap on Storage on the left side, click/tap on the Optimize Drives link under the More storage settings section on the right side, and go to step 5 below. (see screenshot below)

    Optimize and Defrag Drives in Windows 10-optimize_drives_in_settings.jpg


    5 Select a drive you want or need to optimize, and click/tap on the Optimize button. (see screenshots below)

    • 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.

    Starting with Windows 10 build 20241, Microsoft is making a few changes to Optimize Drives.

    • Adding a new Advanced View checkbox to list all volumes including hidden volumes. Please note Microsoft is still getting this one up and running, so you’ll see the checkbox in this build, but may not notice any differences when you click it.
    • Listing more details in the “Current status” column when volumes are not available for defrag (for example, “Partition type not supported” and “File system type not supported”).
    • Adding support for pressing F5 to refresh.

    Optimize and Defrag Drives in Windows 10-optimize_drive-3.png Optimize and Defrag Drives in Windows 10-20241_optimized_drives.png






    OPTION TWO

    To Optimize Drives in Command Prompt


    1 Do step 2 or step 3 below for how you would like to run the defrag command.


     2. To Run Defrag in Command Prompt in Windows 10

    A) Open an elevated command prompt, and go to step 4 below.


     3. To Run Defrag in Command Prompt at boot

    A) Open a command prompt at boot.

    B) Type diskpart into the command prompt, and press Enter.

    C) Type list volume into the command prompt, and press Enter.

    Make note of the drive letter that you want to optimize. The drive letter for the drive will not always be the same at boot as it is in Windows.


    D) Type exit into the command prompt, press Enter, and go to step 4 below.

    4 Type the command below you want to use into the command prompt, and press Enter.

    Commonly Used Commands:

    defrag C: /O

    Substitute C: in the command with the drive letter you want instead.


    OR

    defrag /C /O

    For all HDDs and SSDs.


    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.
    /B Perform boot optimization to defrags the boot sector of the boot volume. This will not work on a SSD.
    /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.
    /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. Only for a SSD.
    /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.

    Optimize and Defrag Drives in Windows 10-defrag_command_parameters.png






    OPTION THREE

    To Optimize Drives in PowerShell


    For more Optimize-Volume command usage options, see: Optimize-Volume


    1 Open an elevated PowerShell.

    2 Do step 3 (analyze), step 4 (optimize), step 5 (TRIM), step 6 (defrag) below for what command you want to use.


     3. To Analyze Current Optimization of Drive

    A) Type the command below into PowerShell, press Enter, and go to step 7 below.

    Optimize-Volume -DriveLetter <drive letter> -Analyze –Verbose

    Analyzes the volume specified for fragmentation statistics. Performs analysis only and reports the current optimization state of the volume.

    Substitute <drive letter> in the command above with the actual drive letter you want to analyze.

    For example: Optimize-Volume -DriveLetter C -Analyze -Verbose

    Optimize and Defrag Drives in Windows 10-optimize-volume-analyze.png


     4. To Automatically TRIM or Defrag Drive for what is Proper

    A) Type the command below into PowerShell, press Enter, and go to step 7 below.

    Optimize-Volume -DriveLetter <drive letter> -Verbose

    Automatically performs the proper optimization (TRIM or defrag) for the drive.

    Substitute <drive letter> in the command above with the actual drive letter you want to optimize.

    For example: Optimize-Volume -DriveLetter C -Verbose

    Optimize and Defrag Drives in Windows 10-optimize-volume.png


     5. To TRIM a SSD (Solid State Drive)

    Do not use this command on a hard drive (HDD spinner).


    A) Type the command below into PowerShell, press Enter, and go to step 7 below.

    Optimize-Volume -DriveLetter <drive letter> -ReTrim -Verbose

    Generates TRIM and Unmap hints for all currently unused sectors of the 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.

    Substitute <drive letter> in the command above with the actual drive letter of the SSD you want to TRIM.

    For example: Optimize-Volume -DriveLetter C -ReTrim -Verbose

    Optimize and Defrag Drives in Windows 10-optimize-volume-retrim.png


     6. To Defrag a Hard Drive

    Do not use this command on a solid state drive (SSD).


    A) Type the command below into PowerShell, press [key]Enter[/key, and go to step 7 below.

    Optimize-Volume -DriveLetter <drive letter> -Defrag -Verbose

    Indicates that the cmdlet initiates defragmentation on the specified volume. Defragmentation consolidates fragmented regions of files to improve performance of sequential reads or writes.

    Substitute <drive letter> in the command above with the actual drive letter of the hard drive you want to defrag.

    For example: Optimize-Volume -DriveLetter C -Defrag -Verbose

    Optimize and Defrag Drives in Windows 10-optimize-volume-defrag.jpg

    7 When finished, you can close PowerShell if you like.


    That's it,
    Shawn Brink






  1. Posts : 591
    Windows 10 Pro 64bit; Windows 10 TP; KDE Neon
       #1

    Very nice tutorial, thank you, I've just optimized both of my SSDs. What about the System Reserved volumes? They do appear in the menu but nothing happens. Can those be optimized, as well, and is it required?

    Thank you.
      My Computers


  2. Posts : 68,543
    64-bit Windows 11 Pro for Workstations
    Thread Starter
       #2

    Hello Joanne,

    You could optimize the System Reserved volumes, but usually they don't need it since nothing is saved or deleted from them once created during installation.
      My Computers


  3. Posts : 591
    Windows 10 Pro 64bit; Windows 10 TP; KDE Neon
       #3

    All right, thank you Brink

    I would like to ask you to make a tutorial on something. I peg your pardon but I have not found the appropriate thread to place this request. Anyway, have you made or can you make a Tutorial on how can the average user benefit the most from the usage of the Event Viewer?

    For example, how can I see which program requires the most time on Start up or the total time of start up itself?
    If something like this already exists please provide a link.

    Thank you!!
      My Computers


  4. Posts : 68,543
    64-bit Windows 11 Pro for Workstations
    Thread Starter
       #4

    That would be a broad topic. For now, you could look under E for Event Viewer in the tutorial indexes below for some options to help. :)

    Windows 7 - Tutorial Index - Page 2 - Windows 7 Help Forums

    Windows 8 - Tutorial Index
      My Computers


  5. Posts : 591
    Windows 10 Pro 64bit; Windows 10 TP; KDE Neon
       #5

    AWESOME!! Thank you!!
      My Computers


  6. Posts : 7,254
    Windows 10 Pro 64-bit
       #6

    I've always found it odd that when you type "defrag" in the search, the one that has the defrag icon isnt the actual exe file. The exe file doen't have an icon.

    Computer newbies would be confused by that.
      My Computers


  7. Posts : 1
    Windows 10 Preview
       #7

    Is SSD optimization needed? There should be internal trash collection done by the drive itself, right?
      My Computer


  8. Posts : 68,543
    64-bit Windows 11 Pro for Workstations
    Thread Starter
       #8

    Hello Silentheero, and welcome to Ten Forums.

    While TRIM is not required for today's SSDs, it does help garbage collection, and extend the life of the SSD. Here's a good article I found that explains this very well.

    Ask Ars: "My SSD does garbage collection, so I don't need TRIM... right?"¯ | Ars Technica
      My Computers


  9. Posts : 21
    Windows 10
       #9

    Hi guys,

    A quick question; on my own PC (running Windows 10) I can select to 'optimize' my SSD (which will trim it most probably).
    However on my mother's PC (also running Windows 10) the SSD is not being shown, only her harddisk (which is being used for backups and pictures)?

    Is there a Windows registry setting which I can change, so I can also select the SSD in Windows defrag program, so I can 'optimize' the SSD as well?

    Thank you.
      My Computer


 

Tutorial Categories

Optimize and Defrag Drives in Windows 10 Tutorial Index Network & Sharing Instalation and Upgrade Browsers and Email General Tips Gaming Customization Apps and Features Virtualization BSOD System Security User Accounts Hardware and Drivers Updates and Activation Backup and Restore Performance and Maintenance Mixed Reality Phone


  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 03:57.
Find Us




Windows 10 Forums