Fix "Optimization Not Available" in Optimize Drives in Windows
Microsoft's Windows operating system runs maintenance tasks including disk analysis and defragmention regularly on its own.
Most Windows users and administrators don't need to run these manually anymore, but there are cases where you'd like to do so.
I checked Optimize Drives recently and discovered that Windows refused to run on two of the hard drives. Windows displayed "Optimization not available" as the status, "unknown" as the media type, and "never run" as the last run date and time.
You can access the Optimize Drives tool by right-clicking on a drive in Explorer, selecting Properties from the context menu, and opening Tools > Optimize.
The analyze and optimize buttons could not be used in the window as they were not active. My first assumption was that this might have something to do with encryption, as both volumes were encrypted and only mounted when I needed to access data on them.
Two solutions came to my mind: try the command line version of defrag to see if it would work, or use third-party defragmentation software like Smart Defrag, Vopt, Defraggler or Live Defrag. I decided to try the command line tool defrag first as it is a first-party solution.
Fixing the "Optimization not available" issue
You need to launch an elevated command prompt to get started. If you are on Windows 10, use the shortcut Windows-X to display the "hidden" menu and select Command Prompt (Admin). You may also open Start on any version of Windows, type cmd.exe, right-click on the result, and select run as administrator to launch an elevated command prompt window.
The core command is defrag and you may want to start running defrag /? to display all command options. Microsoft has a handy reference on the company's Docs website that explains each of the parameters and gives some examples.
You may want to run an analysis first. The analysis returns the fragmentation status of the drive and gives a recommendation.
defrag p: /A
The command analysis the fragmentation status of the drive P on the device. You need to change the drive letter if it is not drive P that you want to analyze. The command defrag c: /A would analyze the C drive instead.
You may defragment the drive if the drive is fragmented, e.g. when Windows recommends that you should defragment the drive.
defrag p: /U /V
The command runs the defragmentation operation on drive P. The parameters U and V echo progress and information on the screen while the operation takes place.
You will notice that defrag runs fine on the drives even though Windows' "Optimize Drives" tool refused to run these operations.
Tip: If you want to defrag SSDs, use the parameters /L and /O as well. It instructs defrag to run a trim command after the operation completes and to run the proper optimization for the media type.
Other parameters of interest are:
- E -- To perform the operation on all drives except those that you specify.
- C -- To perform the defrag operation on all drives.
- X -- To consolidate free disk space on the volumes you specify.
If Windows refuses to run defragmentation operations on a drive in "Optimize Drives", use the command line version of defrag instead to run the commands.Advertisement