Over time, the files on your hard drive will become fragmented, and your computer will slow down because of having to “check” the files in different locations on the hard drive. To make your computer run faster and smoother, you can use the tools available on Windows 10 to defrag your files.
Defragmentation automatically means prolonging the life and performance of your drives.
Just like Windows 8 and Windows 7, Windows 10 also automatically defragments files on a schedule (by default, once a week). However, not always the tools automatically run and run continuously. If you notice that files load for a long time or after a month (maybe longer), how fragmented are the drives on Windows?
One thing to note about Solid State Drives (SSD): SSDs work differently than traditional hard drives. SSD drives do not need fragmentation. However, Windows also defragments the SSD once a month if necessary and if System Restore is enabled.
How to optimize the drive in the Optimize Drives tool
1. Do step 2 (ribbon File Explorer) or step 3 (drive properties) or step 4 (Settings) below to see how you want to open Optimize Drives.
2. Optimize the drive from File Explorer ribbon:
A) Open This PC in File Explorer ( Win + E ).
B) Select any hard drive, click the Drive Tools Manage tab, select the Optimize button in the ribbon and go to step 5 below.
3. Optimize the drive from Properties:
A) Open This PC in File Explorer ( Win + E ).
B) Right-click or press and hold on any hard drive, then select Properties.
C) Click the Tools tab, choose Optimize and go to step 5 below.
4. Optimize the drive from Settings:
A) Open Settings and click the System icon .
B) Click Storage on the left side, click the Optimize Drives link in the More storage settings section on the right, and go to step 5 below.
5. Select a drive you want or need to optimize and click the Optimize button .
- You can select a drive and click the Analyze button to see if it needs to be optimized.
- If the drive is more than 10% fragmented, then it should be optimized.
- Drive optimization can take anywhere from a few minutes to several hours to complete, depending on the size of the drive and the level of optimization required.
- You can still use your PC during optimization.
Starting with Windows 10 build 20241, Microsoft will make a few changes to Optimize Drives.
Added a new Advanced View checkbox to list all volumes, including hidden volumes. Please note that Microsoft is still setting up and running the tool, so you’ll see a checkbox in this build, but may not notice any difference clicking on it.
– List more details in the “Current status” column when the volumes are not available for defragmentation (for example, “Partition type not supported” and “File system type not supported” ).
– Added support press F5 to refresh.
Optimize the drive in the Command Prompt
1. Do step 2 or step 3 below depending on how you want to run defrag.
2. To run defrag in Command Prompt on Windows 10, open Command Prompt with admin rights and go to step 4 below.
3. To run defrag in Command Prompt when booting, open Command Prompt on boot. Type diskpart into Command Prompt and press Enter. Enter the volume list into the Command Prompt and press Enter.
Note down the drive letter you want to optimize. The drive letter is not always the same as when booting as it does in Windows.
D) Type exit into Command Prompt, press Enter and go to step 4 below.
4. Type the command below that you want to use into the Command Prompt and press Enter.
Commonly used commands:
defrag C: /O
Replace C: in the command with the drive letter you want.
defrag /C /O
Used for all HDDs and SSDs.
defrag <volumes> | /C | /E <volumes> [<task(s)>] [/H] [/M [n] | [/U] [/V]] [/I n]
Where <task (s)> is ignored (traditional defrag), or something like this: / A | [/ D] [/ K] [/ L] | / O | / X.
Or to keep track of an activity going on on a volume:
defrag <volume> /T
|/ A||Perform analysis on specified volumes.|
|/ B||Perform boot optimization to defragment the boot sector of the boot volume. This will not work on SSDs .|
|/ C||Perform the operation on all volumes.|
|/ D||Do traditional defragmentation (this is the default option).|
|/ E||Perform the operation on all volumes, except for those specified.|
|/H||Run the operation at normal priority (default is low).|
|/ I n||Optimized tier (tier) will run for at most n seconds per volume.|
|/ K||Perform Slab Consolidation on specified volumes.|
|/ L||Perform retrim on specified volumes. Only for SSD .|
|/ M [n]||Run operations on each parallel volume in the background. Maximum n streams optimize the parallel storage tiers.|
|/ O||Make the appropriate optimization for each vehicle type.|
|/ T||Keep track of an operation that has been performed on the specified volume.|
|/ U||Export progress of activity on screen.|
|/ V||Long output that contains fragmentation statistics.|
|/ X||Performs free space consolidation on specified volumes.|
Drive optimization in PowerShell
1. Open PowerShell as admin.
2. Do step 3 (analysis), step 4 (optimization), step 5 (TRIM), step 6 (defragment) below, depending on which command you want to use.
3. To analyze current drive optimization, enter the command below into PowerShell, press Enter, and go to step 7 below.
Optimize-Volume -DriveLetter <drive letter> -Analyze –Verbose
Assigned volume analysis for fragmentation statistics. Perform analysis and report only the current optimization status of the volume.
Replace <drive letter> in the above command with the actual drive letter you want to analyze.
Optimize-Volume -DriveLetter C -Analyze -Verbose
4. To automatically TRIM or properly defragment your backup drive, enter the command below into PowerShell, press Enter and go to step 7 below.
Optimize-Volume -DriveLetter <drive letter> -Verbose
Automatically perform proper optimization (TRIM or defragment) for the drive.
Replace <drive letter> in the above command with the actual drive letter you want to optimize.
Optimize-Volume -DriveLetter C -Verbose
5. To TRIM an SSD, enter the command below into PowerShell, press Enter, and go to step 7 below.
Optimize-Volume -DriveLetter <drive letter> -ReTrim -Verbose
Generates a TRIM and Unmap hint for all currently unused sectors of the volume, notifying memory that those sectors are no longer needed and can be deleted. This can restore unused space on the drives.
Replace <drive letter> in the above command with the actual letter of the SSD drive you want to TRIM.
Optimize-Volume -DriveLetter C -ReTrim -Verbose
6. To defragment the hard drive (do not use this command on an SSD), enter the command below into PowerShell, press Enter , and go to step 7 below.
Optimize-Volume -DriveLetter <drive letter> -Defrag -Verbose
Indicates the cmdlet will start defragmenting on the specified volume. Defragmentation consolidates fragmented areas of files to improve sequential read or write performance.
Replace <drive letter> in the above command with the actual letter of the hard drive you want to defragment.
Optimize-Volume -DriveLetter C -Defrag -Verbose
7. When done, you can close PowerShell if you want.
Refer to some more articles below:
- Why does Linux not need defragmentation?
- Fix Windows 10 errors with just 1 click with FixWin
- Unlock and improve Windows 10 features with 5 Registry tricks
- 5 ways to overcome the slow computer