Optimizing your PC's internal disk drive is a very important process which improves your PC's performance. Luckily, Windows includes a number of tools to perform to this important process. Today we will see, how you can defrag a drive in Windows 10.
Out of the box, Windows 10 performs disk defragmentation once a week for hard drives and SSD TRIM operation for SSDs. During active use, hard drive performance suffers due to file system fragmentation which notably slows down the access time. SSDs have very fast access times for data stored in any part of the drive and do not need to defragmented but they need to be sent a TRIM command which tells the SSD controller to erase unused blocks which are no longer in use, so that when the time comes to actually write new data to those blocks, performance isn't affected.
Modern Windows versions are smart enough to pick the right optimization method and time period depending on your drive specifications. If you need to change the default schedule, you can do so for individual drives or disable it completely. See the following article:
Optimize Drives By Schedule In Windows 10
If you need to optimize your drives manually, here is how it can be done.
To defrag a drive in Windows 10, do the following.
- Open File Explorer.
- Navigate to the This PC folder.
- Right click the drive you want to defrag and select Properties from the context menu.
- Switch to the Tools tab and click the button Optimize under Optimize and defragment drive.
- In the next window, click on the Analyze button to see if it needs to be optimized.
- To optimize the drive, click the Optimize button. If the file system on drive is more than 10% fragmented, then you should optimized it.
Defrag a Drive in Command Prompt
There is a way to optimize drives in the command prompt. Here is how it can be done.
- Open an elevated command prompt.
- Type the following command to optimize your C: drive:
defrag C: /O
- 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 | /XOr, to track an operation already in progress on a volume:
defrag <volume> /TParameters:
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 YourDriveLetter -ReTrim -Verbose
Replace the YourDriveLetter portion with your solid state drive partition letter.
Please refer to the following article:
That's it.
Support us
Winaero greatly relies on your support. You can help the site keep bringing you interesting and useful content and software by using these options:
Defrag HDD – Boot Windows USB – Repair – Troubleshoot – CMD
c:
cd windows
cd system32
defrag c: /u
disk optimization / defrag does not work correctly with Windows 10 version 2004, Sergey:
http://www.windowsphoneinfo.com/threads/windows-10-version-2004-disk-optimization-bug.319955
MS has yet to fix this bug before releasing version 2004 to the general public