How to Use "Optimize Drives" to Defrag HDD and TRIM SSD in Windows 8 and 8.1

information   Information
Optimize Drives, previously called Disk Defragmenter, helps to 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 runs automatically on a weekly schedule during the time you have set for automatic maintenance. You can also optimize drives on your PC manually any time you like.

This tutorial will show you how to open and use Optimize Drives or a command prompt to defrag hard disk drives and TRIM solid state drives in Windows 8, Windows RT, Windows 8.1, and Windows RT 8.1.

You must be signed in as an administrator to be able to do the steps in this tutorial.

Note   Note

  • If the drive is being used by another program, or is formatted using a file system other than 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.






OPTION ONE
To Use "Optimize Drives" to Manually Defragment and Optimize Drives

1.
In File Explorer, click/tap on Computer (Windows 8) or This PC (Windows 8.1), do step 1A or 1B below, then go to step 2 below.

A) Select a HDD or SSD, click/tap on Manage (Drive Tools) tab, and click/tap on the Optimize button in the ribbon. (see screenshot below)

Click image for larger version

B) Right click or press and hold on a HDD or SSD, click/tap on Properties, click/tap on Tools tab, Optimize button, and on OK. (see screenshot below)

Name:  Properties.jpg
Views: 36607
Size:  44.9 KB

2. Under Status, click/tap on the drive you want to optimize. (see screenshot below)
NOTE: The Media type column tells you what type (HDD or SSD) of drive you're optimizing.

Click image for larger version

3. To determine if a HDD needs to be optimized, click/tap on Analyze. If prompted by UAC, then click/tap on Yes. (see screenshot below)
NOTE: This is not available for a SSD.

Click image for larger version

4.
Check the Current status column to see whether you need to optimize the drive (SSD or HDD). If the drive is more than 10% fragmented, then you should optimize the drive now.

Click image for larger version

5.
To optimize the selected drive, click/tap on Optimize. If prompted by UAC, then click/tap on Yes. (see screenshot above and below)
NOTE: 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.

Click image for larger version

6. When finished, you can close the Optimize Drives window.






OPTION TWO
To Use Command Prompt to Manually Defragment and Optimize Drives

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

2. To Use an Elevated Command Prompt in Windows 8

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

3. To Use a Command Prompt at Boot

A) Open a command prompt at startup.

B) In the command prompt, type diskpart and press Enter.

C) In the command prompt, type list volume and press Enter.
NOTE: 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 8.

D) In the command prompt, type exit and press Enter.

E) Continue on to step 4 below.


4. In the command prompt, type in the following command below followed by one or more switches (flags) that you would like to use below with a space between each switch and press Enter.

Syntax:

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

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


Commonly Used Commands:
defrag C: /O
NOTE: Substitute C: in the command with the drive letter you want instead.

defrag /C /O
NOTE:
For all HDDs and SSDs.


Parameters:

NOTE: Switches in red below are new to Windows 8.

Switch (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).
/K Perform slab consolidation on the specified volumes.
/L Perform retrim on the specified volumes. Only for a SSD.
/M Run the operation on each volume in parallel in the background.
/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.

Click image for larger version



That's it,
Shawn